CVE-2026-133765Sandbox `__toString()` policy bypass via assignment and destructuring expressions
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.
What to do
Debian has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Debian 14 | php-twig | Fix pending | DEBIAN-CVE-2026-133765 | |
| Debian 13 | php-twig | Fix pending | DEBIAN-CVE-2026-133765 | |
| Debian 12 | php-twig | Fix pending | DEBIAN-CVE-2026-133765 |
What the vendor says
As published in the CVE record by Symfony, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- twig/twig: affected: 3.23.0 to before 3.31.1; fixed in
3.31.1
Vendor advisories:
- https://symfony.com/cve-2026-133765 (vendor-advisory)
- https://github.com/twigphp/Twig/security/advisories/GHSA-ccrc-gqhf-3cxc (vendor-advisory)
- https://github.com/twigphp/Twig/commit/6bcdbc3d4470dde23e3e2636e7053e0512387edd (patch)
References
- https://symfony.com/cve-2026-133765
- https://github.com/twigphp/Twig/security/advisories/GHSA-ccrc-gqhf-3cxc
- https://github.com/twigphp/Twig/commit/6bcdbc3d4470dde23e3e2636e7053e0512387edd
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.