CVE-2023-44390
JSON

6.1medium

HtmlSanitizer vulnerable to Cross-site Scripting in Foreign Content

Severity
6.1medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.42% (higher than 37% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-43cp-6p3q-2pc4

Description

HtmlSanitizer is a .NET library for cleaning HTML fragments and documents from constructs that can lead to XSS attacks. The vulnerability occurs in configurations where foreign content is allowed, i.e. either `svg` or `math` are in the list of allowed elements. In the case an application sanitizes user input with a vulnerable configuration, an attacker could bypass the sanitization and inject arbitrary HTML, including JavaScript code. Note that in the default configuration the vulnerability is not present. The vulnerability has been fixed in versions 8.0.723 and 8.1.722-beta (preview version).

Affected

Product or packageVersionsReported by
mganss HtmlSanitizer< 8.0.723, >= 8.1.0-beta, < 8.1.722-betaCVE List
HtmlSanitizer (NuGet)before 8.0.723, from 8.1.0-beta before 8.1.722-betaGitHub Advisory Database
htmlsanitizer_project htmlsanitizerbefore 8.0.723, 8.1.719NVD

All scores

GitHub_M6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
GitHub6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-79

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

HtmlSanitizer is a .NET library for cleaning HTML fragments and documents from constructs that can lead to XSS attacks. The vulnerability occurs in configurations where foreign content is allowed, i.e. either `svg` or `math` are in the list of allowed elements. In the case an application sanitizes user input with a vulnerable configuration, an attacker could bypass the sanitization and inject arbitrary HTML, including JavaScript code. Note that in the default configuration the vulnerability is not present. The vulnerability has been fixed in versions 8.0.723 and 8.1.722-beta (preview version).

GitHub Advisory Database
Impact

The vulnerability occurs in configurations where foreign content is allowed, i.e. either svg or math are in the list of allowed elements. Specifically, the requirements for the vulnerability are:

  1. Allowing one foreign element: svg, or math
  2. Comments or one raw text element: iframe, noembed, xmp, title, noframes, style or noscript

Configurations that meet the above requirements plus the following are vulnerable to an additional vulnerability:

  • Any HTML integration element: title, desc, mi, mo, mn, ms, mtext, annotation-xml.

In case an application sanitizes user input with a vulnerable configuration, an attacker could bypass the sanitization and inject arbitrary HTML, including JavaScript code.

Note that in the default configuration the vulnerability is not present.

Patches

The vulnerability has been fixed in versions 8.0.723 and 8.1.722-beta (preview version).

Workarounds

Disallow foreign elements svg and math. This is the case in the default configuration, which is therefore not affected by the vulnerability.

NVD (es)

HtmlSanitizer es una librería .NET para limpiar fragmentos y documentos HTML de construcciones que pueden provocar ataques XSS. La vulnerabilidad ocurre en configuraciones donde se permite contenido externo, es decir, "svg" o "math" están en la lista de elementos permitidos. En el caso de que una aplicación sanitice la entrada del usuario con una configuración vulnerable, un atacante podría eludir la sanitización e inyectar HTML arbitrario, incluido código JavaScript. Tenga en cuenta que en la configuración predeterminada la vulnerabilidad no está presente. La vulnerabilidad se ha solucionado en las versiones 8.0.723 y 8.1.722-beta (versión preliminar).

References

Sources

SourceRecordLicence
CVE ListCVE-2023-44390 changed 2024-09-19CVE Terms of Use
GitHub Advisory DatabaseGHSA-43cp-6p3q-2pc4 changed 2026-09-10CC-BY-4.0
NVDCVE-2023-44390 changed 2026-06-17Public domain