Improper Encoding or Escaping of Output in Twig - CVE-2026-46637

 

Improper Encoding or Escaping of Output in Twig - CVE-2026-46637

Published: May 20, 2026


Vulnerability identifier: #VU131993
CSH Severity: Medium
CVSS v4: 5.1 [CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N]
CVE-ID: CVE-2026-46637
CWE-ID: CWE-116
Exploitation vector: Remote access
Exploit availability: No public exploit available

Vulnerability details

The vulnerability allows a remote attacker to perform cross-site scripting.

The vulnerability exists due to improper encoding or escaping of output in html-output filters in twig/markdown-extra and twig/cssinliner-extra when rendering attacker-controlled content in non-html escaping contexts. A remote attacker can supply crafted input that is processed by affected filters to perform cross-site scripting.

The issue stems from filters being incorrectly declared with is_safe => ['all'], causing Twig autoescaping to treat output as safe across contexts such as html, javascript, css, and url.


Affected software

Twig
Debian Linux
php-twig (Debian package)

How to mitigate CVE-2026-46637

Install security update from vendor's website.

Twig - update to 3.26.0
php-twig (Debian package) - update to 3.5.1-1+deb12u3

External References

Related Security Bulletins