CVE-2026-133765
published medium CVSS 4.0 · 5.3Sandbox `__toString()` policy bypass via assignment and destructuring expressions
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Twig | — | twig/twig3.23.0 to < 3.31.1 · Other versions: unaffected | Affected | Not stated | Symfony |
Description
The sandbox checks that a template may call toString() on an object before converting it to a string. Since Twig 3.23.0, assignments like x = obj, and the destructuring forms [a] = list and {a} = obj, evaluate to the value that they assign. The sandbox didn't check that value, so a sandboxed template could call a denied toString() method: {{ (x = obj) }} {{ ({secret: s} = obj)|join }} No tag needs to be allowed. The sandbox now checks the result of assignments like the result of filters and functions. {% do x = obj %} and {% if (x = obj) %} still work, since they don't convert the value to a string.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 4.0
- Base score
- 5.3 / 10
- Severity
- medium
- Provider
- Symfony · cna
- Vector string
- 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
- Scenarios
- en: GENERAL
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| Twig | twig/twig | 3.23.0 to < 3.31.1 (affected · semver)Default: unaffected | Symfony · cna |
Weaknesses
2- CWE-693 CWE-693 Protection Mechanism Failure
- CWE-863 CWE-863 Incorrect Authorization
References
3- https://github.com/twigphp/Twig/commit/6bcdbc3d4470dde23e3e2636e7053e0512387edd
- GHSA-ccrc-gqhf-3cxc https://github.com/twigphp/Twig/security/advisories/GHSA-ccrc-gqhf-3cxc
- CVE-2026-133765 https://symfony.com/cve-2026-133765
Provider assertions
2Symfony · cna
Sandbox `__toString()` policy bypass via assignment and destructuring expressions
CISA-ADP · adp
CISA ADP Vulnrichment
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- c86029e9e827bcd291d791761cc0615c7ac875778e880193e852cbb3897c9536
- Ingested
- 01 Dec 2026, 19:45:57 UTC
- Source record
- Official CVE record