All vulnerabilities

Servers and applications

GHSA-59qm-58v5-gvc5

Twig content sandbox escape: the `array` filter casts the DI container and exfiltrates the full site configuration

Severity
High 7.1
Published
9 Sept 2026
Last changed
9 Sept 2026
Added to UpHeron
3 Nov 2026
Fixed in
2.0.25
Weakness
Information exposure (CWE-200)
Attack
Over the network · Needs a user account · No user action needed
Attacker can
Read data
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
Sources
Project advisories (GitHub)

Description

Grav's Twig content sandbox is the boundary that lets a publisher write Twig inside page content without gaining operator capabilities. Part of that boundary is redacting the configuration tree, so sandboxed content cannot read plugin credentials, SMTP and OAuth secrets, Redis passwords, proxy URLs, or the security.* subtree.

The array cast is on the sandbox allowlist and is registered without the needs_is_sandboxed guard that print_r, vardump, json_encode, yaml_encode and string all carry. Its implementation calls toArray(), or falls back to (array), entirely inside the filter, so the conversion never passes through the sandbox's member gate.

The grav Twig global is the raw dependency-injection container. Casting it with grav|array exposes Pimple's private $values array, which holds every resolved service including the un-redacted Config object. A second array cast on that object returns the whole configuration tree.

From getgrav/grav's security advisory. Shortened; the full text is there.

Workarounds

Upgrade to 2.0.25. There is no configuration-only workaround short of setting security.twig_content.process_enabled: false, which also disables Twig in content site-wide and does not stop modular pages.

Workarounds as given by getgrav/grav's security advisory.

Affected software

SoftwareAffected versions
GravServers and applications · github:getgrav/grav
  • Every version before 2.0.25

About Grav

free software content management system written in PHP

From Wikidata, CC0 1.0.
Monthly downloads (Packagist)
1,748Packagist, 15 Nov 2026
Total downloads (Packagist)
92,444Packagist, 15 Nov 2026
GitHub stars
15,725GitHub, 15 Nov 2026
Forks
1,430GitHub, 15 Nov 2026
Latest release
2.2.29GitHub, 15 Nov 2026
Released
11 Nov 2026GitHub
License
MIT LicenseWikidata
Written in
PHPWikidata
First published on GitHub
2 Aug 2014GitHub

References