# GHSA-2QPX-PWMQ-R27R: RSA private key recoverable through a timing side channel in RSA-OAEP and RSA1\_5 decryption

- Database: GitHub
- Severity: CVSS 8.2 (High)
- Published: 2026-11-08
- Modified: 2026-11-08

## Affected versions

- web-token/jwt-library (Packagist): fixed in 3.4.13
- web-token/jwt-library (Packagist): from 4.0.0, fixed in 4.0.9
- web-token/jwt-library (Packagist): from 4.1.0, fixed in 4.1.11
- web-token/jwt-library (Packagist): from 4.2.0, fixed in 4.2.6
- web-token/jwt-framework (Packagist): fixed in 3.4.13
- web-token/jwt-framework (Packagist): from 4.0.0, fixed in 4.0.9
- web-token/jwt-framework (Packagist): from 4.1.0, fixed in 4.1.11
- web-token/jwt-framework (Packagist): from 4.2.0, fixed in 4.2.6
- web-token/jwt-core (Packagist): through 3.2.10

## Description

### Impact

`RSAKey::exponentiate()`, the RSA private key operation behind the `RSA-OAEP`, `RSA-OAEP-256` and `RSA1_5` key encryption algorithms, applied the private key directly to the encrypted key of the JWE. The sender of a token chooses that integer.

With a private key that has CRT parameters (`p`, `q`, `dp`, `dq`, `qi`), which is what `JWKFactory::createRSAKey()` produces, the time taken by the CRT recombination depends on whether the plaintext `m` is below or above the prime `q`. The library's big-integer layer (brick/math) skips additions with 0 and multiplications by 1, and below `q` the recombination works on such operands. Rejecting a token therefore takes a few microseconds longer once `m` reaches `q`. By sending tokens whose encrypted key decrypts to chosen values and timing their rejection, an attacker can run a binary search on `q` and factor the modulus.

The attacker needs the recipient's public key, the ability to submit JWEs, and timing measurements precise to a few microseconds over a large number of rejected tokens (about 290,000 for a 2048-bit key in the reporter's experiment). No valid token is needed, and every token sent is rejected. The reporter recovered the private key of a fresh 2048-bit key pair in a few minutes, from a separate process on the same host. Recovery over a network was not demonstrated; jitter raises the number of samples needed. An application that accepts the JSON General serialization lets the sender add up the difference over many recipients in one request.

Recovering the private key exposes every JWE encrypted to that key, past and future. If the same RSA key is also used for signatures, the attacker can sign with it too.

### Affected configurations

Applications that decrypt JWEs from untrusted senders with `RSA-OAEP`, `RSA-OAEP-256` or `RSA1_5`, using an RSA private key that has CRT parameters. Keys without CRT parameters show no measurable step, but their private key operation was not blinded either and is covered by the same fix.

The unblinded private key operation is as old as the library. The measurable step dates from 2.2.0, when the big-integer layer moved to brick/math.

### Patches

Every RSA private key operation is now blinded: the private key is applied to `c · r^e mod n` for a fresh random `r` coprime to `n`, and the result is multiplied by `r^-1 mod n`. The values handled by the exponentiation and the CRT recombination no longer depend on what the sender chose. Public key operations are unchanged. A private key operation costs one more modular exponentiation with the public exponent, one modular inverse and two modular multiplications, roughly 5 to 20 % of its time.

The same release also rejects an input equal to the modulus, which RFC 8017 excludes from the RSA primitives.

3.4.13 is the last release of the 3.x line, which has reached its end of life. Users of 3.x should plan the move to 4.x.

**Compatibility.** Results are unchanged for every valid key. Two edge cases change:

- a private JWK whose `e` does not match its `d` now gives a wrong result, where the previous code ignored `e`; such a key cannot be used with its own public key anyway;
- calling an RSA algorithm class directly with an input equal to the modulus now throws a `RuntimeException`, as larger inputs already did. `JWSVerifier` and `JWEDecrypter` reject such tokens as before.

### Workarounds

Until you upgrade, do not decrypt RSA-encrypted JWEs from untrusted senders, or switch key encryption to `ECDH-ES` (with or without key wrapping). Rate limiting rejected tokens raises the cost of the attack but does not remove it.

If an RSA decryption key was reachable by untrusted senders whose requests were not limited, and your logs show a large volume of rejected JWEs for that key, rotate the key after upgrading.

### References

- RFC 8017, sections 5.1.2 (RSADP) and 5.2.1 (RSASP1)
- D. Brumley and D. Boneh, "Remote Timing Attacks are Practical", USENIX Security 2003
- P. Kocher, "Timing Attacks on Implementations of Diffie-Hellman, RSA, DSS, and Other Systems", CRYPTO 1996 (blinding)

### Credits

Reported by Anthropic's OSS Scanner (ANT-2026-PQVGNF4G).

## References

- https://github.com/web-token/jwt-framework/security/advisories/GHSA-2qpx-pwmq-r27r

Page: https://cve.now/GHSA-2QPX-PWMQ-R27R
