CRITICAL
Source
Trivy
ID
CRYPTO-0005

What is checked

Trivy reports a P-256, P-384 or P-521 key whose public point equals k*G for a private key k from 1 to 255, where G is the base point of the curve. The rule applies to both public and private keys, because the public point is enough to see that the private key is small.

A healthy EC private key is a random number from 1 to n - 1, where n is the curve order (SEC 1, Section 3.2.1). Such a number is almost never below 256, and a value that small can be found by trying every candidate. The upper limit of 255 comes from the eMudhra incident, where all eight affected intermediate CA keys used values up to 255.

Impact

Anyone who has the public key can recover the private key in at most 255 attempts. The key then gives no protection. An attacker can sign data on behalf of the owner, and a certificate issued for such a key can be abused to impersonate its subject.

  • Generate a new key pair with a trusted random number generator and replace the affected key.
  • Reissue the affected certificates using the new public key and deploy them wherever the old certificates are used.
  • Revoke the certificates that were issued for the affected key.
  • Treat anything that was signed with the key as untrusted.

Scope and limitations

The rule checks only keys on the P-256, P-384 and P-521 curves. Keys on other curves and keys of other algorithms do not produce a finding.

The rule only detects private keys from 1 to 255. A private key that is weak for another reason, for example a value from a small but larger range, is not reported.

You can suppress selected findings using CRYPTO-0005 and optional file paths in the crypto section of .trivyignore.yaml. Specify the file with --ignorefile .trivyignore.yaml; the keys remain in the inventory.

See the scanner documentation for supported key formats and parsing limitations.

References