Skip to content

Merge release 4.2.8 into 4.3.x - #829

Open
github-actions[bot] wants to merge 7 commits into
4.3.xfrom
4.2.x-merge-up-into-4.3.x_vhhS1u9y
Open

github-actions[bot] wants to merge 7 commits into
4.3.xfrom
4.2.x-merge-up-into-4.3.x_vhhS1u9y

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Release Notes for 4.2.8

4.2.x bugfix release (patch)

4.2.8

  • Total issues resolved: 0
  • Total pull requests resolved: 2
  • Total contributors: 1

bug

lav45 and others added 7 commits November 10, 2026 17:17
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants