CVE-2026-46640 json
Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation
published 2026-05-21 5 mo ago modified 2026-10-24 15 d ago also GHSA-45vw-wh46-2vx8 , EUVD-2026-44569
- cvss
- 8.8
- version 3.1, NVD
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.6%
- EPSS 0.6% chance of exploitation in 30 days, percentile 51%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- packagist twig/twig 3.26.0
- symfony twig 3.26.0
- php-twig Debian 13 3.27.0-0+deb13u1
- php-twig Debian 14 3.26.0-1
debian advisories DEBIAN-CVE-2026-46640
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2026-46640 updated cvss 9.9
twig/twig: Twig: Arbitrary code execution via improper handling of dynamic attributes
-
Red Hat All currently supported Red Hat productsnot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- total
- Assessed
- 3 mo ago
Exploit prediction
0.64% chance of exploitation in the next 30 days, higher than 51% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 4.0 | 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 |
| CNA | 4.0 | 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 |
| NVD | 3.1 | 8.8 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| packagist | twig/twig | >=3.15.0, <3.26.0 |
3.26.0 |
Affected products
- twigphp Twig
Classification
- Weakness
-
- CWE-94 Improper Control of Generation of Code
References
-
github.com
/twigphp/Twig/commit/324fa60545694fa6abe85ded9befcb82e1066bc2
patch
-
github.com
/twigphp/Twig/security/advisories/GHSA-45vw-wh46-2vx8
web, vendor-advisory
-
github.com
/twigphp/Twig/releases/tag/v3.26.0
release-notes
-
github.com
/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2026-46640.yaml
web
-
github.com
/twigphp/Twig
package
-
github.com
/vladko312/extras/blob/main/CVE-2026-46640.py
web
-
symfony.com
/cve-2026-46640
web
Sources
- CVE List CVE-2026-46640
- GitHub Advisory GHSA-45vw-wh46-2vx8
- NVD CVE-2026-46640
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.