Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessControl sandboxed template source
-
DeliveryCall allowed function with spread arg
-
ExploitReach unsafe string parameter past int
-
ExecutionInvoke denied __toString()
-
ImpactDisclose restricted string data
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 application runs Twig's sandbox extension on attacker-influenced template source; (2) the app's security policy explicitly allows a function, filter, or test whose PHP signature has, at a spread argument's starting position, a parameter that cannot hold a string (e.g. int) followed by a later parameter that accepts strings (typed string, untyped, or variadic); (3) the attacker uses spread syntax (...) in the template to map one argument object past the safe-typed parameter into the string-accepting one. Limiting factors that reduce real-world risk: only Twig >=3.28.0 and <3.31.1 are affected; no built-in Twig callable is vulnerable, so a non-default custom allowed callable with this exact mixed signature is mandatory; impact is confined to invoking a denied __toString() (information disclosure), with no code execution, write, or DoS. Apps not using the sandbox, or not allowing such a callable, are not affected. |
| Impact | This is a low-severity, narrowly-scoped sandbox control bypass, not a priority incident. The vendor CVSS 4.0 score is 2.3 (Low), with vector AV:N/AC:L/AT:P/PR:L/UI:N and only low confidentiality impact (VC:L; VI/VA = N) - meaning the worst outcome is invoking a denied __toString() method to leak string data, with no integrity or availability impact. The vuln.today decision label is 'monitor', the weakest urgency tier, which aligns with the low CVSS. No CISA KEV listing and no EPSS score were provided, and no public exploit is identified; the advisory's one-line template snippet ({{ tag(...[1, obj]) }}) is an illustrative trigger, not weaponized exploit code. The PR:L and AT:P metrics correctly reflect that this is not a default-configuration remote compromise: the application must already run Twig's sandbox AND explicitly allow a function/filter/test with a vulnerable mixed-type signature. Signals are consistent (low CVSS + 'monitor' + no KEV/EPSS/POC), so this is genuinely low real-world risk - a defense-in-depth sandbox weakening relevant only to the subset of apps that execute untrusted templates in the Twig sandbox. One note: no EPSS value was supplied, so exploitation probability cannot be quantified beyond the qualitative signals. |
| Exploit ScenarioDerived | An attacker who can author or influence sandboxed Twig template content (e.g. a multi-tenant app that renders user-supplied templates through Twig's sandbox) calls an application-allowed function using a spread argument whose first positional parameter is a non-string type (like int) but whose later parameter accepts strings, e.g. {{ tag(...[1, obj]) }}. This causes Twig to invoke the object's denied __toString() method that the sandbox policy was supposed to block, leaking its string output. No public exploit code is identified; only the advisory's conceptual trigger snippet exists. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Nov 24, 2026
The Twig sandbox extension for PHP can be bypassed in versions 3.28.0 through 3.31.0, letting a sandboxed template reach a __toString() method that the security policy explicitly denies. An authenticated attacker who can supply template source to an application that runs the sandbox - and that has allow-listed a custom function, filter, or test whose PHP signature takes a non-string parameter (such as an int) followed by a string-accepting or variadic parameter - can use spread syntax such as {{ tag(...[1, obj]) }} to slip an object past the stringification check. Impact is limited to information disclosure through the denied __toString() call, with no code execution, write, or denial of service; no built-in Twig callable is affected, so exploitation requires a non-default allow-listed callable, and no public exploit has been identified at time of analysis (CISA KEV: not listed; priority label: monitor). Vendor-released patch: 3.31.1.
RemediationAI
Upgrade the twig/twig Composer package to 3.31.1 or later on the 3.x branch; the vendor fix is commit 7af821c372f52cc9447afeba9e042de44b738222 (Vendor-released patch: 3.31.1), referenced from https://github.com/twigphp/Twig/security/advisories/GHSA-56wp-8m9q-4354 and https://symfony.com/cve-2026-133766. If upgrading cannot be done immediately, audit the SecurityPolicy's allowed functions, filters, and tests and remove or reject allow-listed custom callables whose signatures place a non-string parameter (int, bool, float, object-typed, etc.) before a string-typed, untyped, or variadic parameter, since those are the only shapes the bypass can reach - the trade-off is that templates calling those callables will fail the sandbox policy once removed. Where such callables must stay allow-listed, avoid rendering attacker-controlled template source through the sandbox until the upgrade lands, accepting the loss of that templating capability. Applications that do not enable the sandbox, or that only allow built-in Twig callables, need no emergency action beyond routine patching.
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 enforces a SecurityPolicy over template operations. When compiling calls, SandboxNodeVisitor::wrapArguments() inspects each argument and decides whether to wrap it in a runtime check that rejects objects whose __toString() is not allowed by the policy. Since 3.28.0, that check was decided per argument position using CallableParameters::isStringCoercionSafe() against the parameter the argument was mapped to. A spread argument (the ... operator) was incorrectly treated as filling only the single parameter at its start index, when in PHP it actually fills every parameter from that position onward. Consequently, if the parameter at the spread's starting position was typed as something that cannot hold a string (e.g. int), the check was skipped even though later parameters accepted strings, untyped values, or variadics - allowing an object with a denied __toString() to be coerced into that later slot. This is a protection-mechanism failure (CWE-693) with an authorization-control dimension (CWE-863, per the upstream advisory). The fix in SandboxNodeVisitor changes the spread handling so the argument is wrapped unless every remaining positional parameter it could fill is string-coercion-safe; the commit adds regression tests covering string variadics, untyped variadics, optional untyped parameters, spreads of variables and mappings, spreads after positional arguments, and unsafe parameters preceding safe variadics.
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
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 a specific allowed callable with an int-then-string signature is required; PR:L as the attacker must control sandboxed template input; S:C for the sandbox-policy boundary bypass; C:L only, no I/A impact.
Primary rating from Vendor (Symfony).
CVSS VectorVendor: Symfony
DescriptionCVE.org
Since Twig 3.28.0, the sandbox skips the toString() check of an argument whose PHP parameter can't hold a string, like an int. A spread argument was mapped to a single parameter, although it fills every parameter from its position on. A sandboxed template could therefore call a denied toString() method:
{{ tag(...[1, obj]) }}
Here, the first parameter of tag() is an int, and a later one accepts strings. Applications are affected when they allow such a function, filter or test in the sandbox. No built-in callable is affected.
A spread argument is now checked unless every parameter that it can fill has a safe type.
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.
Twig before 2.4.4 allows Server-Side Template Injection (SSTI) via the search search_key parameter. Rated critical sever
Sandbox bypass in Twig template engine versions 2.16.x and 3.9.0 through 3.25.x allows attackers with template rendering
Twig is a template language for PHP. Rated high severity (CVSS 8.6), this vulnerability is remotely exploitable, no auth
Twig is a template language for PHP. Rated high severity (CVSS 7.5), this vulnerability is remotely exploitable, no auth
The displayBlock function Template.php in Sensio Labs Twig before 1.20.0, when Sandbox mode is enabled, allows remote at
Denial-of-service via resource exhaustion affects the Twig templating engine for PHP prior to 3.26.0, where the sandbox
Symfony is a PHP framework for web and console applications and a set of reusable PHP components. Rated medium severity
Sandboxed Twig templates that are permitted to use the `join` filter can disclose the private and protected properties o
Twig's security sandbox allow-list can be bypassed by a sandboxed template that uses the `embed` tag with a parent expre
Sandbox policy bypass in Twig 3.23.0 through 3.31.0 lets whoever supplies the template source force the engine to invoke
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
A sandbox information disclosure exists in Twig before 1.38.0 and 2.x before 2.7.0 because, under some circumstances, it
EUVD-2026-133915
NVD
CVE.org
EPSS
GitHub
VulDB
Exploit-DB