# CVE-2026-61842: Grav Twig sandbox config exfiltration via offsetGet and dump filters

Source: https://junglewise.ai/threats/cve-2026-61842-grav-twig-sandbox-config-exfiltration-via-offsetget-and-dump  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-09-02. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2026-61842 · Severity: medium · CVSS 6.5 · Published 2026-09-02

Grav is a flat-file CMS that uses a Twig templating sandbox to prevent page editors from accessing sensitive configuration. A flaw in the sandbox allows any page author to read the entire configuration tree—including SMTP passwords, API keys, and database credentials for plugins—by exploiting two allowed operations: accessing the raw container via `offsetGet` and serializing objects with filters like `json_encode`. This affects default installations without custom security overrides.

Technologies: [getgrav/grav (Packagist)](https://junglewise.ai/threats/technologies/getgrav-grav). Vendors: [Packagist](https://junglewise.ai/threats/vendors/packagist).

## Quick answers

**Is CVE-2026-61842 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-61842 being exploited in the wild.

**How severe is CVE-2026-61842?** Medium severity, with a CVSS score of 6.5, published 2 September 2026.

**Which products and versions are affected?** getgrav/grav (Packagist) < 2.0.2.

**Is there a fix for CVE-2026-61842?** A patch was published on 2026-09-02: Fixed in Grav 2.0.2 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-61842 attacked?** It is attacked over the network, in a web application.

**Am I affected by CVE-2026-61842?** Check whether you run getgrav/grav (Packagist) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

The vulnerability is a sandbox bypass combining two allow-listed primitives. The `SandboxConfig` facade replaces the `config` variable and strips dangerous methods, but `grav.offsetGet('config')` retrieves the raw `Config` object because the sandbox only replaces the variable, not the underlying container. The allow-listed dump filters (`json_encode`, `print_r`, `yaml_encode`) serialize objects at the PHP level without calling the sandbox method gate, so the stripped methods are irrelevant. The exploit is reachable on stock installs through modular page content (pages with `_`-prefixed slugs), which are sandboxed-rendered even with `twig_content.process_enabled` false, bypassing the XSS scan. Minimal privileges required: any `admin.pages` author or filesystem write access to `user/pages`. The leak is read-only and does not include `security.salt`, which lives outside the config tree.

## Affected products

- getgrav grav < 2.0.2

## Identifiers

- CVE-2026-61842
- GHSA-mc5q-6hpj-rp7j

## Timeline

- 2026-09-02: disclosed: GitHub Security Advisory published
- 2026-09-02: patched: Fixed in Grav 2.0.2
- 2026-08-19: kev added: Published to NVD

## References

- [https://api.github.com/users/iliaal](https://api.github.com/users/iliaal)
- [https://github.com/iliaal](https://github.com/iliaal)
- [https://api.github.com/users/iliaal/gists%7B/gist_id%7D](https://api.github.com/users/iliaal/gists%7B/gist_id%7D)
- [https://api.github.com/users/iliaal/repos](https://api.github.com/users/iliaal/repos)
- [https://avatars.githubusercontent.com/u/158724?v=4](https://avatars.githubusercontent.com/u/158724?v=4)
- [https://api.github.com/users/iliaal/events%7B/privacy%7D](https://api.github.com/users/iliaal/events%7B/privacy%7D)

## Related threats

- [Grav cross-site scripting in Twig sandbox asset methods](https://junglewise.ai/threats/cve-2026-86197-grav-cross-site-scripting-in-twig-sandbox-asset-methods)
- [Grav ZipArchiver decompression bomb via missing extraction limits](https://junglewise.ai/threats/cve-2026-61690-grav-ziparchiver-decompression-bomb-via-missing-extraction-limits)
- [Grav incomplete Twig sandbox denylist information disclosure](https://junglewise.ai/threats/grav-incomplete-twig-sandbox-denylist-information-disclosure-e903bd3b)
- [Grav UserInterface offsetGet/offsetExists Twig sandbox bypass](https://junglewise.ai/threats/grav-userinterface-offsetget-offsetexists-twig-sandbox-bypass-f709468e)
- [Grav CMS origin validation bypass in referrer header](https://junglewise.ai/threats/grav-cms-origin-validation-bypass-in-referrer-header-0f775642)
