{"id":"CVE-2026-47732","aliases":["CLSA-2026-1783991054","CLSA-2026-1784682913","CLSA-2026-1786534048","CLSA-2026-1794214791","DEBIAN-CVE-2026-47732","EUVD-2026-44555","GHSA-pr2w-4gpj-cpq4","ROOT-APP-COMPOSER-CVE-2026-47732","UBUNTU-CVE-2026-47732"],"status":"published","title":"Twig Sandbox: multiple `__toString()` policy bypasses via unguarded string coercion points","description":"Twig is a template language for PHP. Prior to 3.26.0, several Twig language constructs trigger PHP string coercion on a Stringable operand without consulting SecurityPolicy::checkMethodAllowed(), allowing a sandboxed template author to invoke __toString() on objects reachable in the render context through conditional expressions, comparison operators, tests, template-loading tags, dynamic attribute names, spread arguments, the do tag, and the .. range operator. This issue is fixed in version 3.26.0.","severity":{"version":"4.0","score":7.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N","level":"high","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-09","score":0.00402,"percentile":0.34682,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-20","CWE-863"],"published":"2026-06-05T21:47:11Z","modified":"2026-11-09T19:15:14Z","fixes":[{"ecosystem":"Packagist","package":"twig/twig","fixed_in":["3.26.0"],"sources":["ghsa","osv"]},{"ecosystem":"Debian:13","package":"php-twig","fixed_in":["3.27.0-0+deb13u1"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"php-twig","fixed_in":["3.26.0-1"],"sources":["osv"]},{"ecosystem":"Root:Composer","package":"twig/twig","fixed_in":["v3.11.3-p12007001+root.io","v3.11.3-p12007002+root.io","v3.11.3-p12007003+root.io","v3.11.3-p12007004+root.io","v3.11.3-p12007005+root.io"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"Packagist","package":"twig/twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"3.25.0"},{"fixed":"3.26.0"}]}]},{"source":"osv","ecosystem":"TuxCare:Packagist","package":"twig/twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"v2.16.1"},{"fixed":"v2.16.1-p1+tuxcare"}]}],"versions":["v2.16.1"],"bundled":11},{"source":"osv","ecosystem":"TuxCare:Packagist","package":"twig/twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"v2.15.6"},{"fixed":"v2.15.6-p2+tuxcare"}]}],"versions":["v2.15.6","v2.15.6-p1+tuxcare"],"bundled":10},{"source":"osv","ecosystem":"TuxCare:Packagist","package":"twig/twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"v1.44.8"},{"fixed":"v1.44.8-p1+tuxcare"}]}],"versions":["v1.44.8"],"bundled":8},{"source":"osv","ecosystem":"TuxCare:Packagist","package":"twig/twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"v3.19.0"},{"fixed":"v3.19.0-p1+tuxcare"}]}],"versions":["v3.19.0"],"bundled":10},{"source":"osv","ecosystem":"Debian:12","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.10.1-1","3.10.3-1","3.11.0-1","3.13.0-1","3.14.0-1","3.14.0-2","3.14.0-3","3.14.0-4","3.14.2-1","3.14.2-2","3.14.2-3","3.15.0-1","3.15.0-2","3.17.1-1","3.17.1-2","3.18.0-1","3.18.0-2","3.18.0-4","3.18.0-5","3.18.0-6","3.18.0-7","3.19.0-1","3.19.0-1~bootstrap","3.20.0-1","3.20.0-1~bootstrap","3.20.0-2","3.21.1-1","3.21.1-2","3.21.1-3","3.22.0-1","3.22.0-2","3.22.1-1","3.22.1-2","3.22.1-3","3.22.2-1","3.22.2-2","3.23.0-1","3.23.0-2","3.24.0-1","3.26.0-1","3.27.0-1","3.27.1-1","3.28.0-1","3.5.1-1","3.5.1-1+deb12u1","3.5.1-1+deb12u2","3.5.1-1+deb12u3","3.6.0-1","3.6.1-1","3.7.0-1","3.7.1-1","3.7.1-2","3.7.1-3","3.8.0-1","3.8.0-2","3.8.0-3","3.8.0-4","3.9.3-1","4.0.0~alpha1-1"]},{"source":"osv","ecosystem":"Debian:13","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.27.0-0+deb13u1"}]}],"versions":["3.20.0-2","3.21.1-1","3.21.1-2","3.21.1-3","3.22.0-1","3.22.0-2","3.22.1-1","3.22.1-2","3.22.1-3","3.22.2-1","3.22.2-2","3.23.0-1","3.23.0-2","3.24.0-1","3.26.0-0+deb13u1","3.26.0-1"]},{"source":"osv","ecosystem":"Debian:14","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.26.0-1"}]}],"versions":["3.20.0-2","3.21.1-1","3.21.1-2","3.21.1-3","3.22.0-1","3.22.0-2","3.22.1-1","3.22.1-2","3.22.1-3","3.22.2-1","3.22.2-2","3.23.0-1","3.23.0-2","3.24.0-1"]},{"source":"osv","ecosystem":"Packagist","package":"twig/twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.26.0"}]}],"versions":["1.3.0","1.4.0","1.5.0","1.5.1","1.6.0","1.6.1","1.6.2","1.6.3","1.6.4","1.6.5","v1.10.0","v1.10.1","v1.10.2","v1.10.3","v1.11.0","v1.11.1","v1.12.0","v1.12.0-RC1","v1.12.1","v1.12.2","v1.12.3","v1.13.0","v1.13.1","v1.13.2","v1.14.0","v1.14.1","v1.14.2","v1.15.0","v1.15.1","v1.16.0","v1.16.1","v1.16.2","v1.16.3","v1.17.0","v1.18.0","v1.18.1","v1.18.2","v1.19.0","v1.20.0","v1.21.0","v1.21.1","v1.21.2","v1.22.0","v1.22.1","v1.22.2","v1.22.3","v1.23.0","v1.23.1","v1.23.2","v1.23.3","v1.24.0","v1.24.1","v1.24.2","v1.25.0","v1.26.0","v1.26.1","v1.27.0","v1.28.0","v1.28.1","v1.28.2","v1.29.0","v1.30.0","v1.31.0","v1.32.0","v1.33.0","v1.33.1","v1.33.2","v1.34.0","v1.34.1","v1.34.2","v1.34.3","v1.34.4","v1.35.0","v1.35.1","v1.35.2","v1.35.3","v1.35.4","v1.36.0","v1.37.0","v1.37.1","v1.38.0","v1.38.1","v1.38.2","v1.38.3","v1.38.4","v1.39.0","v1.39.1","v1.40.0","v1.40.1","v1.41.0","v1.42.0","v1.42.1","v1.42.2","v1.42.3","v1.42.4","v1.42.5","v1.43.0","v1.43.1","v1.44.0","v1.44.1","v1.44.2","v1.44.3","v1.44.4","v1.44.5","v1.44.6","v1.44.7","v1.44.8","v1.7.0","v1.8.0","v1.8.1","v1.8.2","v1.8.3","v1.9.0","v1.9.1","v1.9.2","v2.0.0","v2.1.0","v2.10.0","v2.11.0","v2.11.1","v2.11.2","v2.11.3","v2.12.0","v2.12.1","v2.12.2","v2.12.3","v2.12.4","v2.12.5","v2.13.0","v2.13.1","v2.14.0","v2.14.1","v2.14.10","v2.14.11","v2.14.12","v2.14.13","v2.14.2","v2.14.3","v2.14.4","v2.14.5","v2.14.6","v2.14.7","v2.14.8","v2.14.9","v2.15.0","v2.15.1","v2.15.2","v2.15.3","v2.15.4","v2.15.5","v2.15.6","v2.16.0","v2.16.1","v2.2.0","v2.3.0","v2.3.1","v2.3.2","v2.4.0","v2.4.1","v2.4.2","v2.4.3","v2.4.4","v2.4.5","v2.4.6","v2.4.7","v2.4.8","v2.5.0","v2.6.0","v2.6.1","v2.6.2","v2.7.0","v2.7.1","v2.7.2","v2.7.3","v2.7.4","v2.8.0","v2.8.1","v2.9.0","v3.0.0","v3.0.0-BETA1","v3.0.1","v3.0.2","v3.0.3","v3.0.4","v3.0.5","v3.1.0","v3.1.1","v3.10.0","v3.10.1","v3.10.2","v3.10.3","v3.11.0","v3.11.1","v3.11.2","v3.11.3","v3.12.0","v3.13.0","v3.14.0","v3.14.1","v3.14.2","v3.15.0","v3.16.0","v3.17.0","v3.17.1","v3.18.0","v3.19.0","v3.2.1","v3.20.0","v3.21.0","v3.21.1","v3.22.0","v3.22.1","v3.22.2","v3.23.0","v3.24.0","v3.25.0","v3.3.0","v3.3.1","v3.3.10","v3.3.2","v3.3.3","v3.3.4","v3.3.5","v3.3.6","v3.3.7","v3.3.8","v3.3.9","v3.4.0","v3.4.1","v3.4.2","v3.4.3","v3.5.0","v3.5.1","v3.6.0","v3.6.1","v3.7.0","v3.7.1","v3.8.0","v3.9.0","v3.9.1","v3.9.2","v3.9.3"]},{"source":"osv","ecosystem":"Root:Composer","package":"twig/twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"v3.11.3-p12007001+root.io"},{"fixed":"v3.11.3-p12007002+root.io"},{"fixed":"v3.11.3-p12007003+root.io"},{"fixed":"v3.11.3-p12007004+root.io"},{"fixed":"v3.11.3-p12007005+root.io"}]}]},{"source":"osv","ecosystem":"Ubuntu:Pro:20.04:LTS","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["2.11.3-2","2.12.1-1","2.12.2-1","2.12.3-1","2.12.5-1","2.12.5-1ubuntu0.1~esm1","2.12.5-1ubuntu0.1~esm2"]},{"source":"osv","ecosystem":"Ubuntu:Pro:22.04:LTS","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.3.2-1ubuntu3","3.3.4-1","3.3.6-1","3.3.7-1","3.3.8-2ubuntu4","3.3.8-2ubuntu4+esm1","3.3.8-2ubuntu4+esm2"]},{"source":"osv","ecosystem":"Ubuntu:Pro:24.04:LTS","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.7.0-1","3.7.1-1","3.8.0-2","3.8.0-2ubuntu0.1~esm1","3.8.0-2ubuntu1","3.8.0-2ubuntu1+esm1"]},{"source":"osv","ecosystem":"Ubuntu:25.10","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.20.0-2ubuntu1"]},{"source":"osv","ecosystem":"Ubuntu:26.10","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.23.0-2build7","3.27.1-1","3.28.0-1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:26.04:LTS","package":"php-twig","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.20.0-2ubuntu1","3.23.0-2build5","3.23.0-2build7","3.23.0-2ubuntu0.1~esm1"]}],"products":[{"vendor":"symfony","product":"twig"},{"vendor":"twigphp","product":"twig"}],"references":[{"url":"https://github.com/twigphp/Twig/security/advisories/GHSA-pr2w-4gpj-cpq4","tags":["x_refsource_CONFIRM","Vendor Advisory","advisory","web"]},{"url":"https://github.com/twigphp/Twig/commit/447d0b2331e01b8fc6e08119ac984e1ef50caef9","tags":["x_refsource_MISC","Patch","fix"]},{"url":"https://github.com/twigphp/Twig/releases/tag/v3.26.0","tags":["x_refsource_MISC","Release Notes","web"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2026-47732.yaml","tags":["web"]},{"url":"https://symfony.com/cve-2026-47732","tags":["web"]},{"url":"https://github.com/advisories/GHSA-pr2w-4gpj-cpq4"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/47xxx/CVE-2026-47732.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47732","tags":["advisory"]},{"url":"https://security-tracker.debian.org/tracker/CVE-2026-47732","tags":["advisory"]},{"url":"https://github.com/twigphp/Twig","tags":["package"]},{"url":"https://ubuntu.com/security/CVE-2026-47732","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-47732","tags":["report"]},{"url":"https://symfony.com/blog/cve-2026-47732-sandbox-multiple-tostring-policy-bypasses-via-unguarded-string-coercion-points","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2026-47732","title":"Twig Sandbox: multiple `__toString()` policy bypasses via unguarded string coercion points","description":"Twig is a template language for PHP. Prior to 3.26.0, several Twig language constructs trigger PHP string coercion on a Stringable operand without consulting SecurityPolicy::checkMethodAllowed(), allowing a sandboxed template author to invoke __toString() on objects reachable in the render context through conditional expressions, comparison operators, tests, template-loading tags, dynamic attribute names, spread arguments, the do tag, and the .. range operator. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T21:12:13.071Z","modified":"2026-07-15T13:26:33.236Z","cvss":[{"version":"4.0","score":7.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N","level":"high","assessor":"cna"}],"cwes":["CWE-863"],"updated_at":"2026-11-02T13:36:51.6229Z"}],"euvd":[{"id":"EUVD-2026-44555","description":"Twig is a template language for PHP. Prior to 3.26.0, several Twig language constructs trigger PHP string coercion on a Stringable operand without consulting SecurityPolicy::checkMethodAllowed(), allowing a sandboxed template author to invoke __toString() on objects reachable in the render context through conditional expressions, comparison operators, tests, template-loading tags, dynamic attribute names, spread arguments, the do tag, and the .. range operator. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T21:12:13Z","modified":"2026-07-15T13:26:33Z","cvss":[{"version":"4.0","score":7.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N","level":"high"}],"updated_at":"2026-11-02T18:19:53.226345Z"}],"ghsa":[{"id":"GHSA-pr2w-4gpj-cpq4","title":"Twig: Sandbox: multiple `__toString()` policy bypasses via unguarded string coercion points","description":"### Description\n\n`SandboxNodeVisitor` enforces `SecurityPolicy::checkMethodAllowed()` for implicit `__toString()` calls by wrapping selected AST nodes in `CheckToStringNode`. The set of wrapped nodes is incomplete, and several Twig language constructs still trigger PHP string coercion on a `Stringable` operand without first consulting the policy. A sandboxed template author can therefore invoke `__toString()` on any object reachable in the render context, even when `__toString` on its class is not allowlisted.\n\nConfirmed bypass vectors:\n\n- Conditional expressions (`a ? b : c`, `a ?: b`, `a ?? b`) used as the input of a string-coercing filter or as a filter/function argument.\n- The `matches` operator and the loose comparison operators (`==`, `!=`, `\u003c`, `\u003e`, `\u003c=`, `\u003e=`, `\u003c=\u003e`), which coerce a `Stringable` operand to string and can be used as an oracle to recover the value byte by byte (no tag, filter or function needs to be allowlisted).\n- Twig tests in general (which were never policy-gated), in particular `is empty` which casts a `Stringable` value via `(string) $value` in `CoreExtension::testEmpty()`.\n- Null-coalesce expressions nested in concatenation, and the direct output of allowed functions or filters that return a `Stringable` object.\n- Arguments passed to allowed object methods, template-name expressions of template-loading tags (`include`, `extends`, `use`, ...), dynamic attribute/property names, and spread arguments from `Traversable` objects.\n- The `do` tag and the `..` range operator.\n\n### Resolution\n\nThe sandbox now wraps every child node that the parent will string-coerce at runtime, instead of relying on a hardcoded list of node types in `SandboxNodeVisitor`. A new `Twig\\Node\\CoercesChildrenToStringInterface` lets nodes declare which of their children must be guarded; core nodes (concatenation, comparison and range binaries, filter/function/test expressions, `do`, `include`, `extends`, `use`, ...) implement it. Spread arguments are materialised and policy-checked via the new `SandboxExtension::ensureSpreadAllowed()`, and dynamic attribute names are checked at runtime inside `CoreExtension::getAttribute()`.\n\n### Credits\n\nTwig would like to thank Anthropic Glasswing and El Kharoubi Iosif for reporting the issues, and Fabien Potencier for providing the fixes.","status":"published","published":"2026-06-05T21:47:11Z","modified":"2026-06-05T21:47:12Z","cwes":["CWE-20"],"updated_at":"2026-11-02T14:40:17.745826Z"}],"nvd":[{"id":"CVE-2026-47732","description":"Twig is a template language for PHP. Prior to 3.26.0, several Twig language constructs trigger PHP string coercion on a Stringable operand without consulting SecurityPolicy::checkMethodAllowed(), allowing a sandboxed template author to invoke __toString() on objects reachable in the render context through conditional expressions, comparison operators, tests, template-loading tags, dynamic attribute names, spread arguments, the do tag, and the .. range operator. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T22:16:59.667Z","modified":"2026-10-24T22:10:00.21Z","cvss":[{"version":"4.0","score":7.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"high","assessor":"secondary"},{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","level":"medium","assessor":"primary"}],"cwes":["CWE-863"],"updated_at":"2026-11-02T14:12:29.879716Z"}],"osv":[{"id":"CVE-2026-47732","title":"Twig Sandbox: multiple `__toString()` policy bypasses via unguarded string coercion points","description":"Twig is a template language for PHP. Prior to 3.26.0, several Twig language constructs trigger PHP string coercion on a Stringable operand without consulting SecurityPolicy::checkMethodAllowed(), allowing a sandboxed template author to invoke __toString() on objects reachable in the render context through conditional expressions, comparison operators, tests, template-loading tags, dynamic attribute names, spread arguments, the do tag, and the .. range operator. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T21:12:13.071Z","modified":"2026-10-28T02:30:31.715026339Z","cvss":[{"version":"4.0","score":7.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N","level":"high"}],"cwes":["CWE-863"],"updated_at":"2026-11-02T15:45:06.231145Z"},{"id":"DEBIAN-CVE-2026-47732","description":"Twig is a template language for PHP. Prior to 3.26.0, several Twig language constructs trigger PHP string coercion on a Stringable operand without consulting SecurityPolicy::checkMethodAllowed(), allowing a sandboxed template author to invoke __toString() on objects reachable in the render context through conditional expressions, comparison operators, tests, template-loading tags, dynamic attribute names, spread arguments, the do tag, and the .. range operator. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T22:16:59.667Z","modified":"2026-10-25T09:47:42.145156749Z","cvss":[{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","level":"medium"}],"updated_at":"2026-11-02T15:45:56.444225Z"},{"id":"UBUNTU-CVE-2026-47732","description":"Twig is a template language for PHP. Prior to 3.26.0, several Twig language constructs trigger PHP string coercion on a Stringable operand without consulting SecurityPolicy::checkMethodAllowed(), allowing a sandboxed template author to invoke __toString() on objects reachable in the render context through conditional expressions, comparison operators, tests, template-loading tags, dynamic attribute names, spread arguments, the do tag, and the .. range operator. This issue is fixed in version 3.26.0.","status":"published","published":"2026-07-14T22:16:00Z","modified":"2026-10-17T13:00:19.91331295Z","cvss":[{"version":"4.0","score":7.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N","level":"high"},{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","level":"medium"}],"updated_at":"2026-11-02T16:56:33.391918Z"},{"id":"CLSA-2026-1783991054","title":"TuxCare security update for twig/twig (11 CVEs)","description":"TuxCare rebuilt twig/twig to address 11 CVEs. Fixed in v2.16.1-p1+tuxcare.","status":"published","published":"2026-08-04T14:52:43Z","modified":"2026-10-15T09:47:53.468304893Z","updated_at":"2026-11-02T15:43:46.151924Z"},{"id":"CLSA-2026-1784682913","title":"TuxCare security update for twig/twig (10 CVEs)","description":"TuxCare rebuilt twig/twig to address 10 CVEs. Fixed in v2.15.6-p2+tuxcare.","status":"published","published":"2026-08-04T14:52:46Z","modified":"2026-10-15T09:47:59.839636397Z","updated_at":"2026-11-02T15:43:46.482572Z"},{"id":"CLSA-2026-1786534048","title":"TuxCare security update for twig/twig (8 CVEs)","description":"TuxCare rebuilt twig/twig to address 8 CVEs. Fixed in v1.44.8-p1+tuxcare.","status":"published","published":"2026-08-12T11:27:28Z","modified":"2026-10-15T09:47:59.705236491Z","updated_at":"2026-11-02T15:43:46.850893Z"},{"id":"CLSA-2026-1794214791","title":"TuxCare security update for twig/twig (10 CVEs)","description":"TuxCare rebuilt twig/twig to address 10 CVEs. Fixed in v3.19.0-p1+tuxcare.","status":"published","published":"2026-11-09T09:59:52Z","modified":"2026-11-09T19:15:14.540306307Z","updated_at":"2026-11-09T19:38:09.278998Z"},{"id":"GHSA-pr2w-4gpj-cpq4","title":"Twig: Sandbox: multiple `__toString()` policy bypasses via unguarded string coercion points","description":"### Description\n\n`SandboxNodeVisitor` enforces `SecurityPolicy::checkMethodAllowed()` for implicit `__toString()` calls by wrapping selected AST nodes in `CheckToStringNode`. The set of wrapped nodes is incomplete, and several Twig language constructs still trigger PHP string coercion on a `Stringable` operand without first consulting the policy. A sandboxed template author can therefore invoke `__toString()` on any object reachable in the render context, even when `__toString` on its class is not allowlisted.\n\nConfirmed bypass vectors:\n\n- Conditional expressions (`a ? b : c`, `a ?: b`, `a ?? b`) used as the input of a string-coercing filter or as a filter/function argument.\n- The `matches` operator and the loose comparison operators (`==`, `!=`, `\u003c`, `\u003e`, `\u003c=`, `\u003e=`, `\u003c=\u003e`), which coerce a `Stringable` operand to string and can be used as an oracle to recover the value byte by byte (no tag, filter or function needs to be allowlisted).\n- Twig tests in general (which were never policy-gated), in particular `is empty` which casts a `Stringable` value via `(string) $value` in `CoreExtension::testEmpty()`.\n- Null-coalesce expressions nested in concatenation, and the direct output of allowed functions or filters that return a `Stringable` object.\n- Arguments passed to allowed object methods, template-name expressions of template-loading tags (`include`, `extends`, `use`, ...), dynamic attribute/property names, and spread arguments from `Traversable` objects.\n- The `do` tag and the `..` range operator.\n\n### Resolution\n\nThe sandbox now wraps every child node that the parent will string-coerce at runtime, instead of relying on a hardcoded list of node types in `SandboxNodeVisitor`. A new `Twig\\Node\\CoercesChildrenToStringInterface` lets nodes declare which of their children must be guarded; core nodes (concatenation, comparison and range binaries, filter/function/test expressions, `do`, `include`, `extends`, `use`, ...) implement it. Spread arguments are materialised and policy-checked via the new `SandboxExtension::ensureSpreadAllowed()`, and dynamic attribute names are checked at runtime inside `CoreExtension::getAttribute()`.\n\n### Credits\n\nTwig would like to thank Anthropic Glasswing and El Kharoubi Iosif for reporting the issues, and Fabien Potencier for providing the fixes.","status":"published","published":"2026-06-05T21:47:11Z","modified":"2026-09-10T03:51:09.316002672Z","cwes":["CWE-20"],"updated_at":"2026-11-02T15:46:53.700556Z"},{"id":"ROOT-APP-COMPOSER-CVE-2026-47732","title":"CVE-2026-47732 in twig/twig - Patched by Root","description":"Root has patched CVE-2026-47732 in the twig/twig package for Root:Composer. Multiple fixed versions available.","status":"published","published":"2026-11-02T09:08:15Z","modified":"2026-11-02T10:15:07.10743016Z","updated_at":"2026-11-02T15:53:26.76659Z"}]}}
