Improper Neutralization of Special Elements Used in a Template Engine Affecting php-twig package, versions <3.27.0-1


Severity

Recommended
low

Based on default assessment until relevant scores are available.

Threat Intelligence

EPSS
0.57% (45th 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-DEBIANUNSTABLE-PHPTWIG-17089887
  • published29 May 2026
  • disclosed4 Sept 2026

Introduced: 29 May 2026

CVE-2026-46636  (opens in a new tab)
CWE-1336  (opens in a new tab)

How to fix?

Upgrade Debian:unstable php-twig to version 3.27.0-1 or higher.

NVD Description

Note: Versions mentioned in the description apply only to the upstream php-twig package and not the php-twig package as distributed by Debian. See How to fix? for Debian:unstable relevant fixed versions and status.

Twig is a template language for PHP. From version 1.0.0 to before version 3.27.0, SecurityPolicy::checkMethodAllowed() unconditionally whitelists all method calls on instances of Twig\Markup. Twig\Markup is not final, so subclasses inherit the bypass. An application that passes an object of a Markup-derived class into a sandboxed template (typically to mark a chunk of HTML as safe) inadvertently exposes every public method of that subclass to template authors, regardless of the configured allowedMethods list. This issue has been patched in version 3.27.0.