diff --git a/CHANGELOG b/CHANGELOG
index f4819901a..a1813ee83 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,8 @@
# Nmap Changelog ($Id$); -*-text-*-
+o [NSE] ssl-enum-ciphers will give a failing score to any server with an RSA
+ certificate whose public key uses an exponent of 1. [Daniel Miller]
+
o Update oldest supported Windows version to Vista (Windows 6.0). This enables
the use of the poll Nsock engine. [Daniel Miller]
diff --git a/nselib/nmap.luadoc b/nselib/nmap.luadoc
index 25560947c..c6d8b009f 100644
--- a/nselib/nmap.luadoc
+++ b/nselib/nmap.luadoc
@@ -734,7 +734,7 @@ function pcap_close()
--
-- If the pubkey is type "rsa", it will also have an
-- exponent member, containing the public exponent as a bignum. If
--- the type is "ec", it will have an ecdhparams
+-- the type is "ec", it will have an ecdhparams.curve_params
-- member, containing a table with ec_curve_type and
-- curve keys as strings.
--
diff --git a/scripts/ssl-enum-ciphers.nse b/scripts/ssl-enum-ciphers.nse
index e150ee3ca..a3de35ec6 100644
--- a/scripts/ssl-enum-ciphers.nse
+++ b/scripts/ssl-enum-ciphers.nse
@@ -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] = {