{"id":"CVE-2026-133765","aliases":["GHSA-ccrc-gqhf-3cxc"],"title":"Sandbox `__toString()` policy bypass via assignment and destructuring expressions","originalDescription":"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:\n\n{{ (x = obj) }}\n{{ ({secret: s} = obj)|join }}\n\nNo tag needs to be allowed.\n\nThe 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.","severity":{"cvss":5.3,"vector":"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","label":"medium"},"exploitation":{"kev":null,"epss":{"score":0.00533,"percentile":0.38536},"exploitDb":null},"affected":[{"ecosystem":"unknown","name":"twig/twig","range":">=3.23.0, <3.31.1","fixed":"3.31.1"}],"references":[{"url":"https://symfony.com/cve-2026-133765","type":"vendor-advisory"},{"url":"https://github.com/twigphp/Twig/security/advisories/GHSA-ccrc-gqhf-3cxc","type":"vendor-advisory"},{"url":"https://github.com/twigphp/Twig/commit/6bcdbc3d4470dde23e3e2636e7053e0512387edd","type":"patch"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/133xxx/CVE-2026-133765.json","type":"advisory"},{"url":"https://github.com/twigphp/Twig","type":"package"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-133765","type":"advisory"},{"url":"https://packagist.org","type":"web"}],"sources":[{"name":"nvd","at":"2026-11-24T19:02:21.134Z","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-133765","license":"NVD terms of use","firstSeenAt":"2026-11-24T13:30:19.599Z"},{"name":"osv","at":"2026-11-27T08:12:36.563Z","url":"https://osv.dev/vulnerability/CVE-2026-133765","license":"CC-BY 4.0","firstSeenAt":"2026-11-24T15:09:28.988Z"},{"name":"cvelistV5","at":"2026-11-29T04:45:27.182Z","url":"https://www.cve.org/CVERecord?id=CVE-2026-133765","license":"CVE Terms of Use","firstSeenAt":"2026-11-24T13:27:33.497Z"}],"firstSeenAt":"2026-11-24T13:27:33.497Z","publishedAt":"2026-11-24T13:07:48.546Z","modifiedAt":"2026-11-27T07:00:08.970Z"}