TLS Certificate With an Insufficient Key Length

The service's certificate uses a public key that is too short, such as an RSA key under 2048 bits, which a well-resourced attacker could break to impersonate the service.

SeverityMedium
CVSS 3.14.8 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N Open in the calculator
CVSS 4.06.3 CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-326: Inadequate Encryption Strength
OWASP Top 10A04:2025 Cryptographic Failures
MITRE ATT&CKT1557 Adversary-in-the-Middle, T1040 Network Sniffing
CategoryCryptographic Failures

Description

The certificate presented by the service contains a public key shorter than current minimums: an RSA key of less than 2048 bits, most often 1024 bits and occasionally 512 or 768 bits, or an elliptic curve key on a curve smaller than P-256. NIST has not allowed RSA keys under 2048 bits for new signatures since the end of 2013, and the CA/Browser Forum's Baseline Requirements forbid publicly trusted CAs from issuing them, so the finding is now met mainly on self-signed and internal certificates, appliances that generate a key at first boot, and long-lived certificates that have never been replaced.

The security of an RSA key depends on the difficulty of factoring its modulus. An attacker who factors the key obtains the service's private key, and can then impersonate the service to its clients without any warning and decrypt recorded sessions that used RSA key exchange. The largest RSA modulus publicly factored is 829 bits (RSA-250, in 2020). Keys of 1024 bits have not been publicly factored and are beyond the reach of most attackers, but are considered within reach of well-resourced ones, so the realistic risk is limited to such adversaries and grows over time. Keys of 512 bits can be factored within hours using rented cloud computing, so a modest attacker can break them, which justifies a higher rating.

Some current clients also reject RSA keys under 2048 bits, which can cause connection failures and warnings that users learn to ignore. The key size is shown by testssl.sh, sslscan, openssl x509 -text and vulnerability scanners. Devices often use the same key for several services, which should be checked as well.

Remediation

Generate a new key pair of adequate length, have a new certificate issued for it, and retire the old key:

  • Use an RSA key of at least 2048 bits (3072 bits for keys expected to remain in use for many years) or an ECDSA key on P-256 or P-384, generated on the system that will use it.
# RSA 2048-bit key and certificate signing request openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr # ECDSA P-256 key and certificate signing request openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -keyout server.key -out server.csr
  • For internal certificates from Active Directory Certificate Services, set the minimum key size on the certificate template's Cryptography tab to 2048 or more, so that short keys cannot be requested again.
  • For appliances, regenerate the device certificate with a longer key or install one issued by the organisation's CA; where the firmware cannot support 2048-bit keys, plan its replacement.
  • Revoke the old certificate where a CA issued it, and do not reuse the old key elsewhere.

Confirm the fix by checking the key size in the certificate the service presents.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More TLS and Certificates Findings

Every TLS and Certificates finding