Improper Validation of Specified Index, Position, or Offset in Input Affecting twig/twig package, versions <3.27.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.37% (30th 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 IDSNYK-PHP-TWIGTWIG-17057204
  • published29 May 2026
  • disclosed27 May 2026
  • creditVincent55 Yang, Fabien Potencier

Introduced: 27 May 2026

CVE-2026-48807  (opens in a new tab)
CWE-1285  (opens in a new tab)

How to fix?

Upgrade twig/twig to version 3.27.0 or higher.

Overview

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

Affected versions of this package are vulnerable to Improper Validation of Specified Index, Position, or Offset in Input in the SandboxNodeVisitor that allows __toString() policy bypass via Traversable in join/replace filters and via the in/not in operators. An attacker can call disallowed methods within a sandbox environment.

CVSS Base Scores

version 4.0
version 3.1