Vulnerability DatabaseGHSA-5pj7-wx9m-cjh6

GHSA-5pj7-wx9m-cjh6: 
PHP vulnerability analysis and mitigation

Impact

ConcatKDF::generate(), the key derivation function behind the ECDH-ES and ECDH-SS key agreement algorithms, computes a single SHA-256 round and truncates it to the requested length. It never returns more than 32 bytes. The Concat KDF that RFC 7518 (section 4.6.2) takes from NIST SP 800-56A concatenates as many rounds as needed to reach the requested key length. In direct key agreement mode ("alg": "ECDH-ES"), the derived key is the content encryption key (CEK). The AES-CBC-HMAC-SHA2 algorithms split it into MAC_KEY followed by ENC_KEY (RFC 7518, section 5.2.2.1). With a 32-byte CEK:

  • A256CBC-HS512 expects 64 bytes. The 32 bytes all become MAC_KEY and ENC_KEY is empty. PHP's OpenSSL extension pads a short key with zero bytes, so the content is encrypted under an all-zero AES-256 key. Anyone who obtains the token can decrypt it, without the recipient's private key.
  • A192CBC-HS384 expects 48 bytes. ENC_KEY is made of 8 secret bytes followed by 16 zero bytes: the content key has 64 bits of strength instead of 192. MAC_KEY stays secret, so integrity is not affected. The loss is the confidentiality of the tokens the library produces. Neither the builder nor the decrypter checked the length of a key obtained by key agreement, and both derived the same short key, so round trips within the library succeeded. Conforming implementations cannot decrypt the tokens produced this way, and the library cannot decrypt the tokens they produce with these two algorithms.

Affected configurations

JWE produced with alg set to ECDH-ES and enc set to A256CBC-HS512 (content readable by anyone) or A192CBC-HS384 (64-bit content key), whatever the curve. This was measured with P-256, P-521 and X25519. The non-registered ECDH-SS algorithm shares the same derivation. Not affected: A128CBC-HS256, A128GCM, A192GCM, A256GCM, and the key wrapping variants ECDH-ES+A128KW, ECDH-ES+A192KW and ECDH-ES+A256KW. They all request 256 bits or less, which a single round covers. The defect has been present since the first release of the library.

Patches

ConcatKDF::generate() now concatenates as many SHA-256 rounds as the requested length needs. JWEBuilder and JWEDecrypter now check the length of a key obtained by key agreement, as they already did for wrapped and encrypted keys. Compatibility. The fix changes the key derived for ECDH-ES with A192CBC-HS384 and A256CBC-HS512:

  • tokens produced with these combinations before the upgrade cannot be decrypted after it, and have to be issued again;
  • a patched party and an unpatched one cannot exchange such tokens, so producers and consumers have to be upgraded together;
  • tokens produced by other conforming implementations can now be decrypted.

Workarounds

Until you upgrade, encrypt with ECDH-ES and A128CBC-HS256 or A128GCM/A192GCM/A256GCM, or use ECDH-ES+A128KW/ECDH-ES+A192KW/ECDH-ES+A256KW. Consider the content of every token already produced with ECDH-ES and A256CBC-HS512 as disclosed, and the content of the tokens produced with ECDH-ES and A192CBC-HS384 as weakly protected.

References

  • RFC 7518, section 4.6.2 (Key Derivation for ECDH Key Agreement), sections 5.2.2.1 and 5.2.5
  • NIST SP 800-56A, section 5.8.1 (Concatenation Key Derivation Function)

Credits

Reported by Jeroen Robben.


Source: NVD

Related PHP vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-5pj7-wx9m-cjh6HIGH8.2
  • PHP logoPHP
  • web-token/jwt-framework
NoYesOct 31, 2026
CVE-2026-96633HIGH8.1
  • PHP logoPHP
  • adminneo-org/adminneo
NoYesOct 30, 2026
GHSA-j265-mg9q-wpv9HIGH7.1
  • PHP logoPHP
  • web-token/jwt-framework
NoYesOct 31, 2026
CVE-2026-96634MEDIUM6.9
  • PHP logoPHP
  • adminneo-org/adminneo
NoYesOct 30, 2026
GHSA-rqmg-p367-f63rMEDIUM4.3
  • PHP logoPHP
  • power-components/turbine
NoYesOct 31, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management