Skip to main content
MediumTLSOWASP A02:2021CWE-326

How to fix: Weak ephemeral key exchange parameters

The handshake completed with an ephemeral key below a safe size for its key-exchange type. That is a finite-field Diffie-Hellman group smaller than 2048 bits, or an elliptic curve below 224 bits.

Why it matters

The ephemeral key is what forward secrecy actually rests on: it is the value an attacker must break to recover a recorded session. A finite-field group below 2048 bits is within reach of the precomputation attack demonstrated by Logjam, and because servers overwhelmingly reuse a handful of standard groups, one precomputation breaks every session that used the same group.

Servers reach this state by keeping a dhparam file generated years ago, or by leaving a library default in place. The durable fix is to prefer elliptic-curve key exchange, where a 256-bit curve provides far more security than a 2048-bit finite field at a fraction of the cost, and to remove finite-field DHE suites unless a specific client needs them.

How to fix it

  1. 1Prefer ECDHE with X25519 or P-256, and remove finite-field DHE suites where no client requires them.
  2. 2If DHE must remain, generate a fresh group of at least 2048 bits and point the server at it.
  3. 3Do not reuse a well-known published group: a unique group defeats the precomputation the attack depends on.

Code examples

Generate a strong group and use it

bash
openssl dhparam -out /etc/nginx/dhparam.pem 3072

# nginx.conf
# ssl_dhparam /etc/nginx/dhparam.pem;
# ssl_ecdh_curve X25519:prime256v1;

Check what the server used

bash
openssl s_client -connect example.com:443 </dev/null 2>&1 \
  | grep -i "server temp key"

References

Detected automatically by VulnRadar. The check id is tls-ephemeral-key-weak, stable across every scan so you can filter or diff on it.

See every tls check

Questions

How severe is Weak ephemeral key exchange parameters?
VulnRadar rates this medium severity in the tls category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id tls-ephemeral-key-weak, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Weak ephemeral key exchange parameters map to?
It maps to CWE-326. In the OWASP Top 10 it falls under A02:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for weak ephemeral key exchange parameters

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Weak ephemeral key exchange parameters fix | VulnRadar