From 6e5e9478f262018f22b24a6948471ee05dca8c03 Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 28 Jun 2018 13:40:29 +0000 Subject: [PATCH] Handle error condition. Closes #1254 --- CHANGELOG | 3 +++ scripts/smb-vuln-ms17-010.nse | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index ee95c3524..e43961e62 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ #Nmap Changelog ($Id$); -*-text-*- +o [NSE][GH#1254] Handle an error condition in smb-vuln-ms17-010 caused by IPS + closing the connection. [Clément Notin] + o [NSE] https-redirect detects HTTP servers that redirect to the same port, but with HTTPS. Some nginx servers do this, which made ssl-* scripts not run properly. [Daniel Miller] diff --git a/scripts/smb-vuln-ms17-010.nse b/scripts/smb-vuln-ms17-010.nse index 26725da7f..e9fb006ae 100644 --- a/scripts/smb-vuln-ms17-010.nse +++ b/scripts/smb-vuln-ms17-010.nse @@ -129,6 +129,12 @@ local function check_ms17010(host, port, sharename) end local result, smb_header, _, _ = smb.smb_read(smbstate) + if not result then + stdnse.debug1("Error reading SMB response: %s", smb_header) + -- error can happen if an (H)IPS resets the connection + return false, smb_header + end + local _ , smb_cmd, err = string.unpack("