Skip to main content

Twig EUVDEUVD-2026-133914

| CVE-2026-133765 MEDIUM
Protection Mechanism Failure (CWE-693)
2026-11-24 Symfony
5.3
CVSS 4.0 · Vendor: Symfony
View

Attack ChainAIDerived

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

  1. Access
    Gain template-authoring access in sandbox
  2. Delivery
    Submit assignment/destructuring expression
  3. Exploit
    Sandbox skips value policy check
  4. Execution
    Denied __toString() invoked on object
  5. Impact
    Disclose restricted string output

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 that the target application runs Twig in sandbox mode AND permits a (semi-trusted) attacker to supply or author the template source that is rendered under that sandbox - this is the operative PR:L privilege. The attacker needs no allowed tag; they use assignment expressions (x = obj) or destructuring forms ([a] = list, {a} = obj) that evaluate to the assigned value, which is then coerced to a string, triggering a denied __toString(). LIMITING FACTORS: applications that do not use the Twig sandbox, or that never render untrusted template content, are not exposed; impact is confined to disclosing the string output of an object whose __toString() the policy intended to deny (LOW confidentiality, no integrity or availability impact); affects only Twig 3.23.0 through 3.31.0, so deployments on <3.23.0 or >=3.31.1 are unaffected.

Impact

This is a medium-severity sandbox protection-mechanism failure (CWE-693/CWE-863) in Twig, not a high-impact priority. The vendor CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:N/VA:N) scores 5.3 and is internally consistent: network-reachable, low complexity, requiring some privilege (PR:L), with only LOW confidentiality impact and no integrity or availability impact. There is no CISA KEV listing and no EPSS score in the provided data, so there is no evidence of active exploitation or a modeled exploitation probability - status is 'no public exploit identified at time of analysis', though the GHSA advisory does include illustrative bypass payloads (not flagged as working exploit code). The vuln.today priority is 'this_month', which aligns with act-when-convenient rather than act_now/emergency. The real-world risk is narrow: it only matters where Twig's sandbox mode is used as a security boundary against untrusted template authors, and the effect is limited to invoking a __toString() the policy intended to deny - an information-disclosure-class bypass, not code execution. PR:L reflects that the attacker must be able to supply template content. Net: a legitimate security regression to patch on a normal cadence, not a widespread emergency.

Exploit ScenarioDerived

An application lets semi-trusted users author Twig templates that are rendered in sandbox mode, relying on the sandbox to block calls to denied __toString() methods. The attacker submits a template using an assignment or destructuring expression such as {{ (x = obj) }} or {{ ({secret: s} = obj)|join }}, which evaluates to the assigned value and is then converted to a string, invoking the forbidden __toString() and leaking its output. No tag needs to be allowed; no public weaponized exploit is identified, but the advisory documents the exact trigger payloads.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.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

Sandbox policy bypass in Twig 3.23.0 through 3.31.0 lets whoever supplies the template source force the engine to invoke a __toString() method that the sandbox policy explicitly denies, exposing that object's string representation in the rendered output. The regression arrived with Twig 3.23.0's change making assignment (x = obj) and destructuring ([a] = list, {a} = obj) expressions evaluate to the value they assign; SandboxNodeVisitor wrapped filter and function results but not these new expression results, so constructs such as {{ (x = obj) }} or {{ ({secret: s} = obj)|join }} reach __toString() with no tag allowed at all. Exposure is confined to applications that render attacker-influenced template content under the Twig sandbox - the independent assessment rates it medium (CVSS 3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N, low confidentiality only), no public exploit code was identified at time of analysis, and the vendor patch ships in 3.31.1.

RemediationAI

Vendor-released patch: upgrade composer/twig/twig to 3.31.1 or later (the fix commit 6bcdbc3d4470dde23e3e2636e7053e0512387edd adds SetBinary, SequenceDestructuringSetBinary and ObjectDestructuringSetBinary to the node types wrapped by SandboxNodeVisitor::wrapNode() alongside filters and functions). Advisory details are at https://symfony.com/cve-2026-133765 and https://github.com/twigphp/Twig/security/advisories/GHSA-ccrc-gqhf-3cxc; if the dependency is transitive, pin it via your root composer.json until your framework release catches up. Where upgrading is not immediately possible, the effective compensating control is to stop rendering templates whose source can be influenced by semi-trusted users under the sandbox - restrict template authoring to trusted operators, or serve pre-compiled, reviewed templates instead of user-supplied source - with the trade-off that any legitimate user-authored template feature is lost; note that disabling only specific tags does not help here, since the advisory states no tag needs to be allowed for the bypass. Do not rely on using {% do x = obj %} or {% if (x = obj) %} as a workaround in user templates: those forms still work after the patch precisely because they do not convert the value to string, so they neither blocked the bypass nor indicate a mitigated configuration.

Affected VersionsENISA

twig/twig 3.23.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 the PHP templating engine used by Symfony and a large fraction of the PHP ecosystem. Its sandbox extension (SandboxExtension plus SandboxNodeVisitor) rewrites the parsed AST so that property/method access, filters and functions are gated at runtime by a SecurityPolicy, which includes a check before PHP coerces an object to a string via __toString(). Twig 3.23.0 introduced assignment expressions and sequence/object destructuring that yield the assigned value as an expression result, represented in the AST by SetBinary, SequenceDestructuringSetBinary and ObjectDestructuringSetBinary. The fix diff shows SandboxNodeVisitor::wrapNode() only added sandbox wrapping for FilterExpression and FunctionExpression nodes, so these three new binary nodes escaped the string-coercion check. Any context that coerces the expression to string - direct printing, concatenation, a filter input such as |upper or |join, or inclusion inside an array that is joined - therefore triggered the denied __toString(). The issue is classified CWE-693 (protection mechanism failure) and CWE-863 (incorrect authorization) in the upstream GHSA: the root cause is an incomplete authorization check in the sandbox wrapper, not a memory-safety or injection primitive. Per the advisory, {% do x = obj %} and {% if (x = obj) %} remain permitted after the fix because those contexts do not convert the value to a string. The trigger for the bypass is described in the advisory as the assignment/destructuring expression result reaching a string-coercion context; no other triggering mechanism is stated in the available sources.

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

Attacker must be able to author sandboxed template content (PR:L) over the network with low complexity; impact is limited to disclosing a denied __toString() output, so C:L and I/A:N.

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

Primary rating from Vendor (Symfony).

CVSS VectorVendor: Symfony

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
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 sandbox checks that a template may call toString() on an object before converting it to a string. Since Twig 3.23.0, assignments like x = obj, and the destructuring forms [a] = list and {a} = obj, evaluate to the value that they assign. The sandbox didn't check that value, so a sandboxed template could call a denied toString() method:

{{ (x = obj) }} {{ ({secret: s} = obj)|join }}

No tag needs to be allowed.

The sandbox now checks the result of assignments like the result of filters and functions. {% do x = obj %} and {% if (x = obj) %} still work, since they don't convert the value to a string.

Threat Intelligence Overview

EPSS Score
0.5%
Top 62% exploitable
Prevalence
High
Twig is a widely deployed PHP template engine (Symfony, Drupal ecosystems)
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 MEDIUM
CISA KEV No
Public POC No
EPSS 0.5%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.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

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

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

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

CVE-2026-133771 LOW
2.3 Nov 24

Twig's autoescaping logic can print attacker-controlled values without HTML escaping when a template contains a macro im

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