Skip to content
OpenAdvisories
High · 8.8 CVE-2026-24425 EUVD-2026-31113GHSA-2q52-x2ff-qgfr

Twig 2.16.x & 3.9.0-3.25.x Sandbox Bypass via SourcePolicyInterface

Published May 20, 2026 · Updated Nov 8, 2026 · Assigned by VulnCheck

Description

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 products

VendorProductAffectedFixed
twigphp Twig 3.9.0 – < 3.26.0, 2.16.* 3.26.0

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 php-twig 3.26.0-1 —
Debian 13 php-twig 3.27.0-0+deb13u1 —
ReleasePackageFixed inAdvisory
Ubuntu 25.10 php-twig No fix yet —
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 26.04 LTS php-twig 3.23.0-2ubuntu0.1~esm1 USN-8408-1

Affected packages

EcosystemPackageAffectedFixedRecord
Packagist twig/twig >= 2.16.0, <= 2.16.1 — GHSA-2q52-x2ff-qgfr
Packagist twig/twig >= 3.9.0, < 3.26.0 3.26.0 GHSA-2q52-x2ff-qgfr

Advisories 1

References