Skip to main content

Twig EUVDEUVD-2026-133920

| CVE-2026-133771 LOW
Cross-site Scripting (XSS) (CWE-79)
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 HTML/JS payload into stored data field
  2. Exploit
    Template renders variable via alias-name collision unescaped
  3. Execution
    Victim loads affected page
  4. Impact
    Script executes in victim browser (session/credential theft)

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires a specific, non-default template-authoring condition, not a runtime attacker setting: the template must contain a macro import alias (e.g. '{% import _self as item %}') whose alias name is ALSO reused as an ordinary variable in a different block or macro (or a template-level import placed after the block using that name), AND that same-named variable's attribute/item/method output (item.body, item['body']) must carry attacker-supplied data. Only then does the buggy rule mark the value safe and print it unescaped. Macro calls through the alias were and remain correctly treated as safe, so they are not a vector. Limiting factors: the vulnerable pattern must already exist in the application's templates (it is uncommon and author-dependent), the attacker must control the rendered value, and a victim must load the page (UI:P/UI:R). Applications without this naming collision are not exploitable regardless of Twig version.

Impact

This is a genuinely low-priority issue, and the available signals agree rather than conflict. The vendor CVSS 4.0 vector (AV:N/AC:L/AT:P/PR:N/UI:P, impacts only on the subsequent system: SC:L/SI:L/SA:N) scores 2.3, reflecting a reflected/stored XSS whose impact lands in a victim's browser, not the Twig host - there is no confidentiality, integrity, or availability impact to the vulnerable system itself (VC:N/VI:N/VA:N). The vuln.today decision label is 'monitor,' consistent with the low score. No EPSS score, no CISA KEV listing, and no confirmed public exploit code were provided, so there is no evidence of active exploitation - treat this as a correctness/hardening fix rather than an emergency. The AT:P ('attack requirements present') metric is the key limiter: exploitation depends on a specific template-authoring pattern (a variable named identically to a macro import alias from another block/macro) that does NOT exist in default usage and is not attacker-controlled, so most Twig deployments are simply not affected. No signals are missing in a way that changes the conclusion; the only caveat is that EPSS is absent, so no independent exploitation-probability estimate is available.

Exploit ScenarioDerived

In an application whose Twig template happens to contain the vulnerable naming collision (e.g. a loop variable named 'item' while '{% import _self as item %}' appears in another block or macro), an attacker submits HTML/JavaScript into a data field that is later rendered through that variable's attribute (item.body). Because the escaper incorrectly marked it safe, the markup is printed raw and executes in the victim's browser when they view the page. No public exploit code was identified; a patch commit and a regression test fixture are the only public artifacts.

Monitor Track and reassess. Why: LOW severity (CVSS 0.1-3.9).
Patch available 0.7% 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 autoescaping logic can print attacker-controlled values without HTML escaping when a template contains a macro import alias whose name is also reused as an ordinary variable in a different block or macro, producing reflected/stored XSS in pages rendered with that template. Only Twig branches before 3.31.0 are affected (the composer package twig/twig, per CPE cpe:2.3:a:twig:twig), and exploitation is conditional on an application already containing that specific alias/variable name collision plus attacker influence over the rendered value; the assessed vector (CVSS 3.1 AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N) reflects that precondition and the need for a victim to load the affected page. No public exploit code and no confirmed active exploitation were identified at time of analysis, and the vendor-supplied fix is a rule removal in the escaper rather than a runtime mitigation escape hatch.

RemediationAI

Vendor-released patch: upgrade twig/twig to 3.31.0 or later for the 3.x branch, as documented in the advisory (https://github.com/twigphp/Twig/security/advisories/GHSA-63v2-9rx5-wjgr) and the Symfony CVE page (https://symfony.com/cve-2026-133771); the fix commit is https://github.com/twigphp/Twig/commit/3a6745a0d88048474457fa2e69968ebd5267dd5a. Because the flaw only fires on a template-authoring condition, the practical interim control is a template audit rather than a configuration switch: locate every {% import ... as x %} and confirm that no ordinary variable, macro argument or loop variable shares that alias name in another block or macro, and move any template-level import above the block that uses the name - renaming the alias or the variable is behaviour-preserving for rendering but requires reviewing every template that imports _self or another template, which is the main cost. Where renaming is impractical, apply an explicit escape filter to the attribute, item or method output of the colliding variable ({{ item.body|e }} and {{ item['body']|e }}) so the value is escaped despite the buggy safe marking; the trade-off is a risk of double-escaping if the same expression is later rendered under a context where the value is legitimately marked safe, so the filter should be scoped to the colliding variable only. Note that the upstream resolution removes the exemption entirely and that macro calls through an alias remain safe, so no change to macro invocation code is needed. No public exploit code was identified, so emergency containment is not indicated; the vuln.today decision label for this CVE is monitor.

Affected VersionsENISA

twig/twig 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 template engine whose autoescaping is implemented by two node visitors: EscaperNodeVisitor decides which expressions need an escaping filter, and SafeAnalysisNodeVisitor propagates 'safe' status through the AST. Before the fix, EscaperNodeVisitor collected the alias name of every ImportNode into a $safeVars list and pushed that list into SafeAnalysisNodeVisitor, which then marked any GetAttrExpression rooted in a ContextVariable with a matching name as safe for 'all' output contexts. That rule dates from before Twig 3.0, when macro calls through an alias required the exemption; since 3.0 macro calls have been handled separately, so the rule's only remaining effect was to whitelist ordinary variables that happened to share a name with an alias imported elsewhere in the template. The flaw is an encoding/escaping correctness problem (CWE-79, with CWE-116 improper encoding/escaping) rather than an injection into the engine itself: the trigger requires the template author to have created the name collision, and the impact materializes only when the aliased-name variable's attribute, item or method output carries attacker-supplied data. The upstream fix (commit 3a6745a0) deletes the ImportNode handling, the $safeVars property and setSafeVars() plumbing, and adds a regression fixture (import_alias_name_reused.test) covering an alias in a block, an alias in a macro with a same-named macro argument, and a template-level import placed after the block that uses the name.

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:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
vuln.today AI 4.7 MEDIUM

Network-delivered XSS requiring a victim to load the page (UI:R) and a specific non-default template collision (AC:H); scope changes to the browser (S:C) with limited C/I impact and no availability impact.

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

Primary rating from Vendor (Symfony).

CVSS VectorVendor: Symfony

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

DescriptionCVE.org

The escaper considered x.attr, x['key'] and x.method() safe whenever {% import ... as x %} appeared anywhere in the template. Macro calls haven't needed this rule since Twig 3.0. It only matched ordinary variables that have the name of an alias imported in another block or macro, and printed them without escaping:

{% block header %}{% import _self as item %}{{ item.hello() }}{% endblock %} {% block content %}{% for item in items %}{{ item.body }}{% endfor %}{% endblock %}

Here, item.body is printed raw. This leads to XSS when the value comes from an attacker. The same happens with an import in a macro and an argument of the same name in another macro. It also happens with a template-level import placed after the block that uses the name.

The rule is removed. Macro calls through an alias are still considered safe.

Threat Intelligence Overview

EPSS Score
0.7%
Top 53% exploitable
Prevalence
High
Twig is a very widely deployed PHP templating engine (Symfony, Drupal, many 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.7%
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

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

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