Skip to content

HtmlSanitizer vulnerable to Cross-site Scripting in Foreign Content

Moderate severity GitHub Reviewed Published Oct 4, 2023 in mganss/HtmlSanitizer • Updated Nov 9, 2023

Package

nuget HtmlSanitizer (NuGet)

Affected versions

< 8.0.723
>= 8.1.0-beta, < 8.1.722-beta

Patched versions

8.0.723
8.1.722-beta

Description

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.

References

@mganss mganss published to mganss/HtmlSanitizer Oct 4, 2023
Published to the GitHub Advisory Database Oct 4, 2023
Reviewed Oct 4, 2023
Published by the National Vulnerability Database Oct 5, 2023
Last updated Nov 9, 2023

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

EPSS score

0.050%
(20th percentile)

Weaknesses

CVE ID

CVE-2023-44390

GHSA ID

GHSA-43cp-6p3q-2pc4

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.