Repository navigation
Merge release 4.2.8 into 4.3.x - #829
Open
github-actions[bot] wants to merge 7 commits into
Open
github-actions[bot] wants to merge 7 commits into
github-actions[bot] wants to merge 7 commits into
Conversation
…r value
RsaAnalyzer counted the modulus as 8 × octets and read the exponent with
unpack('l'), so leading zero octets (RFC 7518 §2 forbids them, Base64urlUInt)
let a key with n = 15 and e = 1 pass with no message. Both values are now read
as big-endian integers with BigInteger.
ESKeyAnalyzer checked the point with Curve::contains(), which reduces modulo p,
so a coordinate >= p passed while OpenSSL refuses the key. Coordinates are now
required to be lower than the field prime.
RsaAnalyzer converted "n" and "e" into big integers. The analyzed keys may come from a third party and nothing bounds their length: without GMP, a modulus of 2048 octets cost 0.57 s with BCMath and 109 s in pure PHP, and 32 KiB cost 155 s with BCMath. The bit length of the modulus is now read from its octets, leading zero octets ignored, as RSAKey does. The exponent is converted only when it fits in three octets: a longer value is at least 2^24. The verdicts are those of the previous commit. The new tests cover the bounds: 2047 and 2048-bit moduli, exponents with leading zero octets or longer than four octets.
ESKeyAnalyzer reported coordinates of the wrong size, then converted them into big integers anyway. Without GMP, coordinates of 1 KiB cost 27.5 s in pure PHP and 8 KiB cost 2 s with BCMath. The analysis now stops after the size message, as it does for empty coordinates, and the curve is created once.
…ding fix(key-mgmt): analyze RSA n and e and EC coordinates by their integer value
RSAKey bounded the public exponent "e" to 64 bits above a modulus of 3072 bits only, as OpenSSL does, and to the length of the modulus below it. A key of 3072 bits whose exponent was as long as its modulus was therefore accepted, and the public operation PS*, RSA-OAEP and RSA1_5 compute in PHP costs as many squarings as "e" has bits: with GMP, a PS256 signature under such a key, which the sender of a DPoP proof chooses, took 30.9 ms to reject, against 0.7 ms with a 64-bit exponent; with BCMath, 1.48 s against 52 ms. The exponent is now refused beyond 64 bits whatever the modulus, and beyond the length of the modulus as before. The dearest key left is one of 16384 bits with a 64-bit exponent: 8.6 ms with GMP, 1.18 s with BCMath, as before this change. A key with a larger exponent is refused although FIPS 186-5 allows exponents below 2^256: generators draw 65537, and Go and BoringSSL already refuse exponents above 2^31 - 1 and 33 bits.
…ports on 4.2.x The phpqa image rebuilt on 2026-11-20 ships PHPStan 2.3.7, which reports a mixed value as the condition of the ternaries of the processHeaders() methods of JSONFlattenedSerializer and JSONGeneralSerializer and of the if of MixedPublicAndPrivateKeys: the Static Analysis job failed on 4.2.x whatever the change. The baseline, generated by castor phpstan-baseline, gains those three entries and nothing else.
fix(core): bound the RSA public exponent to 64 bits whatever the modulus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release Notes for 4.2.8
4.2.x bugfix release (patch)
4.2.8
bug