Media

Grav: Twig sandbox config exfiltration via grav.offsetGet + dump filter (CVE-2026-44738 bypass)

  • Publicada: 02.09.2026
  • Actualizado: 11.10.2026 10:22

Summary

The Twig content sandbox replaces config with the redacted SandboxConfig facade and strips Config::get/toArray from the method allowlist (GHSA-j274-39qw-32c9), so editor content can't read config secrets via config. That's bypassable: grav is the raw container, offsetget is allow-listed on it, so grav.offsetGet('config') returns the real Config. The allow-listed filters json_encode/print_r/yaml_encode then serialize it at the PHP level, never hitting the sandbox method gate, dumping the whole config tree including every plugins.* secret (SMTP creds, API keys, plugin DB creds). Incomplete fix for GHSA-j274-39qw-32c9. security.salt does not leak (it lives outside config).

Details

The documented path is blocked: config is the SandboxConfig facade (Twig.php:660) and the raw Config/Data method entries are stripped when config_access is false, so {{ config.get(...) }} returns the default and {{ grav.offsetGet('config').get(...) }} raises SecurityNotAllowedMethodError.

The bypass uses two allow-listed primitives the redaction doesn't cover:

  1. grav.offsetGet('config') returns the raw Config. The SandboxConfig facade replaces only the config variable, not grav['config']; offsetget is allow-listed on Grav\Common\Grav in system/config/security.yaml.
  2. json_encode/print_r/yaml_encode serialize the object inside the filter and never call GravSecurityPolicy::checkMethodAllowed (GravSecurityPolicy.php:65), so the stripped methods don't matter.

Bug class: object-dumping filters bypass the sandbox member gate. The same dump reaches page/pages/uri/user via their allow-listed accessors; config is the secret-bearing target.

Reachable below the publisher-Twig opt-in: a _-prefixed slug is modular (Page.php:228), and Page::content() sets $process_twig = $scan_twig_xss || $this->modularTwig() (Page.php:816), so a modular child's body Twig is sandboxed-rendered even with twig_content.process_enabled false (the default), while $scan_twig_xss stays false so the render-time XSS scan (GHSA-2c4f-86xc-cr74) is skipped. Any admin.pages author (or filesystem write to user/pages) exfiltrates config on a stock install. On a regular process.twig page the whole-tree dump trips the XSS scan and is blanked, but a targeted split/slice extraction of one subtree is XSS-clean and survives.

PoC

Sandboxed render, config_access default false. First two lines show the gate holding, third is the bypass:

