Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit attacker-controlled sandboxed template
-
DeliveryEmbed guard tag with forbidden tags in else-branch
-
ExploitParser registers extends/macro/block from unselected branch
-
ExecutionSandbox tag allow-list bypassed
-
ImpactExtend templates and define macros against policy
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V8 - Authorization Authorization logic validation
MITRE ATT&CK
1 technique across 1 tactic: Privilege Escalation The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Requires a Twig deployment (twig/twig >=3.15.0 and <3.31.0) that has the sandbox extension enabled AND whose sandbox security policy permits the 'guard' tag, while an attacker is able to supply or author the sandboxed template source. The bypass lets the policy-forbidden extends, use, macro and block tags take effect via the guard tag's non-selected branch. Limiting factors: the templates reached via the loader remain sandboxed (no code execution or full sandbox escape), the 'guard' tag must be explicitly allowed by the policy, and the attacker needs template-authoring capability - so a default install that does not expose user-controlled sandboxed templates with guard permitted is not affected. |
| Impact | All decision signals agree this is a low-urgency issue. The vendor CVSS 4.0 base score is 2.3 (Low) with vector AV:N/AC:L/AT:P/PR:L/UI:N and only a Low confidentiality impact (VC:L; VI:N/VA:N), and the vuln.today Decision label is 'monitor'. There is no CISA KEV listing, no EPSS probability supplied, and no public exploit code - only a vendor advisory, a GHSA, and the fix commit are referenced (the patch commit is a fix, not a weapon). The impact is intrinsically bounded: the advisory states that templates reached through the bypass come from the sandbox loader and remain sandboxed, so this is a tag allow-list bypass (CWE-863, incorrect authorization), not a sandbox escape to code execution. The one caveat is scope of exploitation: it requires a deployment that both enables the Twig sandbox AND permits the 'guard' tag in its policy while attackers can author templates - a non-default, specific combination - so real-world exposure is narrower than the network attack vector alone suggests. Net: a genuine but low-severity correctness/authorization bug, appropriate to patch on a normal cadence rather than an emergency. |
| Exploit ScenarioDerived | In an application that runs attacker- or user-supplied Twig templates under the sandbox with the 'guard' tag allowed, an attacker writes a guard whose non-compiled else-branch contains forbidden tags, e.g. {% guard filter upper %}{% else %}{% extends "parent.html" %}{% endguard %}. Because only one branch is compiled but both are parsed, the extends/use/macro/block effects of the unselected branch are registered on the template, bypassing the policy's tag allow-list even though extends is disallowed. No public exploit tool exists; the advisory provides a minimal trigger, and the network-reachable, low-complexity nature is offset by the need for template-authoring privileges and a permissive sandbox policy. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Nov 24, 2026
Twig's sandbox allow-list can be bypassed in versions 3.15.0 through 3.30.x, letting a template author activate the otherwise-forbidden extends, use, macro and block tags by placing them in the non-selected branch of a guard tag. The attacker must be able to author or supply the sandboxed template and the sandbox policy must explicitly permit guard, and the templates reached through the loader remain sandboxed, so this is a policy-enforcement bypass rather than a full sandbox escape or code execution path. Vendor-released patch: 3.31.0; no public exploit identified at time of analysis.
RemediationAI
Upgrade twig/twig to 3.31.0 or later, which contains the parser fix from commit d5011f4654042f03d8986b5b3ba12a4d85f976f8 for the 3.x branch (advisory: https://github.com/twigphp/Twig/security/advisories/GHSA-qr49-4294-4gmw, vendor notice: https://symfony.com/cve-2026-133772). If upgrading immediately is not possible, remove 'guard' from the sandbox SecurityPolicy's allowed tags so the bypass path cannot be reached - with the side effect that legitimate templates relying on guard will fail to compile - or stop accepting attacker-controlled sandboxed template source entirely; note that filtering specific tag names inside template text is not a reliable substitute for the patch, since the flaw is about parser-registered state rather than rendered output.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in 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 PHP templating engine whose SandboxExtension enforces a SecurityPolicy listing which tags, filters, functions and attributes templates may use. CWE-863 (Incorrect Authorization) applies here: the guard tag chooses one branch at compile time depending on whether a named callable exists, but both branches were still parsed by the Parser, and the discarded branch's extends, use, macro and block tags mutated parser state (parent, blocks, documentationTargets, macros, importedSymbols, traits, embeddedTemplates). Because only the selected branch is compiled, the sandbox's policy check never observes those tags, so their registration effects survived even though their code paths did not. The upstream fix adds a parser state save/restore around the discarded subparse and routes the branch through subparseIgnoreUnknownTwigCallables, so anything registered by the non-selected branch is discarded; new fixtures verify that a discarded block, macro and parent no longer take effect.
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:P/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
Attacker must have rights to author a sandboxed template (PR:L) with guard allowed; impact is a limited authorization bypass (reached templates stay sandboxed), so C:L/I:L/A:N and scope unchanged.
Primary rating from Vendor (Symfony).
CVSS VectorVendor: Symfony
DescriptionCVE.org
The guard tag compiles only one of its branches, depending on whether a callable exists. The other branch was still parsed, though. The extends, use, macro and block tags in it registered their effects on the template. The sandbox doesn't see these tags, since that branch isn't compiled. A sandboxed template allowed to use guard could therefore extend a template, import blocks and define macros, while the policy doesn't allow these tags:
{% guard filter upper %}{% else %}{% extends "parent.html" %}{% endguard %}
The templates reached this way come from the loader of the sandbox, and they are sandboxed too.
What the branch that isn't selected registers on the parser is now discarded.
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
Authentication bypass attacks exploit flaws in the verification mechanisms that control access to systems and applications.
Twig before 2.4.4 allows Server-Side Template Injection (SSTI) via the search search_key parameter. Rated critical sever
Sandbox bypass in Twig template engine versions 2.16.x and 3.9.0 through 3.25.x allows attackers with template rendering
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
Sandboxed Twig templates that are permitted to use the `join` filter can disclose the private and protected properties o
Twig's security sandbox allow-list can be bypassed by a sandboxed template that uses the `embed` tag with a parent expre
Sandbox policy bypass in Twig 3.23.0 through 3.31.0 lets whoever supplies the template source force the engine to invoke
A sandbox policy bypass in the Twig template engine (versions 3.21.0 through 3.30.x, fixed in 3.31.1) lets a template au
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-133921
NVD
CVE.org
EPSS
GitHub
VulDB
Exploit-DB