CVE-2026-48806
HIGH 7.1CVSS 4.0Twig: Sandbox `__toString()` policy bypass via dynamic mapping keys
Twig is a template language for PHP. Prior to 3.27.0, ArrayExpression does not guard dynamic mapping keys that are coerced to strings, allowing PHP to invoke __toString() on a Stringable object used as a mapping key without calling SandboxExtension::ensureToStringAllowed(). This issue is fixed in version 3.27.0.
- Published
- 14 Jul 2026
- Last modified
- 24 Oct 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Analyzed
- Weakness
- CWE-693CWE-863
- Also known as
- GHSA-5v5v-ww74-355v
- Sources
- NVDJSONOSV GHSA-5v5v-ww74-355vJSON
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 | CRITICAL 9.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | symfony | twigcpe:2.3:a:symfony:twig:*:*:*:*:*:*:*:* |
< 3.27.0 | 3.27.0 |
| OSV | Packagist | twig/twig | < 3.27.0 | 3.27.0 |
References
- https://github.com/twigphp/Twig/commit/9ff41014639ef0e8eb50ac7669191c309d863105 · Patch
- https://github.com/twigphp/Twig/releases/tag/v3.27.0 · Release Notes, WEB
- https://github.com/twigphp/Twig/security/advisories/GHSA-5v5v-ww74-355v · Vendor Advisory, WEB
- https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2026-48806.yaml · WEB
- https://github.com/twigphp/Twig · PACKAGE
- https://symfony.com/blog/cve-2026-48806-sandbox-tostring-policy-bypass-via-dynamic-mapping-keys · 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 30 Jun 2026)