twig
{{ config.get('plugins.email.mailer.smtp.password', 'DENIED') }}
{# => DENIED #}
{{ grav.offsetGet('config').get('plugins.email.mailer.smtp.password') }}
{# => SecurityNotAllowedMethodError 'get' #}
{{ grav.offsetGet('config')|json_encode }}
{# => {...,"plugins":{"email":{"mailer":{"smtp":{"password":"CANARY..."}}}},...} #}

Stock-install reproduction (no user/config/security.yaml):

yaml
# user/config/plugins/email.yaml  -- decoy secret
mailer: { smtp: { password: CANARY_SMTP_PW_8b3f1 } }
# user/pages/70.parent/default.md
---
title: Parent
content: { items: '@self.modular' }
template: modular
---
twig
{# user/pages/70.parent/_secret/default.md #}
---
title: Secret
template: modular/text
---
{{ grav.offsetGet('config')|json_encode }}
bash
curl -s http://localhost/parent   # body contains CANARY_SMTP_PW_8b3f1

logs/security.log shows no sandbox block and no XSS scan for the route. Verified on Grav 2.0.1 (6f619f0ae), PHP 8.4.22, Twig 3.26.1-DEV.

Impact

A page author (admin.pages, no admin/super) reads the entire config tree: plugin SMTP credentials, API keys, plugin DB credentials. Read-only. Default install; the modular path needs no Twig opt-in.

Fix

system/config/security.yaml: drop offsetget (and __get) from twig_sandbox.allowed_methods for Grav\Common\Grav -- the legit uses are theme/getversion; offsetget is the raw-container reach. Closes the demonstrated path.

Sandbox-wide: make json_encode/print_r/yaml_encode/string refuse non-allow-listed objects when $env->isSandboxed() (mirror the Closure-only guard Twig applies to map/filter/reduce). Closes the class for page/pages/uri/user too.

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de Composer getgrav/grav < 2.0.2 2.0.2

Referencias

Puntuación CVSS 6.5/10
Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Debilidad (CWE)
CWE-200
Plataforma
Composer
Paquete
getgrav/grav
Publicada
02.09.2026
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-mc5q-6hpj-rp7j - CC BY 4.0

Historial de vulnerabilidades: getgrav/grav

Todas las vulnerabilidades publicadas de este paquete (Paquete de Composer), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (99) en el archivo
Entradas en total
99
Primera → última
11.2019 09.2026
Sin corrección
6
Explotada en ataques
0

Distribución por gravedad

  • Crítica 7
  • Alta 47
  • Media 41
  • Baja 4

Divulgaciones por año

  1. 2019: 1
  2. 2020: 1
  3. 2021: 4
  4. 2022: 10
  5. 2023: 5
  6. 2024: 8
  7. 2025: 23
  8. 2026: 47
Gravedad:
  1. Alta · 8.8 CVE-2026-72819 < 2.0.13 2.0.13
  2. Grav: Twig sandbox config exfiltration via grav.offsetGet + dump filter (CVE-2026-44738 bypass) esta entrada
    Media · 6.5 CVE-2026-61450 < 2.0.2 2.0.2
  3. Alta CVE-2026-53653 >= 2.0.0-beta.1, < 2.0.0-rc.8, < 1.7.53 2.0.0-rc.8, 1.7.53
  4. Alta · 8.9 CVE-2026-42611 < 2.0.0-beta.2 2.0.0-beta.2
  5. Alta · 8.5 CVE-2026-42612 < 2.0.0-beta.2 2.0.0-beta.2
  6. Crítica · 9.4 CVE-2026-42613 < 2.0.0-beta.2 2.0.0-beta.2
  7. Crítica · 9.1 CVE-2025-66844 <= 1.7.49.5 sin corrección
  8. Alta CVE-2025-66298 < 1.8.0-beta.27 1.8.0-beta.27
  9. Alta CVE-2025-66294 < 1.8.0-beta.27 1.8.0-beta.27
  10. Alta · 8.5 CVE-2025-66300 < 1.8.0-beta.27 1.8.0-beta.27
  11. Alta · 8.8 CVE-2025-66299 < 1.8.0-beta.27 1.8.0-beta.27
  12. Alta · 8.5 CVE-2024-34082 < 1.7.46 1.7.46
  13. Alta · 8.8 CVE-2024-28119 < 1.7.45 1.7.45
  14. Alta · 8.8 CVE-2024-28118 < 1.7.45 1.7.45
  15. Alta · 8.8 CVE-2024-28117 < 1.7.45 1.7.45
  16. Alta · 8.8 CVE-2024-27921 < 1.7.45 1.7.45
  17. Alta · 8.8 CVE-2024-27923 < 1.7.43 1.7.43
  18. Alta · 7.2 CVE-2023-37897 < 1.7.42.2 1.7.42.2
  19. Alta · 7.2 CVE-2023-34448 < 1.7.42 1.7.42
  20. Alta · 7.2 CVE-2023-34252 < 1.7.42 1.7.42
  21. Crítica · 9.1 CVE-2023-34251 < 1.7.42 1.7.42
  22. Alta · 7.2 CVE-2022-2073 < 1.7.34 1.7.34
  23. Alta · 8.1 CVE-2020-29555 >= 1.7.0-beta.1, <= 1.7.0-rc.17, < 1.6.30 1.6.30
  24. Alta · 8.8 CVE-2020-29553 >= 1.7.0-beta.1, <= 1.7.0-rc.17, < 1.6.30 1.6.30
  25. Alta · 7.1 CVE-2022-0970 < 1.7.31 1.7.31
  26. Alta · 8.8 CVE-2021-3924 <= 1.7.24 sin corrección
  27. Alta · 8.4 CVE-2021-29440 < 1.7.11 1.7.11

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.