Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-4j38-f5cw-54h7

Опубликовано: 21 мая 2026
Источник: github
Github: Прошло ревью
CVSS4: 1.3

Описание

Twig: The spaceless filter implicitly marks its output as safe

Description

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:

{% 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.

Resolution

The spaceless filter no longer marks its output as safe. Documentation has been updated to warn that spaceless should not be applied to unsanitised user input.

Credits

Twig would like to thank Pierre Rudloff for reporting the issue.

Пакеты

Наименование

twig/twig

composer
Затронутые версииВерсия исправления

< 3.26.0

3.26.0

EPSS

Процентиль: 7%
0.00169
Низкий

1.3 Low

CVSS4

Дефекты

CWE-116

Связанные уязвимости

CVSS3: 5.4
ubuntu
28 дней назад

Twig is a template language for PHP. Prior to 3.26.0, the deprecated spaceless filter is registered as safe for HTML, causing Twig autoescaping to emit attacker-controlled markup unescaped when spaceless is applied to untrusted input. This issue is fixed in version 3.26.0.

CVSS3: 5.4
nvd
28 дней назад

Twig is a template language for PHP. Prior to 3.26.0, the deprecated spaceless filter is registered as safe for HTML, causing Twig autoescaping to emit attacker-controlled markup unescaped when spaceless is applied to untrusted input. This issue is fixed in version 3.26.0.

CVSS3: 5.4
debian
28 дней назад

Twig is a template language for PHP. Prior to 3.26.0, the deprecated s ...

EPSS

Процентиль: 7%
0.00169
Низкий

1.3 Low

CVSS4

Дефекты

CWE-116