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 package | Versions | Reported by |
|---|---|---|
| mganss HtmlSanitizer | < 8.0.723, >= 8.1.0-beta, < 8.1.722-beta | CVE List |
| HtmlSanitizer (NuGet) | before 8.0.723, from 8.1.0-beta before 8.1.722-beta | GitHub Advisory Database |
| htmlsanitizer_project htmlsanitizer | before 8.0.723, 8.1.719 | NVD |
All scores
| GitHub_M | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| GitHub | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| NVD | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
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:
- Allowing one foreign element:
svg, ormath - Comments or one raw text element:
iframe,noembed,xmp,title,noframes,styleornoscript
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
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-44390 changed 2024-09-19 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-43cp-6p3q-2pc4 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2023-44390 changed 2026-06-17 | Public domain |