# OS command injection

An untrusted parameter becomes shell command syntax rather than remaining a data argument.

**Candidate CWE:** [CWE-78](https://cwe.mitre.org/data/definitions/78.html)

## Test hypothesis

Trace an observed local worker into its subprocess sink. In the disposable replica, use a marker-only printf operation appropriate to that shell, comparing the literal and interpreted paths in process logs.

## Evidence required

The marker comes from shell-command interpretation at the identified sink, with a reproducible input path and attacker preconditions. If only options to the intended executable change, use the separate argument-injection card and CWE-88.

## Rule out false positives

Text reflection, a failed command, and a tool whose documented purpose permits that exact trusted operation are not proof of a boundary violation.

## Playbook and command references

- [Trace input into queries, commands, and templates](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/modules/injection-tracing.html) — Prove interpretation at a specific sink using small paired experiments instead of payload spraying.

[Find the associated command snippets](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/commands.html?q=Trace%20input%20into%20queries%2C%20commands%2C%20and%20templates)

## Referenced by these target playbooks

[Web & API](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/web-api.html) · [OSS & self-hosted](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/oss.html) · [Desktop & extensions](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/desktop.html) · [AI, agents & MCP](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/ai.html) · [Cloud & containers](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/cloud.html)

## Report checklist

- [ ] Capture the affected version, configuration, identities, and object ownership.
- [ ] Preserve a valid baseline and a negative control.
- [ ] Reproduce the forbidden data access, action, or state change on controlled fixtures.
- [ ] Explain the intended security rule and why the observed behavior violates it.
- [ ] State prerequisites, uncertainty, cleanup, and the smallest demonstrated impact.

## Conditional ATT&CK mapping

- [T1190 · Exploit Public-Facing Application](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/attack.html#T1190) — **Only if:** A demonstrated exploit of an Internet-facing service provides initial access to its host, system, or environment; explain the foothold and trust boundary. **Not established by:** Not a blanket label for every web/API weakness. A reflected parameter, scanner alert, or ordinary cross-account object read alone does not establish initial network/system access.
- [T1059.004 · Command and Scripting Interpreter: Unix Shell](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/attack.html#T1059-004) — **Only if:** The demonstrated exploit invokes a Unix shell to execute commands; capture the shell invocation or equivalent process evidence in a controlled reproduction. **Not established by:** Calling an executable directly without a shell, template evaluation, and generic RCE are not automatically Unix Shell. Choose an interpreter only when supported by evidence.

## Primary references

- [PortSwigger command injection](https://portswigger.net/web-security/os-command-injection)

[Back to the complete vulnerability catalog](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/vulnerabilities.html)
