Craft CMS: Authenticated leak of secret environment variables (CVE-2026-72782)
Craft CMS versions 4.0.0-RC1 through before 4.18.2 and 5.0.0-RC1 through before 5.10.6 contain a vulnerability where authenticated users with control panel access can leak secret environment variables. This occurs because environment variables are interpolated into Twig templates even when the Twig sandbox is enabled, allowing secrets to be extracted via blind error-based techniques. The vulnerability enables attackers to incrementally exfiltrate sensitive secrets such as the CRAFT_SECURITY_KEY, database credentials, and API keys, potentially leading to session forgery and privilege escalation.
AI Analysis
Technical Summary
In affected Craft CMS versions, environment variables and secrets are replaced in Twig templates during rendering, even when the Twig sandbox is enabled. The sandbox was intended to prevent remote code execution and unauthorized access to environment variables. However, the interpolation of environment variables via the elementId request parameter allows an authenticated attacker to leak secrets by rendering malicious sandboxed Twig templates. Although direct output of the secrets is not reflected in responses, attackers can use blind error-based methods to exfiltrate secrets over multiple requests. This flaw undermines the protection provided by the Twig sandbox and exposes critical environment secrets to authenticated control panel users.
Potential Impact
An authenticated attacker with control panel access can steal arbitrary environment variables and secrets, including the CRAFT_SECURITY_KEY, database credentials, SMTP credentials, and API keys. This can lead to session forgery, privilege escalation, and unauthorized access to connected services. The vulnerability affects confidentiality of sensitive data but requires authenticated access with elevated privileges.
Mitigation Recommendations
A patch is available for this vulnerability. Users should upgrade to Craft CMS versions 4.18.2 or later and 5.10.6 or later where this issue is fixed. Applying the official patch eliminates the environment variable interpolation flaw and restores the intended security of the Twig sandbox. No additional mitigations are required if the patch is applied.
Craft CMS: Authenticated leak of secret environment variables (CVE-2026-72782)
Description
Craft CMS versions 4.0.0-RC1 through before 4.18.2 and 5.0.0-RC1 through before 5.10.6 contain a vulnerability where authenticated users with control panel access can leak secret environment variables. This occurs because environment variables are interpolated into Twig templates even when the Twig sandbox is enabled, allowing secrets to be extracted via blind error-based techniques. The vulnerability enables attackers to incrementally exfiltrate sensitive secrets such as the CRAFT_SECURITY_KEY, database credentials, and API keys, potentially leading to session forgery and privilege escalation.
CVSS v4.0
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
In affected Craft CMS versions, environment variables and secrets are replaced in Twig templates during rendering, even when the Twig sandbox is enabled. The sandbox was intended to prevent remote code execution and unauthorized access to environment variables. However, the interpolation of environment variables via the elementId request parameter allows an authenticated attacker to leak secrets by rendering malicious sandboxed Twig templates. Although direct output of the secrets is not reflected in responses, attackers can use blind error-based methods to exfiltrate secrets over multiple requests. This flaw undermines the protection provided by the Twig sandbox and exposes critical environment secrets to authenticated control panel users.
Potential Impact
An authenticated attacker with control panel access can steal arbitrary environment variables and secrets, including the CRAFT_SECURITY_KEY, database credentials, SMTP credentials, and API keys. This can lead to session forgery, privilege escalation, and unauthorized access to connected services. The vulnerability affects confidentiality of sensitive data but requires authenticated access with elevated privileges.
Mitigation Recommendations
A patch is available for this vulnerability. Users should upgrade to Craft CMS versions 4.18.2 or later and 5.10.6 or later where this issue is fixed. Applying the official patch eliminates the environment variable interpolation flaw and restores the intended security of the Twig sandbox. No additional mitigations are required if the patch is applied.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-596p-6jv8-775v
- Osv Schema Version
- 1.4.0
- Ecosystems
- ["Packagist"]
- Database Specific Severity
- MODERATE
- Cvss Version
- 4.0
Threat ID: 6a7573b9bf8831d539d940b3
Added to database: 08/07/2026, 05:57:13 UTC
Last enriched: 09/13/2026, 15:02:45 UTC
Last updated: 09/22/2026, 14:37:17 UTC
Views: 49
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.