CVE-2026-72782
JSON

7.1high

Craft CMS 5.0.0-RC1 before 5.10.6 Environment Variable Leak

Severity
7.1high CVSS:4.0 by VulnCheck
Exploit likelihood
0.23% (higher than 14% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
VulnCheck
Also known as
GHSA-596p-6jv8-775v

Description

Craft CMS versions >= 5.0.0-RC1 before 5.10.6 and >= 4.0.0-RC1 before 4.18.2 interpolate environment variables and secrets (via ${ENV_VAR} strings in the elementId parameter) into Twig templates before rendering, even when the Twig sandbox is enabled. An authenticated attacker with control panel access can render a malicious sandboxed Twig template and, using a blind error-based technique across many requests, incrementally leak arbitrary environment variables and secrets. These can be abused to forge sessions (via CRAFT_SECURITY_KEY), escalate privileges, and steal database, SMTP, API, or blob storage credentials. Fixed in 5.10.6 and 4.18.2.

Affected

Product or packageVersionsReported by
craftcms cmsfrom 5.0.0-RC1 before 5.10.6, from 4.0.0-RC1 before 4.18.2
Not affected: 5.10.6, 4.18.2
CVE List
craftcms/cms (Packagist)from 5.0.0-RC1 before 5.10.6, from 4.0.0-RC1 before 4.18.2GitHub Advisory Database

All scores

VulnCheck7.1high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
VulnCheck6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N

Classification

CWE-668

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

Craft CMS versions >= 5.0.0-RC1 before 5.10.6 and >= 4.0.0-RC1 before 4.18.2 interpolate environment variables and secrets (via ${ENV_VAR} strings in the elementId parameter) into Twig templates before rendering, even when the Twig sandbox is enabled. An authenticated attacker with control panel access can render a malicious sandboxed Twig template and, using a blind error-based technique across many requests, incrementally leak arbitrary environment variables and secrets. These can be abused to forge sessions (via CRAFT_SECURITY_KEY), escalate privileges, and steal database, SMTP, API, or blob storage credentials. Fixed in 5.10.6 and 4.18.2.

GitHub Advisory Database

Environment variables and secrets are interpolated into a Twig template even when the Twig sandbox is enabled, allowing them to be leaked by an authenticated attacker.

The Craft vulnerability CVE-2026-31857 was only patched by applying sandboxed Twig templating. This theoretically protects Craft CMS against RCE attacks, provided the sandbox is enabled and secure, with no known bypasses.

However, the same request parameter elementId, which allows for sandboxed Twig templates to be rendered, also includes functionality that interpolates referenced environment variables. If the parameter includes a string of the form ${ENV_VAR} then the string is replaced with the environment variable or secret from a secrets file with that name.

Afterward, the string is rendered as a Twig template. If the sandbox is disabled, Twig templates can already gain RCE or access environment variables using the getenv function. Sandboxed Twig templates should not have this access, but now do thanks to this additional environment-variable replacement behavior.

The template’s resulting value is not directly reflected in the response. To exfiltrate the value, the sandboxed Twig template cannot use network functions. But it can use a blind error-based approach similar to blind SQL injection. With enough requests, any environment variable or secret can be incrementally leaked. This can be abused to forge a session, escalate privileges with the CRAFT_SECURITY_KEY, and steal credentials for the database, SMTP server, or other connected APIs or blob storage.

Impact

An authenticated attacker, with permission to access the control panel, can render a malicious Twig template and steal arbitrary environment variables and secrets with a large number of requests, even if the Twig sandbox is enabled through enableTwigSandbox().

NVD (es)

Las versiones de Craft CMS mayor o igual que 5.0.0-RC1 anteriores a la 5.10.6 y mayor o igual que 4.0.0-RC1 anteriores a la 4.18.2 interpolan variables de entorno y secretos (a través de cadenas ’${ENV_VAR}’ en el parámetro elementId) en plantillas Twig antes de la renderización, incluso cuando el sandbox de Twig está habilitado. Un atacante autenticado con acceso al panel de control puede renderizar una plantilla Twig maliciosa en un sandbox y, utilizando una técnica basada en errores ciegos a través de muchas solicitudes, filtrar incrementalmente variables de entorno y secretos arbitrarios. Estos pueden ser utilizados indebidamente para falsificar sesiones (a través de CRAFT_SECURITY_KEY), escalar privilegios y robar credenciales de base de datos, SMTP, API o almacenamiento de blobs. Corregido en 5.10.6 y 4.18.2.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-72782 changed 2026-10-08CVE Terms of Use
GitHub Advisory DatabaseGHSA-596p-6jv8-775v changed 2026-09-01CC-BY-4.0
NVDCVE-2026-72782 changed 2026-10-24Public domain