Skip to content

Commit 55348d7

Browse files
committed
Merge branch 'land-6993' into upstream-master
2 parents b447f32 + 3fd806b commit 55348d7

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

modules/auxiliary/scanner/oracle/tnspoison_checker.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,23 @@ def run_host(ip)
4242
send_packet = tns_packet("(CONNECT_DATA=(COMMAND=service_register_NSGR))")
4343
sock.put(send_packet)
4444
packet = sock.read(100)
45-
find_packet = /\(ERROR_STACK=\(ERROR=/ === packet
46-
find_packet == true ? print_error("#{ip}:#{rport} is not vulnerable ") : print_good("#{ip}:#{rport} is vulnerable")
45+
if packet != nil
46+
hex_packet = Rex::Text.to_hex(packet, prefix = ':')
47+
split_hex = hex_packet.split(":")
48+
find_packet = /\(ERROR_STACK=\(ERROR=/ === packet
49+
#find_packet == true ? print_error("#{ip}:#{rport} is not vulnerable ") : print_good("#{ip}:#{rport} is vulnerable")
50+
if find_packet == true #TNS Packet returned ERROR
51+
print_error("#{ip}:#{rport} is not vulnerable")
52+
elsif split_hex[5] == "02" #TNS Packet Type: ACCEPT
53+
print_good("#{ip}:#{rport} is vulnerable")
54+
elsif split_hex[5] == "04" #TNS Packet Type: REFUSE
55+
print_error("#{ip}:#{rport} is not vulnerable")
56+
else #All other TNS packet types or non-TNS packet type response cannot guarantee vulnerability
57+
print_error("#{ip}:#{rport} might not be vulnerable")
58+
end
59+
else
60+
print_error("#{ip}:#{rport} is not vulnerable")
61+
end
4762
# TODO: Module should report_vuln if this finding is solid.
4863
rescue ::Rex::ConnectionError, ::Errno::EPIPE
4964
print_error("#{ip}:#{rport} unable to connect to the server")

0 commit comments

Comments
 (0)