CVE-2026-46640CWE-94

Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation

High · published July 14, 2026

CVSS v4.0
8.7
EPSS
1%
Percentile
50.2
In the wild
Unconfirmed
What it is

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.

The record
Technical detail
CVSS v4.0
8.7 · HIGH
Vector
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
EPSS
0.00642 · 50.2th percentile
Weakness
CWE-94 · Improper Control of Generation of Code ('Code Injection')
Published
2026-07-14T21:22Z
EPSS history
Timeline
  • 14 JUL 21:22Z
    Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation
    cvelistv5