Junglewise Threat Intelligence

CVE-2026-54736: Phalcon cphalcon timing side-channel in Crypt HMAC verification

CVE-2026-54736 · Severity: high · CVSS 8.2 · Published 2026-07-10

Executive brief

Phalcon's encryption library uses a non-constant-time comparison when verifying the authentication tag (HMAC) that protects encrypted data. An attacker can exploit timing differences in the comparison to forge authentication tags, allowing them to tamper with encrypted messages the application trusts (such as encrypted authentication cookies) without being detected. This breaks the integrity guarantee of the encryption, potentially leading to unauthorized access or privilege escalation.

Technical details

The vulnerability exists in Phalcon\Encryption\Crypt::decrypt() at Zephir source line 246, where the code uses `digest !== hash_hmac(...)` for tag verification. The Zephir compiler lowers this to ZEPHIR_IS_IDENTICAL, which eventually calls a byte-wise memcmp that returns early on the first differing byte—causing verification time to vary based on how many leading bytes of the attacker-supplied tag match the correct value. An attacker can iteratively construct a valid tag by querying the decryption endpoint with modified tags and measuring response times, exploiting this data-dependent timing to recover the tag byte-by-byte (Keyczar/CVE-2009-0654 style attack). Once the tag is forged, the attacker can attach it to a crafted ciphertext; combined with CFB mode malleability, they can inject chosen plaintext into encrypted application state. The fix replaces the non-constant-time comparison with PHP's hash_equals() function, which is already used elsewhere in the framework (CSRF token verification, JWT signature checks) and completes in constant time regardless of where the first differing byte occurs.

Affected products

  • Phalcon cphalcon <= 5.14.0

Timeline

  • 2026-06-16: disclosed: GitHub security advisory GHSA-8jqh-95g6-7jpj published
  • 2026-07-10: advisory: CVE-2026-54736 assigned by NVD
  • 2026-08-28: patched: Patch released in Phalcon 5.14.1

References

Related threats