Skip to main content

Twig EUVDEUVD-2026-133912

| CVE-2026-133763 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 ability to author sandboxed Twig template
  2. Delivery
    Insert {{ obj is true }} test on target object
  3. Exploit
    Test result evaluates to object, unchecked by sandbox
  4. Execution
    String coercion invokes denied __toString()
  5. Impact
    Disclose object string representation

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 application runs Twig with the sandbox enabled AND permits an attacker to supply or author the sandboxed template content; the attacker then uses the is true test (also reachable via concatenation or by passing the result to a filter) to coerce a sandbox-denied object to a string through its __toString() method. No Twig tag needs to be allowed by the sandbox policy. What LIMITS exploitation: the attacker must have template-authoring capability inside the sandbox (PR:L), the affected version range is specifically >=3.21.0 and <3.31.1, and the impact is confined to information disclosure of an object's string representation - it is not code execution. A is true test used only in a boolean context such as {% if obj is true %} does NOT trigger the flaw because no string coercion occurs. Applications that never expose the Twig sandbox to untrusted template authors are not realistically exploitable.

Impact

This is a sandbox-escape information-disclosure flaw in Twig, best treated as a moderate, targeted-context issue rather than a broad emergency. The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:L/UI:N/VC:L, score 5.3) and the GHSA CWE pairing (CWE-693 Protection Mechanism Failure, CWE-863 Incorrect Authorization) agree on the shape: low attack complexity, no user interaction, but PR:L - the attacker must already be able to supply or author template content that runs inside the Twig sandbox, and the only confirmed impact is limited confidentiality (reading an object's string form). There is no KEV listing and no EPSS score in the input, so there is no signal of active or widespread exploitation; the vuln.today decision label is 'this_month', consistent with a real-but-not-critical fix priority. The vendor (Symfony/Twig) advisory publicly demonstrates the trigger template {{ obj is true }} and ships regression tests, so the mechanism is fully documented, but the input does not flag a confirmed standalone working exploit. The main caveat to state explicitly: real-world exposure depends entirely on whether an application exposes the Twig sandbox to untrusted template authors - applications that never let untrusted users write templates are effectively unaffected regardless of the CVSS score.

Exploit ScenarioDerived

An application lets semi-trusted users author Twig templates under the sandbox (e.g. a CMS theme or email-template editor), relying on the sandbox to block disallowed object methods. An attacker who can submit a template writes {{ obj is true }} (or (obj is true) ~ "", or pipes it to a filter) so the is true test returns the object itself and Twig then coerces it to a string via a denied __toString(), leaking data the sandbox policy was meant to withhold. The Twig GHSA advisory publicly demonstrates this exact trigger, though the input does not confirm a packaged working exploit.

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

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 author convert a sandbox-denied object to a string and read its __toString() output. When a sandboxed template evaluates {{ obj is true }} - or the same test result concatenated or passed to a filter - the interpreter coerces the object to a string without the sandbox's method-allowlist check, so only template-authoring capability inside the sandbox is needed and no Twig tag has to be allowed. Impact is limited to information disclosure of an object's string representation; a test used purely in a boolean context such as {% if obj is true %} does not trigger it. No public exploit code was identified at time of analysis, the issue is not in CISA KEV, and the vendor has released a patch.

RemediationAI

Upgrade twig/twig to 3.31.1 for the 3.x branch, which contains the vendor-released patch; the corresponding upstream commit is a41bd2dd466d771cc384b9730be6190eb5a4f4d0 (https://github.com/twigphp/Twig/commit/a41bd2dd466d771cc384b9730be6190eb5a4f4d0) and the advisories are at https://github.com/twigphp/Twig/security/advisories/GHSA-567w-cx2v-jc85 and https://symfony.com/cve-2026-133763. If the upgrade cannot be applied immediately, the exposure is bounded by who can author templates: applications that do not expose the sandbox to untrusted template authors are not realistically exploitable, so the practical interim control is to keep sandboxed template input restricted to trusted authors and review template sources for is true expressions whose result is printed, concatenated into a string, or passed to a filter (boolean-context uses such as {% if obj is true %} are not affected and need no change). Until patched, avoid passing objects with sensitive __toString() output into sandboxed templates authored by lower-trust users.

Affected VersionsENISA

twig/twig 3.21.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's sandbox extension is implemented as a compiler pass (SandboxNodeVisitor) that rewrites the AST so that dynamic method calls, filters and functions are wrapped in runtime security checks before execution; among other things it verifies that a template is permitted to invoke __toString() on an object before that object is coerced to a string for output. The wrapping condition in the visitor covered FilterExpression and FunctionExpression nodes but omitted TestExpression nodes. Twig's true test returns its input unchanged for objects rather than a boolean, so the expression {{ obj is true }} produced the raw object as the print node's operand; the implicit string conversion during rendering therefore happened outside the sandbox check, exposing the result of a __toString() method the policy had denied. The same gap applied when the test result was concatenated ({{ (obj is true) ~ "" }}) or fed into a filter ({{ (obj is true)|upper }}), while a boolean-context use ({% if obj is true %} or a ternary condition) does not coerce and is unaffected. The upstream fix adds TestExpression to the node types that wrapNode() guards, so test results are now checked like filter and function results, and regression tests cover direct output, concatenation, filter input and the unaffected boolean context. The root causes map to CWE-693 (protection mechanism failure) and CWE-863 (incorrect authorization), and the exposed asset is whatever object state appears in an object's string representation.

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 supply sandboxed template content so PR:L; low complexity and no interaction; impact limited to disclosing an object's string form so C:L, I:N, A:N, scope unchanged.

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. For an object, the is true test evaluates to the object itself, and that result wasn't checked. A sandboxed template could therefore print an object through a denied toString() method:

{{ obj is true }}

The same applies when the result is concatenated or passed to a filter. No tag needs to be allowed. A test in a boolean context, like {% if obj is true %}, isn't affected, since it doesn't convert the object to a string.

The sandbox now checks the result of tests like the result of filters and functions.

Threat Intelligence Overview

EPSS Score
0.5%
Top 62% 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 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-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-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