CVE-2026-46628
Medium · 5.4Twig: The `spaceless` filter implicitly marks its output as safe
CVSS
5.4
EPSS
0.3%
Published
May 21, 2026
CISA due date
—
The record
The `spaceless` filter is registered with `is_safe => ['html']`, which means Twig's autoescaper does not escape its output in an HTML context. As a result, applying `spaceless` to attacker-controlled input that contains markup emits the markup unescaped even when the developer never wrote `|raw` and autoescape is enabled. Example: ```twig {% set payload = '<script>alert()</script>' %} {{ payload }} {# escaped #} {{ payload|spaceless }} {# not escaped #} ``` The filter is deprecated but still functional. With the deprecation, some downstream projects (e.g. Drupal modules) have duplicated the filter and inherited the same `is_safe` flag.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|
Related vulnerabilities
- CVE-2026-113732 virtualenv is a tool for creating isolated virtual python environments. CWE-116
- CVE-2026-113726 virtualenv is a tool for creating isolated virtual python environments. CWE-116
- CVE-2026-113725 virtualenv is a tool for creating isolated virtual python environments. CWE-116
- CVE-2026-104250 The unstructured library provides open-source components for ingesting and pre-processing… CWE-116
- CVE-2026-107823 MariaDB server is a community developed fork of MySQL server. CWE-116
- CVE-2026-106444 Handlebars provides the power necessary to let users build semantic templates. CWE-116
- CVE-2026-77404 RabbitMQ amqp091-go is a Go AMQP 0.9.1 client. CWE-116
- CVE-2026-88060 Angular is a development platform for building mobile and desktop web applications using… CWE-116