CVE-2026-72701: Grav: Non constant time nonce comparison in Utils::verifyNonce() used for CSRF protection
(updated )
Grav\Common\Utils::verifyNonce(), the core function Grav and its plugins use to validate CSRF nonces, compares the submitted nonce to the expected value with PHP’s === operator instead of hash_equals(). === on strings short circuits at the first differing byte, so the comparison time leaks how many leading bytes of a guess are correct. This is CWE-208, Observable Timing Discrepancy.
The codebase already knows to avoid this pattern. hash_equals() is used for the equivalent purpose in four other places I found: system/src/Grav/Common/Session.php, system/src/Grav/Framework/Cache/Adapter/FileCache.php, system/src/Grav/Common/Scheduler/Scheduler.php (the webhook token check), and system/src/Grav/Common/Scheduler/JobQueue.php. Utils::verifyNonce() is the one place I found that still uses a plain equality check for a secret comparison.
References
- github.com/advisories/GHSA-38p6-h87p-r4cg
- github.com/getgrav/grav/commit/a076b9073abc51c1df924529d65773e44950c5c4
- github.com/getgrav/grav/releases/tag/2.0.16
- github.com/getgrav/grav/security/advisories/GHSA-38p6-h87p-r4cg
- nvd.nist.gov/vuln/detail/CVE-2026-72701
- www.vulncheck.com/advisories/grav-cms-before-timing-attack-via-verifynonce
Code Behaviors & Features
Detect and mitigate CVE-2026-72701 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →