What’s Vulnerable › Vulnerabilities
CVE-2026-46640: Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation
- Severity: high (CVSS 8.8 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 0.6% probability of exploitation in the next 30 days
- Public exploit or detection template: none known
- Published: 2026-07-14 · updated 2026-10-24
- Weakness: CWE-94
Description
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.
Affected products
- twigphp Twig: from 3.15.0 before 3.26.0 — fixed in 3.26.0
How to fix
Upgrade to a fixed version: twigphp Twig 3.26.0. Check the vendor advisory for mitigations.
References
- https://github.com/twigphp/Twig/commit/324fa60545694fa6abe85ded9befcb82e1066bc2
- https://github.com/twigphp/Twig/releases/tag/v3.26.0
- https://github.com/twigphp/Twig/security/advisories/GHSA-45vw-wh46-2vx8
Get alerted when CVE-2026-46640 or the next vulnerability affects your stack