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

exploitDog

github логотип

GHSA-39q2-94rc-95cp

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

Описание

DOMPurify's ADD_TAGS function form bypasses FORBID_TAGS due to short-circuit evaluation

Summary

In src/purify.ts:1117-1123, ADD_TAGS as a function (via EXTRA_ELEMENT_HANDLING.tagCheck) bypasses FORBID_TAGS due to short-circuit evaluation.

The condition:

!(tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])

When tagCheck(tagName) returns true, the entire condition is false and the element is kept — FORBID_TAGS[tagName] is never evaluated.

Inconsistency

This contradicts the attribute-side pattern at line 1214 where FORBID_ATTR explicitly wins first:

if (FORBID_ATTR[lcName]) { continue; }

For tags, FORBID should also take precedence over ADD.

Impact

Applications using both ADD_TAGS as a function and FORBID_TAGS simultaneously get unexpected behavior — forbidden tags are allowed through. Config-dependent but a genuine logic inconsistency.

Suggested Fix

Check FORBID_TAGS before tagCheck:

if (FORBID_TAGS[tagName]) { /* remove */ } else if (tagCheck(tagName) || ALLOWED_TAGS[tagName]) { /* keep */ }

Affected Version

v3.3.3 (commit 883ac15)

Пакеты

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

dompurify

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

<= 3.3.3

3.4.0

EPSS

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

5.3 Medium

CVSS4

Дефекты

CWE-783

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

CVSS3: 6.1
ubuntu
2 месяца назад

DOMPurify before 3.4.0 contains a logic error in the ADD_TAGS function where short-circuit evaluation allows forbidden tags to bypass FORBID_TAGS restrictions. Attackers can craft input containing tags listed in FORBID_TAGS that are also added via ADD_TAGS function, causing them to be retained in sanitized output.

CVSS3: 6.1
redhat
2 месяца назад

DOMPurify before 3.4.0 contains a logic error in the ADD_TAGS function where short-circuit evaluation allows forbidden tags to bypass FORBID_TAGS restrictions. Attackers can craft input containing tags listed in FORBID_TAGS that are also added via ADD_TAGS function, causing them to be retained in sanitized output.

CVSS3: 6.1
nvd
2 месяца назад

DOMPurify before 3.4.0 contains a logic error in the ADD_TAGS function where short-circuit evaluation allows forbidden tags to bypass FORBID_TAGS restrictions. Attackers can craft input containing tags listed in FORBID_TAGS that are also added via ADD_TAGS function, causing them to be retained in sanitized output.

CVSS3: 6.1
debian
2 месяца назад

DOMPurify before 3.4.0 contains a logic error in the ADD_TAGS function ...

EPSS

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

5.3 Medium

CVSS4

Дефекты

CWE-783