Skip to content
Crypto Write-up Advanced

CVE-2022-21449: Psychic Signatures in Java

Java's ECDSA signature verification failed to check that the r and s values were non-zero, so a signature consisting entirely of zeros was accepted as valid for any message and any public key. An attacker could forge ECDSA signatures to bypass authentication mechanisms such as SSL certificates, JWTs, SAML assertions, OIDC tokens, and WebAuthn.

Neil Madden Follow

Published on neilmadden.blog

The long-running BBC sci-fi show Doctor Who has a recurring plot device where the Doctor manages to get out of trouble by showing an identity card which is actually completely blank. Of course, this being Doctor Who, the card is really made out of a special “psychic paper“, which causes the person looking at it to see…

Neil Madden (@neilmaddog), on neilmadden.blog

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 ECDSA verification implementation omitted the required checks that r and s are non-zero and less than the curve order, and also failed to reject the point at infinity.

What the attacker needed

Server running Java 15, 16, 17, or 18 before April 2022 CPU; Application uses ECDSA signatures for security

The fix

The bug was fixed in the April 2022 Critical Patch Update by Oracle; users should update to the latest Java version.

How it was found

  1. Generate an EC key pair.
  2. Create a blank signature consisting of 64 zero bytes.
  3. Initialise the signature verifier with the public key and update it with an arbitrary message.
  4. Call verify with the blank signature, which returns true.

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.

Digital signatures are like tamper-proof seals that prove a message came from the right person. Java's code for checking one type of signature (ECDSA) forgot to reject a completely blank signature made of zeros, so anyone could pretend to be anyone else. This affected many login and encryption systems that rely on these signatures.

What is Crypto?

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

More from Oracle

View all

The newest disclosed reports for this program.

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.