Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit template to sandboxed Twig app
-
DeliveryInvoke vulnerable custom test on object
-
ExploitPHP callable coerces object input to string
-
ExecutionSandbox __toString policy bypassed
-
ImpactSensitive 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 |
| 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 |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
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
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.
Primary rating from Vendor (Symfony).
CVSS VectorVendor: Symfony
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
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
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
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
(1) boardData102.php, (2) boardData103.php, (3) boardDataJP.php, (4) boardDataNA.php, and (5) boardDataWW.php in Netgear
The '/common/download_agent_installer.php' script in the Quest KACE System Management Appliance 8.0.318 is accessible by
ProjectSend versions prior to r1720 are affected by an improper authentication vulnerability. Rated critical severity (C
Roundcube Webmail contains a critical PHP object deserialization vulnerability (CVE-2025-49113, CVSS 9.9) that allows au
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
Palo Alto Networks PAN-OS management web interface contains an authentication bypass allowing unauthenticated attackers
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
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
The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1
EUVD-2026-133913
NVD
CVE.org
EPSS
GitHub
VulDB
Exploit-DB