---
title: "CAPEC-88: OS Command Injection"
url: https://radicalnotion.ai/capec/capec-88
type: capec
description: "In this type of an attack, an adversary injects operating system commands into existing application functions. An application that uses untrusted input to build command strings is vulnerable. An adversary can leverage OS command injection in an application to elevate privileges, execute arbitrary commands and compromise the underlying operating system."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-88: OS Command Injection

- **Abstraction:** Standard
- **Status:** Draft
- **Typical severity:** High
- **Likelihood of attack:** High
- **CAPEC catalog version:** 3.9

## Description

In this type of an attack, an adversary injects operating system commands into existing application functions. An application that uses untrusted input to build command strings is vulnerable. An adversary can leverage OS command injection in an application to elevate privileges, execute arbitrary commands and compromise the underlying operating system.

## Execution flow

### Step 1: Explore

\[Identify inputs for OS commands\] The attacker determines user controllable input that gets passed as part of a command to the underlying operating system.

- Port mapping. Identify ports that the system is listening on, and attempt to identify inputs and protocol types on those ports.
- TCP/IP Fingerprinting. The attacker uses various software to make connections or partial connections and observe idiosyncratic responses from the operating system. Using those responses, they attempt to guess the actual operating system.
- Induce errors to find informative error messages

### Step 2: Explore

\[Survey the Application\] The attacker surveys the target application, possibly as a valid and authenticated user

- Spidering web sites for all available links
- Inventory all application inputs

### Step 3: Experiment

\[Vary inputs, looking for malicious results.\] Depending on whether the application being exploited is a remote or local one the attacker crafts the appropriate malicious input, containing OS commands, to be passed to the application

- Inject command delimiters using network packet injection tools (netcat, nemesis, etc.)
- Inject command delimiters using web test frameworks (proxies, TamperData, custom programs, etc.)

### Step 4: Exploit

\[Execute malicious commands\] The attacker may steal information, install a back door access mechanism, elevate privileges or compromise the system in some other way.

- The attacker executes a command that stores sensitive information into a location where they can retrieve it later (perhaps using a different command injection).

## Prerequisites

- User controllable input used as part of commands to the underlying operating system.

## Skills required

- **High:** The attacker needs to have knowledge of not only the application to exploit but also the exact nature of commands that pertain to the target operating system. This may involve, though not always, knowledge of specific assembly commands for the platform.

## Consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Integrity, Availability | Execute Unauthorized Commands | Run Arbitrary Code |
| Confidentiality, Access Control, Authorization | Gain Privileges, Bypass Protection Mechanism | - |
| Confidentiality | Read Data | - |

## Mitigations

- Use language APIs rather than relying on passing data to the operating system shell or command line. Doing so ensures that the available protection mechanisms in the language are intact and applicable.
- Filter all incoming data to escape or remove characters or strings that can be potentially misinterpreted as operating system or shell commands
- All application processes should be run with the minimal privileges required. Also, processes must shed privileges as soon as they no longer require them.

## Example instances

A transaction processing system relies on code written in a number of languages. To access this functionality, the system passes transaction information on the system command line. An attacker can gain access to the system command line and execute malicious commands by injecting these commands in the transaction data. If successful, the attacker can steal information, install backdoors and perform other nefarious activities that can compromise the system and its data. See also: A vulnerability in Mozilla Firefox 1.x browser allows an attacker to execute arbitrary commands on the UNIX/Linux operating system. The vulnerability is caused due to the shell script used to launch Firefox parsing shell commands that are enclosed within back-ticks in the URL provided via the command line. This can be exploited to execute arbitrary shell commands by tricking a user into following a malicious link in an external application which uses Firefox as the default browser (e.g. the mail client Evolution on Red Hat Enterprise Linux 4).

## Related weaknesses (CWE)

- [CWE-20](https://radicalnotion.ai/cwe/cwe-20): Improper Input Validation
- [CWE-78](https://radicalnotion.ai/cwe/cwe-78): Improper Neutralization of Special Elements used in an OS Command
- [CWE-88](https://radicalnotion.ai/cwe/cwe-88): Improper Neutralization of Argument Delimiters in a Command
- [CWE-697](https://radicalnotion.ai/cwe/cwe-697): Incorrect Comparison

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-248](https://radicalnotion.ai/capec/capec-248) | Command Injection |

## Taxonomy mappings

| Taxonomy | Entry | Id |
| --- | --- | --- |
| WASC | OS Commanding | 31 |

## Frequently asked questions

### What is CAPEC-88?

In this type of an attack, an adversary injects operating system commands into existing application functions. An application that uses untrusted input to build command strings is vulnerable. An adversary can leverage OS command injection in an application to elevate privileges, execute arbitrary commands and compromise the underlying operating system.

### How does a OS Command Injection attack work?

It typically unfolds over 4 phases. It begins with: \[Identify inputs for OS commands\] The attacker determines user controllable input that gets passed as part of a command to the underlying operating system.

### How do you prevent CAPEC-88?

Use language APIs rather than relying on passing data to the operating system shell or command line. Doing so ensures that the available protection mechanisms in the language are intact and applicable.

### What weaknesses does CAPEC-88 target?

CAPEC-88 exploits 4 CWE weaknesses: CWE-20 (Improper Input Validation), CWE-78 (Improper Neutralization of Special Elements used in an OS Command), CWE-88 (Improper Neutralization of Argument Delimiters in a Command) and CWE-697 (Incorrect Comparison).

### How severe is CAPEC-88?

MITRE rates CAPEC-88 as High severity with high likelihood of attack.

Primary source: [MITRE CAPEC](https://capec.mitre.org/data/definitions/88.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/capec/capec-88). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
