Command Injection
- Command Injection | OWASP Foundation
- Title Unavailable | Site Unreachable
- Back to Basics: OS Command Injection | Fastly
- Command Injection - Cheatsheet
- Code injection
- https://hackviser.com/tactics/pentesting/web/command-injection
Command injection is a web security vulnerability that allows an attacker to execute arbitrary commands on the host operating system through a vulnerable application
. This occurs when an application passes unsafe user-supplied data to a system shell without sufficient validation or sanitization.
Tools
Command Injection Characters
| Injection Operator | Injection Character | URL-Encoded Character | Executed Command |
|---|---|---|---|
| Semicolon | ; | %3b | Both |
| New Line | \n | %0a | Both |
| Background | & | %26 | Both (second output generally shown first) |
| Pipe | | | %7c | Both (only second output is shown) |
| AND | && | %26%26 | Both (only if first succeeds) |
| OR | || | %7c%7c | Second (only if first fails) |
| Sub-Shell | `` | %60%60 | Both (Linux-only) |
| Sub-Shell | $() | %24%28%29 | Both (Linux-only) |
${IFS}is space${LS_COLORS:10:1}is ;${PATH:0:1}is \
See also,
Payloads
- Payloadbox
- GitHub - omurugur/OS_Command_Payload_List: OS Command Injection Vulnerability Payload List
Path traversal
Examples
127.0.0.1%0a{ls,-la}
127.0.0.1%0Als$%7BIFS%7D-la
$(rev<<<'imaohw')