published 20 May 2026 · updated 17 Nov 2026
Twig 2.16.x & 3.9.0-3.25.x Sandbox Bypass via SourcePolicyInterface
8.8HighCVSS 8.8EPSS 1%
No exploitation in the wild has been reported. EPSS puts the chance of exploitation in the next 30 days at 1%. Fixed in 3.26.0.
Twig versions 2.16.x and 3.9.0 through 3.25.x contain a sandbox bypass vulnerability when using a SourcePolicyInterface that allows attackers with template rendering capabilities to pass arbitrary PHP callables to sort, filter, map, and reduce filters. Attackers can exploit the runtime check that fails to use the current template source to bypass sandbox restrictions and execute arbitrary code when the sandbox is enabled through a source policy rather than globally.
Affected
Vendors, products and packages with version ranges
| Vendor | Product | Versions | Fixed |
|---|---|---|---|
| symfony | twig | >=2.16.0 <=2.16.1, >=3.9.0 <3.26.0 | 3.26.0 |
| twigphp | =2.16.0, >=3.9.0 <3.26.0 | 3.26.0 |
Timeline
Every event on this vulnerability
Embed
A live severity badge for an advisory, README or ticket