CVE-2023-34253: Grav Server-side Template Injection (SSTI) via Denylist Bypass Vulnerability
Grav is a file-based Web platform. Prior to version 1.7.42, the denylist introduced in commit 9d6a2d to prevent dangerous functions from being executed via injection of malicious templates was insufficient and could be easily subverted in multiple ways -- (1) using unsafe functions that are not banned, (2) using capitalised callable names, and (3) using fully-qualified names for referencing callables. Consequently, a low privileged attacker with login access to Grav Admin panel and page creation/update permissions is able to inject malicious templates to obtain remote code execution. A patch in version 1.7.42 improves the denylist.
Other sources
Grav is a flat-file content management system. Prior to version 1.7.42, the denylist introduced in commit 9d6a2d to prevent dangerous functions from being executed via injection of malicious templates was insufficient and could be easily subverted in multiple ways -- (1) using unsafe functions that are not banned, (2) using capitalised callable names, and (3) using fully-qualified names for referencing callables. Consequently, a low privileged attacker with login access to Grav Admin panel and page creation/update permissions is able to inject malicious templates to obtain remote code execution. A patch in version 1.7.42 improves the denylist.
— MITRE
Grav Server-side Template Injection (SSTI) via Denylist Bypass Vulnerability
— Packagist
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/getgrav/gravto a version that resolves this vulnerability.Fixed in 1.7.42 - Upgrade
Upgrade
getgrav/gravto a version that resolves this vulnerability.Fixed in 1.7.42 - Configuration
Set twig.undefined_functions and twig.undefined_filters to false in /path/to/webroot/system/config/system.yaml to prevent undefined filters and functions from being treated as PHP functions and executed.
Grav Twig twig.undefined_functions and twig.undefined_filters = false
Event History
Frequently Asked Questions
What is CVE-2023-34253?
CVE-2023-34253 is a vulnerability in Grav, a file-based Web platform, where the denylist introduced in version 1.7.42 can be easily subverted, allowing the execution of dangerous functions via injection of malicious templates.
What is the severity of CVE-2023-34253?
CVE-2023-34253 has a severity level of 7.2, which is categorized as high.
How does CVE-2023-34253 affect Grav?
CVE-2023-34253 affects Grav versions up to and excluding 1.7.42. The denylist feature introduced in prior versions can be bypassed, making it possible to execute dangerous functions through injection of malicious templates.
How can I fix CVE-2023-34253 in Grav?
To fix CVE-2023-34253 in Grav, it is recommended to update to version 1.7.42 or later, which includes the necessary fixes for the vulnerability.
Where can I find more information about CVE-2023-34253?
For more information about CVE-2023-34253, you can refer to the following resources: [GitHub commit](https://github.com/getgrav/grav/commit/71bbed12f950de8335006d7f91112263d8504f1b), [Grav security advisory](https://github.com/getgrav/grav/security/advisories/GHSA-j3v8-v77f-fvgm).