Protection Mechanism Failure in Twig - CVE-2026-24425
Published: May 20, 2026
Vulnerability details
The vulnerability allows a remote user to execute arbitrary code.
The vulnerability exists due to protection mechanism failure in callback-accepting filters when processing user-controlled templates in sandbox mode enabled through a source policy. A remote user can supply a non-Closure callback to execute arbitrary code.
The issue affects the sort, filter, map, and reduce filters only when the sandbox is not enabled globally and a SourcePolicyInterface enables sandboxing for the rendered template.
Affected software
Ubuntu
php-twig (Ubuntu package)
How to mitigate CVE-2026-24425
php-twig (Ubuntu package) - update to 3.23.0-2ubuntu0.1~esm1