CVE-2026-24425 PUBLISHED

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

Assigner: VulnCheck
Reserved: 22.01.2026 Published: 20.05.2026 Updated: 20.05.2026

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.

Metrics

CVSS 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
CVSS Score: 8.7

Product Status

Vendor twigphp
Product Twig
Versions Default: affected
  • affected from 3.9.0 to 3.26.0 (excl.)
  • Version 2.16.* is affected

Credits

  • Nicolò Ribaudo finder
  • Fabien Potencier remediation developer
  • VulnCheck coordinator

References

Problem Types

  • CWE-693 Protection Mechanism Failure CWE