Skip to content
Crypto Write-up Advanced

Critical Vulnerability in JSON Web Encryption

Several JOSE libraries implementing JWE with 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 to recover the victim's static private key piece by piece.

auth0.com

Published on auth0.com

In this blog post I assume you are already knowledgeable about elliptic curves and their use in cryptography. If not Nick Sullivan's A (Relatively Easy To Understand) Primer on Elliptic Curve Cryptography or Andrea Corbellini's series Elliptic Curve Cryptography: finite fields and discrete logarithms are great…

The author, on auth0.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 JWE specification and the libraries did not validate that the public key in the JWE Protected Header is a point on the expected elliptic curve.

Impact

An attacker could recover the receiver's static private key, but only if the library or platform does not already check that the result of scalar multiplication is on the curve.

What the attacker needed

Victim uses a vulnerable JOSE library; victim uses ECDH-ES with a static private key; attacker can send crafted JWEs to the victim

The fix

Libraries were updated to validate that the received public key is on the curve, and the author suggested an errata for the JWE standard.

How it was found

  1. Find a curve with small-order factors and a point of small order on it.
  2. Craft malicious JWEs using that point and send them to the victim.
  3. Observe the server's response status to learn the secret key modulo the small order.
  4. Repeat with many small orders and combine the results using 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.

When two parties agree on a secret using elliptic curves, each sends a public point. If the receiver does not check that the point is on the agreed curve, an attacker can send points from a weaker curve with small factors. By repeating this and combining the results, the attacker can work out the victim's private key.

What is Crypto?

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

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.