From 8cc713e534718ca85cb4805a1f377eac97491fa2 Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 20 Jan 2017 19:06:50 +0000 Subject: [PATCH] Resolved an "attempt to index a nil value (local 'certs')" error in find_ciphers_group that caused false negatives in script output. --- scripts/ssl-enum-ciphers.nse | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/ssl-enum-ciphers.nse b/scripts/ssl-enum-ciphers.nse index 7cecaa4aa..b10e387d7 100644 --- a/scripts/ssl-enum-ciphers.nse +++ b/scripts/ssl-enum-ciphers.nse @@ -673,7 +673,12 @@ local function find_ciphers_group(host, port, protocol, group, scores) -- This may not always be the case, so -- TODO: reorder certificates and validate entire chain -- TODO: certificate validation (date, self-signed, etc) - local c, err = sslcert.parse_ssl_certificate(certs.certificates[1]) + local c, err + if certs == nil then + stdnse.debug1("Failed to retrieve certificate") + else + c, err = sslcert.parse_ssl_certificate(certs.certificates[1]) + end if not c then stdnse.debug1("Failed to parse certificate: %s", err) elseif c.pubkey.type == kex.pubkey then