Skip to content
Crypto Write-up Advanced

Critical vulnerability in JSON Web Encryption (JWE) - RFC 7516

Several JWE libraries using ECDH-ES failed to validate that the public key in the JWE header lies on the expected elliptic curve. An attacker could send crafted JWEs and, by observing whether decryption succeeded, recover the victim's static private key piece by piece.

ll Follow

Published on blog.intothesymmetry.com

Here you can find a list of libraries that were vulnerable to this particular attack so far:

ll, on blog.intothesymmetry.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The libraries did not validate that the public key supplied in the JWE header is a point on the expected elliptic curve, allowing an invalid curve attack.

Impact

An attacker could fully recover the receiver's static private key used for ECDH-ES key agreement, though some environments were protected by language-level curve checks or newer Java providers.

What the attacker needed

Victim uses a vulnerable JWE library; attacker can send crafted JWEs; victim's static key is reused

The fix

Libraries were fixed by validating that the received public key lies on the expected curve, and updated versions were released.

How it was found

  1. Find a curve with many small factors and a point of small order on it.
  2. Craft a JWE whose header carries that point as the public key.
  3. Send the JWE to the victim and use the success or failure response as an oracle.
  4. Recover the secret key modulo the small order.
  5. Repeat with many small orders and combine the results with the Chinese Remainder Theorem.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

JWE is a way to encrypt data so only the intended receiver can read it. The receiver's key is a point on a mathematical curve, and the software must check that any key it is given really sits on that curve. These libraries skipped that check, so an attacker could supply points from a weaker curve and learn the receiver's secret key a small piece at a time.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More by ll

View all

6 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.