CVE-2021-29440:
Grav's Twig processing allowing dangerous PHP functions by default
8.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.95228%
CWE
Published
4/16/2021
Updated
1/29/2023
KEV Status
No
Technology
PHP
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
getgrav/grav | composer | <= 1.7.10 | 1.7.11 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from Grav's Twig environment configuration allowing unrestricted PHP
function calls through undefined function resolution. The key function Grav\Common\Twig\Twig::registerUndefinedFunctionCallback
(or its containing initialization method) created a bridge between Twig templates and PHP
functions without security checks. During exploitation, this function would appear in stack traces as the entry point enabling arbitrary PHP
function execution through Twig templates. The SonarSource blog post explicitly shows this unsafe callback registration in Twig.php
, making it the primary vulnerable function.