Skip to main content

Twig CVE-2026-133764

| EUVDEUVD-2026-133913 LOW
Protection Mechanism Failure (CWE-693)
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 template to sandboxed Twig app
  2. Delivery
    Invoke vulnerable custom test on object
  3. Exploit
    PHP callable coerces object input to string
  4. Execution
    Sandbox __toString policy bypassed
  5. Impact
    Sensitive object string representation disclosed

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 ALL of: (1) the Twig sandbox enabled; (2) the application has registered a custom test whose PHP callable coerces its input to a string - either a parameter typed as string or an explicit (string) cast - such as the example upperish test; (3) that custom test is explicitly allowed within the sandbox policy; and (4) an attacker able to author or inject the template and reference an in-scope object with a sensitive __toString() method. Limiting factors: no built-in Twig test is affected (iterable/sequence/mapping and others skip or now guard the check), so default configurations are not exploitable; PR:L indicates the attacker needs at least the ability to supply sandboxed template content; and impact is confined to disclosure of whatever the object's __toString() returns (VC:L, no integrity or availability impact).

Impact

All signals converge on low real-world priority. The vendor-assigned CVSS 4.0 base score is 2.3 (Low) with vector AV:N/AC:L/AT:P/PR:L/UI:N and only VC:L (minor confidentiality impact, no integrity or availability impact), and the vuln.today decision label is 'monitor' rather than act_now or emergency. No KEV listing exists, so there is no confirmed active exploitation, and no public exploit code is referenced (the only GitHub links are the advisory and the fix commit, not a PoC). EPSS is NOT provided in the input, so probabilistic exploitation likelihood cannot be factored in - this is a data gap worth noting but, given the preconditions, unlikely to change the conclusion. The AT:P (attack requirement present) metric aligns with the description's gating condition: exploitation is only possible when an application registers a custom test whose PHP callable coerces its input to a string and explicitly allows that test inside the sandbox - no built-in test is affected. This is a defense-in-depth sandbox hardening issue (CWE-693 / CWE-863), not a broadly exploitable flaw, so despite Twig's wide deployment it is a genuinely low-risk item for the large majority of installations.

Exploit ScenarioDerived

In an application that lets untrusted users author Twig templates under the sandbox, and that has registered a custom test whose PHP callable coerces its input to a string (e.g. a typed string parameter), an attacker writes {{ obj is upperish }} so PHP invokes __toString() on an in-scope object without the sandbox first checking the method is permitted, disclosing whatever that method returns. No public exploit code is identified at time of analysis, though the fix commit includes regression tests demonstrating the bypass. The network attack vector reflects remote template submission, but exploitation still requires the specific custom-test configuration.

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

The sandbox guard that governs when a template may call __toString() on an object can be bypassed in Twig (twig/twig) before 3.31.1, letting a template author force string conversion of an object the sandbox never authorized, and thereby read whatever that object's __toString() returns. Exposure is narrow: the application must have registered a custom Twig test whose PHP callable coerces its input to a string (a parameter typed string or an explicit (string) cast) and must allow that test inside the sandbox policy; no built-in test is affected, so stock configurations are not exploitable, and the assessed vector (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N) caps impact at limited confidentiality disclosure with a low-privileged actor who can supply sandboxed template content. A vendor patch exists in 3.31.1; no public exploit identified at time of analysis, and the current priority signal is monitor.

RemediationAI

