Skip to main content

Twig EUVDEUVD-2026-133919

| CVE-2026-133770 LOW
Cross-site Scripting (XSS) (CWE-79)
2026-11-24 Symfony
2.1
CVSS 4.0 · Vendor: Symfony
View

Attack ChainAIDerived

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

  1. Access
    Author malicious sandboxed template
  2. Exploit
    Reach shared application Markup object
  3. Execution
    Call __construct() to replace its content
  4. Impact
    Injected script renders in trusted non-sandboxed page

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 all of the following, which together sharply limit real-world risk: (1) the Twig sandbox extension must be enabled and the attacker must be able to supply or author a sandboxed template (PR:L); (2) the application must expose an application-owned Twig\Markup object that the sandboxed template can reach (e.g. passed into context or available as a global); and (3) that same Markup object must be reused and rendered elsewhere in a trusted, non-sandboxed context - the advisory specifically cites a global in a long-running worker. Attacking a Markup object used only within the attacker's own sandboxed output yields nothing. Limiting factors: authenticated template-authoring capability is needed (PR:L), the shared-Markup deployment pattern is a non-default architectural precondition (AT:P), and a victim must subsequently view the poisoned trusted page (UI:P). The complete fix is updating to Twig 3.31.1, which blocks __construct() on Markup objects in the sandbox; no other mitigation is stated in the evidence.

Impact

This is a genuinely low-priority issue, and the signals are consistent rather than conflicting. The CVSS 4.0 vector (AV:N/AC:L/AT:P/PR:L/UI:P) and its 2.1 base score agree with the vuln.today 'monitor' decision label: network-reachable but requiring an attacker who can already supply a sandboxed template (PR:L), a specific deployment precondition (AT:P - a Markup object shared between sandboxed and trusted rendering, e.g. a global in a long-running worker), and passive victim interaction (UI:P) before any impact occurs. Impact is limited to integrity (VI:L/SI:L) with no confidentiality or availability effect. No EPSS score, no CISA KEV listing, and no verified working exploit code are present in the input, so there is no evidence of active or at-scale exploitation; the threat is conditional and architecture-dependent rather than broadly automatable. The one caveat worth stating is that the sandbox is Twig's security boundary, and this is a sandbox-escape-style authorization flaw (CWE-863) producing stored XSS (CWE-79), so for the specific deployments that render user-authored sandboxed templates AND reuse application-owned Markup objects elsewhere, the real-world consequence (script injected into trusted, non-sandboxed pages) is more serious than the 2.1 score alone conveys - the low score reflects how narrow the precondition is, not a benign outcome where it applies.

Exploit ScenarioDerived

An application lets semi-trusted users author Twig templates under the sandbox (e.g. email or page snippets) and also exposes an application-owned Markup object - such as a shared banner global - that is rendered on trusted, non-sandboxed pages. A malicious author calls {% do banner.__construct('<script>alert(1)</script>', 'UTF-8') %} to overwrite that object's content, so the injected script is later served to other users on the trusted page. The advisory includes this illustrative payload, but the input lists no verified working exploit code.

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

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

Alert me

AnalysisAIv1 – Nov 24, 2026

The Twig sandbox extension can be abused to rewrite application-owned Twig\Markup objects: a sandboxed template is allowed to call __construct() on any Markup instance it can reach and replace that object's content with attacker-chosen HTML, which is then rendered unescaped in trusted, non-sandboxed pages that reuse the same object. Affected are twig/twig releases before 3.31.1 (fixed in 3.31.1) whenever the sandbox extension is enabled; real-world impact additionally requires an application-owned Markup object reachable from the sandboxed template and a deployment pattern that renders that same object elsewhere, such as a global in a long-running worker. Priority is monitor: the exploit path needs sandboxed template authoring rights, a non-default shared-Markup architecture, and a victim viewing the poisoned trusted page, and no public exploit code was identified at time of analysis.

RemediationAI

Vendor-released patch: Twig 3.31.1 (3.x branch), which stops the sandbox from permitting __construct() on Twig\Markup objects; upgrade to 3.31.1 or later. The fix commit is https://github.com/twigphp/Twig/commit/97b2e40b1165e6a42a197843f96ccb0a55f46f34 and the advisories are https://symfony.com/cve-2026-133770 and https://github.com/twigphp/Twig/security/advisories/GHSA-r34x-hh9h-9q9c. Updating is stated to be the complete fix; the evidence does not provide any alternative mitigation, and patching is the only change that restores the intended sandbox policy for Markup constructors. Because exploitation depends on being able to supply or author a sandboxed template plus a Markup object shared into a trusted rendering path, reducing who can author sandboxed templates and auditing long-running workers for global Markup objects that are rendered in both sandboxed and trusted contexts will shrink the exposure window while the upgrade is rolled out, but neither substitutes for applying 3.31.1. Patch status per vendor advisory: available.

Affected VersionsENISA

twig/twig 0 <3.31.1

Affected Packages

euvd twig_twig fix: 3.31.1

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, and Twig\Markup is the value object used to carry content the application has already declared safe for raw output; it is backed by __toString() and exposes a public constructor plus withContent(). The SandboxExtension delegates authorization to Sandbox\SecurityPolicy::checkMethodAllowed(), which deliberately bypasses the method/property allowlists for Template and Markup instances because Markup is treated as pre-vetted safe content. The original check exempted every Markup method except withContent(), which left the public constructor callable from an attacker-controlled sandboxed template (CWE-863, incorrect authorization / policy bypass), and the resulting content injection is a cross-context script injection issue (CWE-79) when the mutated object is later rendered by trusted code. The upstream fix (commit 97b2e40b1165e6a42a197843f96ccb0a55f46f34) changes the exemption to '__construct' ! $method && 'withcontent' ! $method and adds regression tests covering context values, mixed-case __CONSTRUCT calls, and captured set-blocks, while confirming that other Markup methods such as count and getCharset() remain callable in the sandbox. The vulnerability is therefore a sandbox policy gap in the Twig PHP library itself, not a flaw in the PHP runtime or in the templates: nothing is gained by rewriting the sandboxed template's own output, and the impact materializes only through shared, reused Markup state.

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.1 LOW
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N
vuln.today AI 3.0 LOW

PR:L because the attacker must author a sandboxed template; AC:H for the required shared-Markup deployment condition; S:C and I:L because injected content crosses into trusted non-sandboxed pages (stored XSS), with no confidentiality or availability impact.

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

Primary rating from Vendor (Symfony).

CVSS VectorVendor: Symfony

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

DescriptionCVE.org

The sandbox allows every method of Twig\Markup objects, including their public constructor. A sandboxed template can therefore call __construct() on any Markup object that it reaches, and replace its content:

{% do banner.__construct('<script>alert(1)</script>', 'UTF-8') %}

A template gains nothing by rewriting its own output. The impact is on the Markup objects that come from the application and are also rendered elsewhere, like a global in a long-running worker. Their new content then ends up in trusted pages that aren't sandboxed.

The sandbox no longer allows calling the constructor of Markup objects.

Threat Intelligence Overview

EPSS Score
0.6%
Top 60% exploitable
Prevalence
High
Twig is a very widely deployed PHP templating engine (Symfony, Drupal, etc.)
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.6%
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

11
Low Medium High Critical
KEV: 0
EPSS: +1
CVSS: +10
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