Skip to main contentSkip to main content
Room Banner
Back to all walkthroughs
Room Icon

Command Injection

Premium room

Learn about a vulnerability allowing you to execute commands through a vulnerable app, and its remediations.

easy

20 min

128,594

User profile photo.
User profile photo.

To access material, start machines and answer questions login.

Introduction

Web applications frequently execute commands on the underlying operating system as part of their normal functionality. When a developer builds an application that takes user input and passes it into a system command without proper checks, an attacker can inject additional commands alongside the legitimate ones. This is , a vulnerability that allows arbitrary -level commands to be executed through a vulnerable application.

The injected commands run with the same privileges as the application itself. If a web server runs as a user called joe, every injected command executes as joe and inherits whatever permissions that account holds. If the application runs with elevated privileges, the impact scales accordingly.

You may hear referred to as "Remote Code Execution" (). The two concepts are related but distinct. describes the broader outcome where an attacker gains the ability to execute code on a remote system. is one specific technique for achieving that outcome. Other techniques such as insecure deserialization or memory corruption can also lead to .

In the Top 10:2025, this vulnerability falls under A05: Injection. specifically maps to CWE-78 (Improper Neutralization of Special Elements used in an Command). Even though injection has dropped a couple of positions compared to earlier editions of the list, it remains one of the most widely tested and exploited vulnerability classes.

In this room, we cover what is, how it arises in application code, how to detect and exploit it, and how to prevent it. The final task provides a hands-on practical where you will exploit a vulnerable application to retrieve a flag.

Learning Objectives

By the end of this room, you will be able to:

  • Explain what is and why it poses a critical risk to applications
  • Understand how unsafe use of system calls in application code introduces this vulnerability
  • Distinguish between blind and verbose and know how to detect each
  • Exploit using shell operators and common payloads on both and Windows
  • Apply remediation techniques such as input sanitisation and the use of safe APIs
  • Perform against a live target to retrieve sensitive data

Prerequisites

This room assumes familiarity with basic commands and shell operators. If you are not comfortable with these yet, complete the Fundamentals module first. The room also includes code examples in and Python. You do not need to be proficient in either language, but a basic understanding of how web applications handle user input will help. The Web Fundamentals path is a useful starting point if you need to brush up.

Answer the questions below

Click me to proceed to the next tasks.