
Cloud Vulnerability DB
A community-led vulnerabilities database
RSAKey, which every RSA algorithm uses, accepted a modulus n and a public exponent e of any length. Two costs followed from it.
RSAKey::exponentiate(), through brick/math) with n and e as given. The cost grows with the length of e times the square of the length of n, with or without the GMP extension.RSAKey converted the members of the key between base 16 and base 10 with brick/math, in its constructor and again in toPEM(), for every RSA algorithm, RS256/RS384/RS512 included. Without the GMP extension, the cost of these conversions grows roughly with the cube of the length of n in pure PHP, and with its square when only BCMath is available. It is paid before OpenSSL sees the key, so OpenSSL's own limits do not bound it.
The library never takes an RSA key from a token on its own. Applications do, in standard protocols:jwk header and is verified with that key, before any authentication;private_key_jwt, signed request objects), and encryption towards a key registered by a client.
An application that verifies such tokens, or encrypts to a key chosen by a peer, can be made to spend seconds of CPU per token. In the DPoP case, no authentication is needed. Nothing is disclosed and no token is accepted: the impact is a denial of service. A single gmp_powm() call is not interrupted by max_execution_time.
Measurements, PHP 8.5, brick/math 1.0:jwk header, with n and e of equal length: 0.16 s for a 5 kB token, 0.46 s for 7.7 kB, 0.97 s for 10 kB and 2.8 s for 15 kB, against 0.0002 s for a genuine proof made with an RSA-2048 key. With BCMath and without GMP, a 2.7 kB token costs 2.7 s.n and e: about 1 s.verify() call with a wrong signature and an ordinary exponent:
| Length of n | Neither GMP nor BCMath | BCMath only | GMP |
|---|---|---|---|
| 256 bytes (RSA-2048) | 0.75 s | 0.03 s | 0.01 s |
| 512 bytes | 4.1 s | 0.04 s | 0.01 s |
| 1024 bytes | 29.5 s | 0.11 s | 0.01 s |
| 8192 bytes | not measured | 6.3 s | 0.01 s |
Tokens sent in a header are limited by the header size the front end accepts (8 kB by default with nginx and Apache), and tokens sent in a request body by the body size.Fixed in 3.4.13, 4.0.9, 4.1.11 and 4.2.6. 3.4.13 is the last release of the 3.4 branch.
RSAKey now measures n and e from their bytes, leading zero bytes aside, before converting anything. Like OpenSSL, it refuses:
toPEM() writes the key from the bytes of its members, and the big integers are only built when an operation computed in PHP needs them. RS256, RS384 and RS512 therefore convert nothing: with a 16384-bit key, an RS256 verification takes about 20 ms in pure PHP.
Without GMP, PS256, PS384, PS512, RSA-OAEP, RSA-OAEP-256 and RSA1_5 still compute the RSA operation in PHP in these releases. The limits make that cost finite, but not small:toPEM() returns the same PEM byte for byte. Three behaviours change:InvalidArgumentException. Before, RS256, RS384 and RS512 verification returned false for such a key, because OpenSSL refused it, and PS256, PS384, PS512, RSA-OAEP, RSA-OAEP-256 and RSA1_5 computed with it;JWSVerifier and JWEDecrypter catch it and try the next key, so such tokens are rejected as before;n or e is empty raises an InvalidArgumentException instead of brick/math's NumberFormatException.Upgrade. Install the GMP extension as well if your application verifies PS256, PS384 or PS512 signatures, or encrypts with RSA-OAEP, RSA-OAEP-256 or RSA1_5 to keys chosen by others. Until you upgrade, check every RSA key received from a peer before using it. Refuse a modulus longer than 4096 bits or a public exponent other than 65537, or do not accept PS256, PS384 and PS512 with such keys. Limiting the size of request headers and bodies also limits the size of the keys a token can carry.
OPENSSL_RSA_MAX_MODULUS_BITS (16384), and OPENSSL_RSA_MAX_PUBEXP_BITS (64) above OPENSSL_RSA_SMALL_MODULUS (3072 bits)Reported by Anthropic's OSS Scanner (ANT-2026-9EHC9J38 and ANT-2026-WD2XF3WZ).
Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."