CVE-2026-46640
HIGH 8.7CVSS 4.0Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation
Twig is a template language for PHP. From 3.15.0 until 3.26.0, _self.(<string>) and import-alias dynamic attribute syntax can concatenate an attacker-controlled string into a MacroReferenceExpression name without identifier validation, causing raw PHP to be emitted into the generated template source and executed at template-load time. 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-94
- Also known as
- GHSA-45vw-wh46-2vx8
- Sources
- NVDJSONOSV GHSA-45vw-wh46-2vx8JSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| NVD | security-advisories@github.com (Secondary) | CVSS 4.0 | HIGH 8.7 | CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/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 |
| OSV | GitHub | CVSS 4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N | |
| NVD | nvd@nist.gov (Primary) | CVSS 3.1 | HIGH 8.8 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | symfony | twigcpe:2.3:a:symfony:twig:*:*:*:*:*:*:*:* |
>= 3.15.0, < 3.26.0 | 3.26.0 |
| OSV | Packagist | twig/twig | >= 3.15.0, < 3.26.0 | 3.26.0 |
References
- https://github.com/twigphp/Twig/commit/324fa60545694fa6abe85ded9befcb82e1066bc2 · Patch
- https://github.com/twigphp/Twig/releases/tag/v3.26.0 · Release Notes
- https://github.com/twigphp/Twig/security/advisories/GHSA-45vw-wh46-2vx8 · Vendor Advisory, WEB
- https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2026-46640.yaml · WEB
- https://github.com/twigphp/Twig · PACKAGE
- https://github.com/vladko312/extras/blob/main/CVE-2026-46640.py · WEB
- https://symfony.com/cve-2026-46640 · 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 21 May 2026)