mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Fix false positives with SSL/TLS implementations that are not OpenSSL
This commit is contained in:
@@ -94,16 +94,17 @@ local function alert_unexpected_message(s)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if record.type ~= "alert" then
|
if record.type ~= "alert" then
|
||||||
return false
|
-- Mark this as VULNERABLE, we expect an alert record
|
||||||
|
return true,true
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, body in ipairs(record.body) do
|
for _, body in ipairs(record.body) do
|
||||||
if body.level == "fatal" and body.description == "unexpected_message" then
|
if body.level == "fatal" and body.description == "unexpected_message" then
|
||||||
return true
|
return true,false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return true,true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function keys(t)
|
local function keys(t)
|
||||||
@@ -219,17 +220,26 @@ local function test_ccs_injection(host, port, version)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Read the alert message.
|
-- Read the alert message
|
||||||
status = alert_unexpected_message(s)
|
status,vulnerable = alert_unexpected_message(s)
|
||||||
|
|
||||||
if status then
|
-- Leave the target not vulnerable in case of an error. This could occur
|
||||||
|
-- when running against a different TLS/SSL implementations (e.g., GnuTLS)
|
||||||
|
if not status then
|
||||||
stdnse.print_debug(
|
stdnse.print_debug(
|
||||||
1, 'Server returned UNEXPECTED_MESSAGE alert, not vulnerable')
|
1, "Couldn't get reply from the server (probably not OpenSSL)")
|
||||||
|
s:close()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if not vulnerable then
|
||||||
|
stdnse.print_debug(
|
||||||
|
1, "Server returned UNEXPECTED_MESSAGE alert, not vulnerable")
|
||||||
s:close()
|
s:close()
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
stdnse.print_debug(
|
stdnse.print_debug(
|
||||||
1, 'Vulnerable - alert is not UNEXPECTED_MESSAGE')
|
1, "Vulnerable - alert is not UNEXPECTED_MESSAGE")
|
||||||
s:close()
|
s:close()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user