Upgrade twig/twig to 3.31.1 or later, the version listed as fixed in the vendor package metadata; the corresponding patch is commit 978c60be74fc62a0f2c3af11ca5bc3609ae8b69a on the 3.x branch, published with advisory https://github.com/twigphp/Twig/security/advisories/GHSA-rc9g-xwx4-rmfh and the Symfony advisory https://symfony.com/cve-2026-133764. Because the flaw only manifests through custom tests, an interim compensating control is to stop registering custom tests whose callable coerces its input to a string (a string-typed parameter or an explicit (string) cast) in environments where the sandbox is active, or to remove them from the sandbox allow-list - the trade-off is that templates referencing those tests will no longer render as before. Built-in tests are unaffected and the vendor states that built-in tests which never convert their input to a string still skip the check, so no configuration change is needed for them. Updating is the complete fix; avoid relying on the allow-list workaround as a permanent substitute since any later re-registration of a coercing custom test reintroduces the bypass.

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 whose SandboxExtension restricts what compiled templates may do, including which methods - notably __toString() - may be invoked on objects. Enforcement is implemented by SandboxNodeVisitor, which inspects filter and test expressions and wraps their inputs when the underlying PHP callable would implicitly coerce the value to a string. The check existed for filters but not for tests: a TestExpression only declared coercion for the built-in empty test, so a custom test registered via TwigTest with a string-typed parameter (or a callable that casts explicitly) would cause PHP to invoke __toString() on the input object during rendering with no sandbox validation, as in {{ obj is upperish }}. This is a protection-mechanism failure (CWE-693) with an authorization-flavored mapping (CWE-863 in the vendor advisory) rather than a memory-safety defect. The fix generalizes coercion declaration: TestExpression::compile() now assumes node coercion only when the base class is used, custom test node classes must declare their own via getStringCoercedChildNames(), a new NonStringCoercingInputTest node class marks the built-in iterable, sequence and mapping tests as skipping the check, and ConstantTest declares arguments as its coerced child. SandboxNodeVisitor was extended so that both FilterExpression and TestExpression inputs map to the first PHP parameter. The practical consequence of the flaw is disclosure of data reachable through an in-scope object's __toString(); the trigger path is precisely described by the vendor, and the assessed attack complexity is high because it depends on a non-default custom-test registration and an explicit sandbox allow-list entry.

Know when PHP 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 3.1 LOW

AC:H because exploitation depends on a non-default application-registered, sandbox-allowed string-coercing custom test; PR:L as the attacker must supply sandboxed template content; impact limited to minor disclosure (C:L), no I/A.

3.1 AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N
4.0 AV:N/AC:L/AT:P/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
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 sandbox checks that a template may call toString() on an object before converting it to a string. It didn't check the input of tests. The PHP callable of a test may convert this input to a string, for example when its parameter is typed as string. PHP then calls toString() on an object without the sandbox checking it first:

{{ obj is upperish }}

Applications are affected when they register such a test and allow it in the sandbox. No built-in test is affected.

The sandbox now checks the input of tests like the input of filters. The built-in tests that never convert their input to a string still skip the check.

Threat Intelligence Overview

EPSS Score
0.5%
Top 62% exploitable
Prevalence
High
Twig is a widely deployed PHP templating 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 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

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

More in PHP

View all
CVE-2019-11043 CRITICAL POC
9.8 Oct 28

In PHP versions 7.1.x below 7.1.33, 7.2.x below 7.2.24 and 7.3.x below 7.3.11 in certain configurations of FPM setup it

CVE-2012-1823 CRITICAL POC
9.8 May 11

sapi/cgi/cgi_main.c in PHP before 5.3.12 and 5.4.x before 5.4.2, when configured as a CGI script (aka php-cgi), does not

CVE-2016-1555 CRITICAL POC
9.8 Apr 21

(1) boardData102.php, (2) boardData103.php, (3) boardDataJP.php, (4) boardDataNA.php, and (5) boardDataWW.php in Netgear

CVE-2018-11138 CRITICAL POC
9.8 May 31

The '/common/download_agent_installer.php' script in the Quest KACE System Management Appliance 8.0.318 is accessible by

CVE-2024-11680 CRITICAL POC
9.8 Nov 26

ProjectSend versions prior to r1720 are affected by an improper authentication vulnerability. Rated critical severity (C

CVE-2025-49113 CRITICAL POC
9.9 Jun 02

Roundcube Webmail contains a critical PHP object deserialization vulnerability (CVE-2025-49113, CVSS 9.9) that allows au

CVE-2017-9841 CRITICAL POC
9.8 Jun 27

Util/PHP/eval-stdin.php in PHPUnit before 4.8.28 and 5.x before 5.6.3 allows remote attackers to execute arbitrary PHP c

CVE-2025-0108 HIGH POC
8.8 Feb 12

Palo Alto Networks PAN-OS management web interface contains an authentication bypass allowing unauthenticated attackers

CVE-2021-25298 HIGH POC
8.8 Feb 15

Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re

CVE-2021-25296 HIGH POC
8.8 Feb 15

Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re

CVE-2013-4983 CRITICAL POC
10.0 Sep 10

The get_referers function in /opt/ws/bin/sblistpack in Sophos Web Appliance before 3.7.9.1 and 3.8 before 3.8.1.1 allows

CVE-2023-6553 CRITICAL POC
9.8 Dec 15

The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1

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