Skip to content

Commit ee1209b

Browse files
committed
This should work
1 parent 8cf5c3b commit ee1209b

File tree

3 files changed

+90
-3
lines changed

3 files changed

+90
-3
lines changed

lib/msf/core/exploit/http/server.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,8 @@ def heaplib(custom_js = '', opts = {})
722722
#
723723
# Returns the heaplib2 javascript
724724
#
725-
def heaplib2
726-
@cache_heaplib2 ||= Rex::Exploitation::Js::Memory.heaplib2
725+
def js_heaplib2(custom_js = '', opts = {})
726+
@cache_heaplib2 ||= Rex::Exploitation::Js::Memory.heaplib2(custom_js, opts={})
727727
end
728728

729729
def js_base64

lib/rex/exploitation/js/memory.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@ def self.mstime_malloc
2424
}).obfuscate
2525
end
2626

27-
def self.heaplib2
27+
def self.heaplib2(custom_js='', opts={})
2828
js = ::File.read(::File.join(Msf::Config.data_directory, "js", "memory", "heaplib2.js"))
2929

30+
unless custom_js.blank?
31+
js << custom_js
32+
end
33+
3034
js = ::Rex::Exploitation::JSObfu.new js
3135
js.obfuscate
36+
return js
3237
end
3338

3439
def self.property_spray
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
##
2+
# This module requires Metasploit: http//metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Auxiliary
9+
Rank = NormalRanking
10+
11+
include Msf::Exploit::Remote::HttpServer::HTML
12+
13+
def initialize(info={})
14+
super(update_info(info,
15+
'Name' => "heaplib2 test",
16+
'Description' => %q{
17+
This tests heaplib2
18+
},
19+
'License' => MSF_LICENSE,
20+
'Author' => [ 'sinn3r' ],
21+
'References' =>
22+
[
23+
[ 'URL', 'http://metasploit.com' ]
24+
],
25+
'Platform' => 'win',
26+
'Targets' =>
27+
[
28+
[ 'Automatic', {} ]
29+
],
30+
'Privileged' => false,
31+
'DisclosureDate' => "Mar 1 2014",
32+
'DefaultTarget' => 0))
33+
end
34+
35+
36+
def on_request_uri(cli, request)
37+
spray = %Q|
38+
function log(msg) {
39+
console.log("[*] " + msg);
40+
Math.atan2(0x0101, msg);
41+
}
42+
43+
log("Creating element div");
44+
var element = document.createElement("div");
45+
46+
log("heapLib2");
47+
var heaplib = new heapLib2.ie(element, 0x80000);
48+
49+
log("Creating spray");
50+
var spray = unescape("%u4141%u4141");
51+
while (spray.length < 0x20000) { spray += spray };
52+
53+
log("spraying...");
54+
for (var i=0; i<0x400; i++) {
55+
heaplib.sprayalloc("userspray"+i, spray);
56+
}
57+
58+
alert("free is about to happen");
59+
60+
log("freeing...");
61+
for (var i=0; i<0x400; i++) {
62+
heaplib.free("userspray"+i);
63+
}
64+
|
65+
66+
html = %Q|
67+
<html>
68+
<script>
69+
#{js_heaplib2(spray)}
70+
</script>
71+
</html>
72+
|
73+
74+
print_status("Sending html")
75+
send_response(cli, html, {'Content-Type'=>'text/html'})
76+
end
77+
78+
def run
79+
exploit
80+
end
81+
82+
end

0 commit comments

Comments
 (0)