Junglewise Threat Intelligence

Grav CMS timing attack on nonce verification in CSRF protection

Severity: low · CVSS 3.7 · Published 2026-08-25

Executive brief

Grav CMS, a popular open-source web content management system, uses a function to protect against cross-site request forgery (CSRF) attacks by validating security tokens called nonces. The vulnerability allows attackers to recover valid nonce values through timing attacks by measuring subtle differences in how long the system takes to reject forged requests. This weakens CSRF protection, potentially allowing attackers to forge unauthorized actions on behalf of legitimate users.

Technical details

The vulnerability is a timing side-channel attack (CWE-208) in Grav's Utils::verifyNonce() function, which compares submitted nonces to expected values using PHP's === operator instead of the constant-time hash_equals() function. The === operator short-circuits at the first differing byte, leaking information about how many leading characters match through measurable response time differences. An attacker can measure timing variations across multiple requests to recover valid nonce values byte-by-byte, bypassing CSRF protection. The vulnerability affects Grav CMS versions before 2.0.16; the fix involves replacing the vulnerable comparison with hash_equals() to eliminate timing side-channels. No active exploitation in the wild has been reported.

Affected products

  • Getgrav Grav CMS < 2.0.16

Timeline

  • 2026-08-25: disclosed
  • 2026-08-10: patched: Patch released in version 2.0.16

References

Related threats