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

exploitDog

github логотип

GHSA-j92c-7v7g-gj3f

Опубликовано: 03 фев. 2026
Источник: github
Github: Прошло ревью
CVSS4: 6.3

Описание

HtmlSanitizer has a bypass via template tag

Impact

If the template tag is allowed, its contents are not sanitized. The template tag is a special tag that does not usually render its contents, unless the shadowrootmode attribute is set to open or closed.

The lack of sanitization of the template tag brings up two bypasses:

  1. it is still possible to forcibly render the contents of a &lt;template&gt; tag through mutation XSS. The DOM parsers in browsers such as Chromium have a node depth limit of 512 and tags which are beyond that depth are flattened. This in turn allows elements within &lt;template&gt; (which are not sanitized) to be effectively 'popped out'. An example would look like this: <div>[...]&lt;template&gt;<script>alert('xss')</script> where [...] denotes at least another 509 opening <div> tags.
  2. If in addition to the template tag, the shadowrootmode attribute is allowed through sanitizer.AllowedAttributes.Add("shadowrootmode");, the simple payload of <div>&lt;template shadowrootmode="open"&gt;<script>alert('xss')</script> would bypass the sanitizer. This is because such usage of &lt;template&gt; attaches a shadow root to its parent: <div>, and its contents will be rendered.

Note that the default configuration is not affected because the template tag is disallowed by default.

Patches

The problem has been patched in versions 9.0.892 and 9.1.893-beta.

Workarounds

Disallow the template tag. It is disallowed by default.

Resources

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/template

Пакеты

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

HtmlSanitizer

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

< 9.0.892

9.0.892

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

HtmlSanitizer

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

>= 9.1.878-beta, < 9.1.893-beta

9.1.893-beta

EPSS

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

6.3 Medium

CVSS4

Дефекты

CWE-116

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

nvd
3 дня назад

HtmlSanitizer is a .NET library for cleaning HTML fragments and documents from constructs that can lead to XSS attacks. Prior to versions 9.0.892 and 9.1.893-beta, if the template tag is allowed, its contents are not sanitized. The template tag is a special tag that does not usually render its contents, unless the shadowrootmode attribute is set to open or closed. This issue has been patched in versions 9.0.892 and 9.1.893-beta.

EPSS

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

6.3 Medium

CVSS4

Дефекты

CWE-116