CVE-2026-24425

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

Published May 20, 2026 CVSS 4.0 · 8.7 High EPSS < 1% KEV · Not listed
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.

Remediation

No solution or workaround provided in the CVE record

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DSA Debian DSA DSA-6311-1 php-twig security update
Github GHSA Github GHSA GHSA-2q52-x2ff-qgfr Twig: Possible sandbox bypass when using a source policy
Ubuntu USN Ubuntu USN USN-8408-1 Twig vulnerability
History
Type Values Removed Values Added
CPEs cpe:2.3:a:symfony:twig:2.16.\*:*:*:*:*:*:*:*
Type Values Removed Values Added
First Time appeared Symfony
Symfony twig
CPEs cpe:2.3:a:symfony:twig:*:*:*:*:*:*:*:*
Vendors & Products Symfony
Symfony twig
Type Values Removed Values Added
First Time appeared Twigphp
Twigphp twig
Vendors & Products Twigphp
Twigphp twig
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
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.
Title Twig 2.16.x & 3.9.0-3.25.x Sandbox Bypass via SourcePolicyInterface
Weaknesses CWE-693
References
Metrics cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 8.7, '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'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
VulnCheck
Published
Updated
Nov 8, 2026, 2:01 PM
Reserved
Jan 22, 2026, 8:23 PM
Status
Analyzed
Published
May 20, 2026, 2:16 PM
Modified
Oct 8, 2026, 4:17 PM