Skip to main content

Twig CVE-2026-133772

| EUVDEUVD-2026-133921 LOW
Incorrect Authorization (CWE-863)
2026-11-24 Symfony
2.3
CVSS 4.0 · Vendor: Symfony
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit attacker-controlled sandboxed template
  2. Delivery
    Embed guard tag with forbidden tags in else-branch
  3. Exploit
    Parser registers extends/macro/block from unselected branch
  4. Execution
    Sandbox tag allow-list bypassed
  5. Impact
    Extend 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.

Monitor Track and reassess. Why: LOW severity (CVSS 0.1-3.9).
Patch available 0.5% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

twig/twig 3.15.0 <3.31.0

Affected Packages

euvd twig_twig fix: 3.31.0

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

Vendor (Symfony) PRIMARY 2.3 LOW
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
vuln.today AI 5.4 MEDIUM

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.

3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N
4.0 AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (Symfony).

CVSS VectorVendor: Symfony

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
Low
User Interaction
None
Vulnerable system: Confidentiality
Low
Vulnerable system: Integrity
None
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

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

EPSS Score
0.5%
Top 62% exploitable
Prevalence
High
Twig is a widely deployed PHP templating engine used across Symfony and many PHP apps
Data Quality
6 sources
Confidence: High

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.

SignalValue
Severity LOW
CISA KEV No
Public POC No
EPSS 0.5%
Patch available Yes
Active threat No
Deciding rule
LOW severity (CVSS 0.1-3.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
High

Priority Score

13
Low Medium High Critical
KEV: 0
EPSS: +1
CVSS: +12
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Authentication bypass attacks exploit flaws in the verification mechanisms that control access to systems and applications.

More in Twig

View all
CVE-2018-13818 CRITICAL POC
9.8 Jul 10

Twig before 2.4.4 allows Server-Side Template Injection (SSTI) via the search search_key parameter. Rated critical sever

CVE-2026-24425 HIGH
8.7 May 20

Sandbox bypass in Twig template engine versions 2.16.x and 3.9.0 through 3.25.x allows attackers with template rendering

CVE-2024-45411 HIGH
8.6 Sep 09

Twig is a template language for PHP. Rated high severity (CVSS 8.6), this vulnerability is remotely exploitable, no auth

CVE-2022-39261 HIGH
7.5 Sep 28

Twig is a template language for PHP. Rated high severity (CVSS 7.5), this vulnerability is remotely exploitable, no auth

CVE-2015-7809 MEDIUM
6.8 Nov 06

The displayBlock function Template.php in Sensio Labs Twig before 1.20.0, when Sandbox mode is enabled, allows remote at

CVE-2026-46627 HIGH
7.1 Jul 14

Denial-of-service via resource exhaustion affects the Twig templating engine for PHP prior to 3.26.0, where the sandbox

CVE-2023-46734 MEDIUM
6.1 Nov 10

Symfony is a PHP framework for web and console applications and a set of reusable PHP components. Rated medium severity

CVE-2026-133768 MEDIUM
5.3 Nov 24

Sandboxed Twig templates that are permitted to use the `join` filter can disclose the private and protected properties o

CVE-2026-133767 MEDIUM
5.3 Nov 24

Twig's security sandbox allow-list can be bypassed by a sandboxed template that uses the `embed` tag with a parent expre

CVE-2026-133765 MEDIUM
5.3 Nov 24

Sandbox policy bypass in Twig 3.23.0 through 3.31.0 lets whoever supplies the template source force the engine to invoke

CVE-2026-133763 MEDIUM
5.3 Nov 24

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

CVE-2019-9942 LOW
3.7 Mar 23

A sandbox information disclosure exists in Twig before 1.38.0 and 2.x before 2.7.0 because, under some circumstances, it

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy