|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +class MetasploitModule < Msf::Auxiliary |
| 7 | + include Msf::Exploit::Remote::Tcp |
| 8 | + include Msf::Auxiliary::Scanner |
| 9 | + include Msf::Auxiliary::Report |
| 10 | + |
| 11 | + def initialize(info = {}) |
| 12 | + super( |
| 13 | + update_info( |
| 14 | + info, |
| 15 | + 'Name' => 'Identify Cisco Smart Install endpoints', |
| 16 | + 'Description' => %q( |
| 17 | + This module attempts to connect to the specified Cisco Smart Install port |
| 18 | + and determines if it speaks the Smart Install Protocol. Exposure of SMI |
| 19 | + to untrusted networks can allow complete compromise of the switch. |
| 20 | + ), |
| 21 | + 'Author' => 'Jon Hart <jon_hart[at]rapid7.com>', |
| 22 | + 'References' => |
| 23 | + [ |
| 24 | + ['URL', 'https://blog.talosintelligence.com/2017/02/cisco-coverage-for-smart-install-client.html'], |
| 25 | + ['URL', 'https://blogs.cisco.com/security/cisco-psirt-mitigating-and-detecting-potential-abuse-of-cisco-smart-install-feature'], |
| 26 | + ['URL', 'https://tools.cisco.com/security/center/content/CiscoSecurityResponse/cisco-sr-20170214-smi'], |
| 27 | + ['URL', 'https://github.com/Cisco-Talos/smi_check'], |
| 28 | + ['URL', 'https://github.com/Sab0tag3d/SIET'] |
| 29 | + |
| 30 | + ], |
| 31 | + 'License' => MSF_LICENSE |
| 32 | + ) |
| 33 | + ) |
| 34 | + |
| 35 | + register_options( |
| 36 | + [ |
| 37 | + Opt::RPORT(4786) |
| 38 | + ] |
| 39 | + ) |
| 40 | + end |
| 41 | + |
| 42 | + # thanks to https://github.com/Cisco-Talos/smi_check/blob/master/smi_check.py#L52-L53 |
| 43 | + SMI_PROBE = "\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x08\x00\x00\x00\x01\x00\x00\x00\x00".freeze |
| 44 | + SMI_RE = /^\x00{3}\x04\x00{7}\x03\x00{3}\x08\x00{3}\x01\x00{4}$/ |
| 45 | + def smi? |
| 46 | + sock.puts(SMI_PROBE) |
| 47 | + response = sock.get_once(-1) |
| 48 | + if response |
| 49 | + if SMI_RE.match?(response) |
| 50 | + print_good("Fingerprinted the Cisco Smart Install protocol") |
| 51 | + return true |
| 52 | + else |
| 53 | + vprint_status("No match for '#{response}'") |
| 54 | + end |
| 55 | + else |
| 56 | + vprint_status("No response") |
| 57 | + end |
| 58 | + end |
| 59 | + |
| 60 | + def run_host(_ip) |
| 61 | + begin |
| 62 | + connect |
| 63 | + return unless smi? |
| 64 | + rescue Rex::AddressInUse, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, \ |
| 65 | + ::Errno::ETIMEDOUT, ::Timeout::Error, ::EOFError => e |
| 66 | + vprint_error("error while connecting and negotiating Cisco Smart Install: #{e}") |
| 67 | + return |
| 68 | + ensure |
| 69 | + disconnect |
| 70 | + end |
| 71 | + |
| 72 | + service = report_service( |
| 73 | + host: rhost, |
| 74 | + port: rport, |
| 75 | + proto: 'tcp', |
| 76 | + name: 'Smart Install' |
| 77 | + ) |
| 78 | + |
| 79 | + report_vuln( |
| 80 | + host: rhost, |
| 81 | + service: service, |
| 82 | + name: name, |
| 83 | + info: "Fingerprinted the Cisco Smart Install Protocol", |
| 84 | + refs: references, |
| 85 | + exploited_at: Time.now.utc |
| 86 | + ) |
| 87 | + end |
| 88 | +end |
0 commit comments