CVE-2026-47732
HIGH 7.1CVSS 4.0Twig: Sandbox: multiple `__toString()` policy bypasses via unguarded string coercion points
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.
- Published
- 14 Jul 2026
- Last modified
- 24 Oct 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Analyzed
- Weakness
- CWE-20CWE-863
- Also known as
- GHSA-pr2w-4gpj-cpq4
- Sources
- NVDJSONOSV GHSA-pr2w-4gpj-cpq4JSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| NVD | security-advisories@github.com (Secondary) | CVSS 4.0 | HIGH 7.1 | 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 |
| NVD | nvd@nist.gov (Primary) | CVSS 3.1 | MEDIUM 6.5 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | symfony | twigcpe:2.3:a:symfony:twig:*:*:*:*:*:*:*:* |
< 3.26.0 | 3.26.0 |
| OSV | Packagist | twig/twig | < 3.26.0 | 3.26.0 |
References
- https://github.com/twigphp/Twig/commit/447d0b2331e01b8fc6e08119ac984e1ef50caef9 · Patch
- https://github.com/twigphp/Twig/releases/tag/v3.26.0 · Release Notes, WEB
- https://github.com/twigphp/Twig/security/advisories/GHSA-pr2w-4gpj-cpq4 · Vendor Advisory, WEB
- https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2026-47732.yaml · WEB
- https://github.com/twigphp/Twig · PACKAGE
- https://symfony.com/cve-2026-47732 · WEB
History
- 25 Nov 2026 21:03 UTC · NVD: first stored (published 14 Jul 2026)
- 25 Nov 2026 20:15 UTC · OSV: first stored (published 5 Jun 2026)