Medium

HtmlSanitizer vulnerable to Cross-site Scripting in Foreign Content

  • Disclosed: 04.10.2023
  • Updated: 11.10.2026 11:23

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.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
.NET (NuGet) HtmlSanitizer < 8.0.723, >= 8.1.0-beta, < 8.1.722-beta 8.0.723, 8.1.722-beta

References

CVSS score 6.1/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness (CWE)
CWE-79
Platform
.NET (NuGet)
Package
HtmlSanitizer
Disclosed
04.10.2023
Updated
11.10.2026 11:23

Sources and licenses

OSV / GitHub Advisory Database - GHSA-43cp-6p3q-2pc4 - CC BY 4.0

Vulnerability history: HtmlSanitizer

All published vulnerabilities of this package (.NET (NuGet)), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
3
First → latest
01.2021 02.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Medium 2
  • Low 1

Disclosures per year

  1. 2021: 1
  2. 2022: 0
  3. 2023: 1
  4. 2024: 0
  5. 2025: 0
  6. 2026: 1
  1. Medium CVE-2026-25543 < 9.0.892, >= 9.1.878-beta, < 9.1.893-beta 9.0.892, 9.1.893-beta
  2. HtmlSanitizer vulnerable to Cross-site Scripting in Foreign Content this entry
    Medium · 6.1 CVE-2023-44390 < 8.0.723, >= 8.1.0-beta, < 8.1.722-beta 8.0.723, 8.1.722-beta
  3. Low · 6.1 CVE-2020-26293 < 5.0.372 5.0.372

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.