|
| 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 | + |
| 8 | +class Metasploit3 < Msf::Auxiliary |
| 9 | + |
| 10 | + include Msf::Auxiliary::Report |
| 11 | + include Msf::Auxiliary::Scanner |
| 12 | + include Msf::Exploit::Remote::TNS |
| 13 | + |
| 14 | + def initialize(info = {}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => 'Oracle TNS Listener Checker', |
| 17 | + 'Description' => %q{ |
| 18 | + This module checks the server for vulnerabilities like TNS Poison. |
| 19 | + Module sends a server a packet with command to register new TNS Listener and checks |
| 20 | + for a response indicating an error. If the registration is errored, the target is not |
| 21 | + vulnearble. Otherwise, the target is vulnerable to malicious registrations. |
| 22 | + }, |
| 23 | + 'Author' => ['ir0njaw (Nikita Kelesis) <nikita.elkey[at]gmail.com>'], # of Digital Security [http://dsec.ru] |
| 24 | + 'References' => |
| 25 | + [ |
| 26 | + [ 'URL', 'http://seclists.org/fulldisclosure/2012/Apr/204' ], |
| 27 | + ], |
| 28 | + 'DisclosureDate' => 'Apr 18 2012', |
| 29 | + 'License' => MSF_LICENSE)) |
| 30 | + |
| 31 | + register_options( |
| 32 | + [ |
| 33 | + Opt::RPORT(1521) |
| 34 | + ], self.class) |
| 35 | + |
| 36 | + deregister_options('RHOST') # Provided by the TNS mixin, but not needed in a scanner module |
| 37 | + end |
| 38 | + |
| 39 | + def run_host(ip) |
| 40 | + begin |
| 41 | + connect |
| 42 | + send_packet = tns_packet("(CONNECT_DATA=(COMMAND=service_register_NSGR))") |
| 43 | + sock.put(send_packet) |
| 44 | + packet = sock.read(100) |
| 45 | + find_packet = packet.include? "(ERROR_STACK=(ERROR=" |
| 46 | + find_packet == true ? print_error("#{ip}:#{rport} is not vulnerable ") : print_good("#{ip}:#{rport} is vulnerable") |
| 47 | + #TODO: Module should report_vuln if this finding is solid. |
| 48 | + rescue ::Rex::ConnectionError, ::Errno::EPIPE |
| 49 | + print_error("#{ip}:#{rport} unable to connect to the server") |
| 50 | + end |
| 51 | + end |
| 52 | +end |
0 commit comments