mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Check for RSA exponent of 1, resulting in F score
This commit is contained in:
@@ -322,7 +322,7 @@ categories = {"discovery", "intrusive"}
|
||||
-- http://seclists.org/nmap-dev/2012/q3/156
|
||||
-- http://seclists.org/nmap-dev/2010/q1/859
|
||||
local CHUNK_SIZE = 64
|
||||
local have_ssl, _ = pcall(require,'openssl')
|
||||
local have_ssl, openssl = pcall(require,'openssl')
|
||||
|
||||
-- Add additional context (protocol) to debug output
|
||||
local function ctx_log(level, protocol, fmt, ...)
|
||||
@@ -715,6 +715,12 @@ local function find_ciphers_group(host, port, protocol, group, scores)
|
||||
scores.warnings["Weak certificate signature: SHA1"] = true
|
||||
end
|
||||
kex_strength = tls.rsa_equiv(kex.pubkey, c.pubkey.bits)
|
||||
if c.pubkey.exponent then
|
||||
if openssl.bignum_bn2dec(c.pubkey.exponent) == "1" then
|
||||
kex_strength = 0
|
||||
scores.warnings["Certificate RSA exponent is 1, score capped at F"] = true
|
||||
end
|
||||
end
|
||||
if c.pubkey.ecdhparams then
|
||||
if c.pubkey.ecdhparams.curve_params.ec_curve_type == "namedcurve" then
|
||||
extra = c.pubkey.ecdhparams.curve_params.curve
|
||||
@@ -747,6 +753,10 @@ local function find_ciphers_group(host, port, protocol, group, scores)
|
||||
extra = string.format("%s %d", kex.type, kex_info.strength)
|
||||
end
|
||||
end
|
||||
if kex_info.rsa and kex_info.rsa.exponent == 1 then
|
||||
kex_strength = 0
|
||||
scores.warnings["Certificate RSA exponent is 1, score capped at F"] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
scores[name] = {
|
||||
|
||||
Reference in New Issue
Block a user