Incorrect Authorization Affecting twig/twig package, versions >=3.9.0, <3.26.0


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.76% (52nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Incorrect Authorization vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PHP-TWIGTWIG-16776817
  • published20 May 2026
  • disclosed20 May 2026
  • creditWade Sparks

Introduced: 20 May 2026

CVE-2026-24425  (opens in a new tab)
CWE-863  (opens in a new tab)

How to fix?

Upgrade twig/twig to version 3.26.0 or higher.

Overview

twig/twig is a flexible, fast, and secure template language for PHP.

Affected versions of this package are vulnerable to Incorrect Authorization via callback validation for the sort, filter, map, and reduce filters when sandboxing is enabled through SourcePolicyInterface. An attacker can bypass the sandbox callback restrictions by supplying arbitrary PHP callables instead of Closure objects, as the runtime sandbox check fails to use the current template Source and can incorrectly treat sandboxed execution as non-sandboxed.

Note: This is only exploitable if all of these conditions are met:

  1. Sandbox is not enabled globally.

  2. Sandbox is enabled through SourcePolicyInterface.

  3. The template uses the sort, filter, map, or reduce filters.

  4. The callback is not a Closure.

CVSS Base Scores

version 4.0
version 3.1