Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAuthenticate to template-editing surface
-
DeliverySubmit Twig template using map/filter/sort/reduce with PHP callable argument
-
ExploitApplication renders template under SourcePolicyInterface sandbox
-
ExecutioncheckArrow runs without correct Source context
-
PersistSandbox bypass allows arbitrary PHP callable execution
-
ImpactAchieve RCE as web server user
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V15 - Secure Coding and Architecture Protection mechanism completeness
|
| Exploitation Conditions | Exploitation requires (1) the target application uses Twig 2.16.x or 3.9.0-3.25.x, (2) the Twig sandbox is enabled through a SourcePolicyInterface implementation rather than the global SandboxExtension mode, and (3) the attacker has template rendering capability - i.e., can submit or modify Twig template source that will be rendered by the application (CVSS PR:L reflects this minimum authenticated/authorized capability). The attack uses the sort, filter, map, or reduce filters and supplies an arbitrary PHP callable as the arrow argument. Limiting factors: applications that do not expose templates to untrusted users, or that enable the sandbox globally (not via source policy), are not exploitable; UI:N means no victim interaction is needed once the malicious template is rendered. |
| Impact | The CVSS 4.0 vector AV:N/AC:L/AT:N/PR:L/UI:N with VC:H/VI:H/VA:H reflects network-reachable, low-complexity exploitation by an attacker who can already submit or render templates (PR:L), yielding full confidentiality/integrity/availability impact on the vulnerable component - consistent with arbitrary PHP code execution under the web server account. EPSS data was not supplied in the input, and there is no CISA KEV entry and no public PoC referenced, so this is currently a high-severity but not confirmed-exploited issue. The realistic risk is concentrated in deployments that (a) accept untrusted templates and (b) rely on SourcePolicyInterface rather than the global sandbox - typical of multi-tenant SaaS, marketing/email-builder platforms, and CMS plugins. For applications that never expose template editing to untrusted users, the practical risk is markedly lower than the 8.7 base score implies. |
| Exploit ScenarioDerived | On a SaaS platform that lets tenant users edit email or page templates and enforces the Twig sandbox via a SourcePolicyInterface, an attacker with a normal tenant account submits a template that calls a filter such as {{ items|map(('system')) }} or passes 'shell_exec' / 'system' as the arrow argument to sort/filter/map/reduce. When the template is rendered, the runtime check fails to apply the source policy and the supplied PHP callable executes, yielding arbitrary code execution as the web server user. No public PoC is referenced in the supplied intelligence, but the patch commit ( |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – May 20, 2026
Sandbox bypass in Twig template engine versions 2.16.x and 3.9.0 through 3.25.x allows attackers with template rendering capabilities to execute arbitrary PHP code when the sandbox is enabled via a SourcePolicyInterface rather than globally. The runtime check on sort, filter, map, and reduce filters fails to propagate the current template source, allowing arbitrary PHP callables to be passed and executed. No public exploit identified at time of analysis and the issue is not in CISA KEV, but the RCE/PHP tagging and CVSS 4.0 score of 8.7 indicate high impact for applications offering user-editable templates.
RemediationAI
Vendor-released patch: Twig 3.26.0 - upgrade the twig/twig Composer dependency to 3.26.0 or later (the 2.16.x branch should likewise move to the maintained 3.x line, as no separate 2.x fix tag is referenced in the release notes). Pin via composer require twig/twig:^3.26 and redeploy, then verify with composer show twig/twig. If immediate upgrade is not possible, the most targeted compensating control is to stop relying on SourcePolicyInterface for sandboxing and switch to the global sandbox mode (SandboxExtension enabled unconditionally) until patched - this closes the bypass at the cost of applying sandbox restrictions to all templates, which may break trusted internal templates that use disallowed filters/functions. As a second-line control, restrict or remove the sort, filter, map, and reduce filters from the allow-list of the SecurityPolicy used by the sandbox; this blocks the specific filters abused by the bypass but breaks any legitimate templates that use them. Consult https://github.com/twigphp/Twig/security/advisories/GHSA-2q52-x2ff-qgfr for upstream guidance.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 2 packages in composer, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Twig is a widely used PHP templating engine maintained by the Symfony ecosystem and bundled with frameworks such as Symfony, Drupal, and many CMS/SaaS platforms that permit user-supplied templates. The sandbox feature restricts which tags, filters, functions, and methods templates may invoke; SourcePolicyInterface lets applications toggle the sandbox per template source instead of globally. CWE-693 (Protection Mechanism Failure) is the root cause class: the fix commit ('propagate Source to checkArrow for source-policy sandboxing') shows that the runtime callable check for arrow-function-style filters (sort, filter, map, reduce) was evaluating against the wrong/missing template source context, so source-policy-enforced sandboxing was effectively skipped for those filters and arbitrary PHP callables passed in as arguments were honored.
Know when Twig gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Primary rating from Vendor (vulncheck) · only source for this CVE.
CVSS VectorVendor: vulncheck
Lifecycle Timeline
1DescriptionCVE.org
Twig versions 2.16.x and 3.9.0 through 3.25.x contain a sandbox bypass vulnerability when using a SourcePolicyInterface that allows attackers with template rendering capabilities to pass arbitrary PHP callables to sort, filter, map, and reduce filters. Attackers can exploit the runtime check that fails to use the current template source to bypass sandbox restrictions and execute arbitrary code when the sandbox is enabled through a source policy rather than globally.
Executive ViewAI
Twig template engine versions 2.16.x and 3.9.0-3.25.x contain a sandbox bypass vulnerability (CVE-2026-24425, CVSS 8.7) enabling arbitrary PHP code execution when applications expose template editing to users, directly impacting content management systems, no-code platforms, and any system offering dynamic template features. Organizations using affected Twig versions risk unauthorized server-side code execution and potential infrastructure compromise through user-controlled template inputs.
No vendor-released patch identified at time of analysis. Interim mitigations: restrict template editing to trusted administrative accounts only, implement code review for all user-submitted templates, disable dynamic template rendering where feasible, and isolate template-processing systems from critical infrastructure.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
Twig before 2.4.4 allows Server-Side Template Injection (SSTI) via the search search_key parameter. Rated critical sever
Twig is a template language for PHP. Rated high severity (CVSS 8.6), this vulnerability is remotely exploitable, no auth
Twig is a template language for PHP. Rated high severity (CVSS 7.5), this vulnerability is remotely exploitable, no auth
The displayBlock function Template.php in Sensio Labs Twig before 1.20.0, when Sandbox mode is enabled, allows remote at
Denial-of-service via resource exhaustion affects the Twig templating engine for PHP prior to 3.26.0, where the sandbox
Symfony is a PHP framework for web and console applications and a set of reusable PHP components. Rated medium severity
A sandbox information disclosure exists in Twig before 1.38.0 and 2.x before 2.7.0 because, under some circumstances, it
EUVD-2026-31113
GHSA-2q52-x2ff-qgfr
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB