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/oracle/tnspoison_checker.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Auxiliary::Report7include Msf::Auxiliary::Scanner8include Msf::Exploit::Remote::TNS910def initialize(info = {})11super(update_info(info,12'Name' => 'Oracle TNS Listener Checker',13'Description' => %q{14This module checks the server for vulnerabilities like TNS Poison.15Module sends a server a packet with command to register new TNS Listener and checks16for a response indicating an error. If the registration is errored, the target is not17vulnerable. Otherwise, the target is vulnerable to malicious registrations.18},19'Author' => ['ir0njaw (Nikita Kelesis) <nikita.elkey[at]gmail.com>'], # of Digital Security [http://dsec.ru]20'References' =>21[22[ 'CVE', '2012-1675'],23[ 'URL', 'https://seclists.org/fulldisclosure/2012/Apr/204' ],24],25'DisclosureDate' => '2012-04-18',26'License' => MSF_LICENSE))2728register_options(29[30Opt::RPORT(1521)31])32end3334def run_host(ip)35begin36connect37send_packet = tns_packet("(CONNECT_DATA=(COMMAND=service_register_NSGR))")38sock.put(send_packet)39packet = sock.read(100)40if packet41hex_packet = Rex::Text.to_hex(packet, ':')42split_hex = hex_packet.split(':')43find_packet = /\(ERROR_STACK=\(ERROR=/ === packet44if find_packet == true #TNS Packet returned ERROR45print_error("#{ip}:#{rport} is not vulnerable")46elsif split_hex[5] == '02' #TNS Packet Type: ACCEPT47print_good("#{ip}:#{rport} is vulnerable")48elsif split_hex[5] == '04' #TNS Packet Type: REFUSE49print_error("#{ip}:#{rport} is not vulnerable")50else #All other TNS packet types or non-TNS packet type response cannot guarantee vulnerability51print_error("#{ip}:#{rport} might not be vulnerable")52end53else54print_error("#{ip}:#{rport} is not vulnerable")55end56# TODO: Module should report_vuln if this finding is solid.57rescue ::Rex::ConnectionError, ::Errno::EPIPE58print_error("#{ip}:#{rport} unable to connect to the server")59end60end61end626364