Twig Sandbox Bypass (CVE-2026-24425) Allows Arbitrary Code Execution
The National Vulnerability Database reports a critical sandbox bypass vulnerability, CVE-2026-24425, affecting Twig versions 2.16.x and 3.9.0 through 3.25.x. This flaw allows attackers with template rendering capabilities to inject arbitrary PHP callables into sort, filter, map, and reduce filters. The root cause is a runtime check failing to properly utilize the current template source, enabling a bypass of sandbox restrictions when the sandbox is enabled via a source policy rather than globally.
This isn’t just a theoretical bypass; it’s a direct path to arbitrary code execution. The high CVSS score of 8.8 reflects the severity: an attacker with low privileges (PR:L) can achieve full confidentiality, integrity, and availability impact (C:H/I:H/A:H) over the affected system. The critical aspect here is the SourcePolicyInterface context – many organizations rely on granular source policies for security, assuming a global sandbox is too restrictive.
Defenders need to understand the attacker’s calculus: if they can gain template rendering access, even with a supposedly sandboxed environment, this vulnerability provides an immediate escalation path. It’s a classic example of how security controls, when not implemented or evaluated rigorously, can create a false sense of security. Patching is non-negotiable for anyone running vulnerable Twig versions.
What This Means For You
- If your organization uses Twig, specifically versions 2.16.x or 3.9.0 through 3.25.x, you are directly exposed to arbitrary code execution. Prioritize patching immediately. Review your Twig sandbox configurations; relying solely on a `SourcePolicyInterface` for sandbox enforcement is insufficient against this threat.
Indicators of Compromise
| ID | Type | Indicator |
|---|---|---|
| CVE-2026-24425 | RCE | Twig versions 2.16.x |
| CVE-2026-24425 | RCE | Twig versions 3.9.0 through 3.25.x |
| CVE-2026-24425 | Sandbox Bypass | SourcePolicyInterface allows arbitrary PHP callables to sort, filter, map, and reduce filters |
| CVE-2026-24425 | Code Injection | Runtime check fails to use current template source to bypass sandbox restrictions |
Source & Attribution
| Source Platform | NVD |
| Channel | National Vulnerability Database |
| Published | May 20, 2026 at 17:16 UTC |
This content was AI-rewritten and enriched by Shimi's Cyber World based on the original source. All intellectual property rights remain with the original author.
Believe this infringes your rights? Submit a takedown request.