Skip to main content

Twig CVE-2026-133766

| EUVDEUVD-2026-133915 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
    Control sandboxed template source
  2. Delivery
    Call allowed function with spread arg
  3. Exploit
    Reach unsafe string parameter past int
  4. Execution
    Invoke denied __toString()
  5. Impact
    Disclose 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.

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

twig/twig 3.28.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 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

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.5 LOW

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.

3.1 AV:N/AC:H/PR:L/UI:N/S:C/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

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

EPSS Score
0.5%
Top 62% exploitable
Prevalence
High
Twig is a core PHP templating engine used across Symfony, Drupal and 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 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 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-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

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