Skip to content

Update dependency HtmlSanitizer to v9 [SECURITY]#111

Open
renovate[bot] wants to merge 1 commit intomasterfrom
renovate/nuget-htmlsanitizer-vulnerability
Open

Update dependency HtmlSanitizer to v9 [SECURITY]#111
renovate[bot] wants to merge 1 commit intomasterfrom
renovate/nuget-htmlsanitizer-vulnerability

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Aug 6, 2024

This PR contains the following updates:

Package Change Age Confidence
HtmlSanitizer 8.0.6459.0.892 age confidence

GitHub Vulnerability Alerts

CVE-2023-44390

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.

CVE-2026-25543

Impact

If the template tag is allowed, its contents are not sanitized. The template tag is a special tag that does not usually render its contents, unless the shadowrootmode attribute is set to open or closed.

The lack of sanitization of the template tag brings up two bypasses:

  1. it is still possible to forcibly render the contents of a <template> tag through mutation XSS. The DOM parsers in browsers such as Chromium have a node depth limit of 512 and tags which are beyond that depth are flattened. This in turn allows elements within <template> (which are not sanitized) to be effectively 'popped out'. An example would look like this: <div>[...]<template><script>alert('xss')</script> where [...] denotes at least another 509 opening <div> tags.
  2. If in addition to the template tag, the shadowrootmode attribute is allowed through sanitizer.AllowedAttributes.Add("shadowrootmode");, the simple payload of <div><template shadowrootmode="open"><script>alert('xss')</script> would bypass the sanitizer. This is because such usage of <template> attaches a shadow root to its parent: <div>, and its contents will be rendered.

Note that the default configuration is not affected because the template tag is disallowed by default.

Patches

The problem has been patched in versions 9.0.892 and 9.1.893-beta.

Workarounds

Disallow the template tag. It is disallowed by default.

Resources

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/template


Release Notes

mganss/HtmlSanitizer (HtmlSanitizer)

v9.0.892: 9.0.892

Sanitize contents of template tag

v9.0.889: 9.0.889

Update NuGet packages

v9.0.886: 9.0.886

Target net47 (fixes #​580)

v9.0.884: 9.0.884

#​574

v9.0.881: 9.0.881

#​572
#​573

v9.0.876: 9.0.876

#​565

v9.0.873: 9.0.873

Add FilterUrl to IHtmlSanitizer (fixes #​565)

v8.1.870: 8.1.870

#​556

v8.0.865: 8.0.865

#​542

v8.0.843: 8.0.843

Add package README file

v8.0.838: 8.0.838

Create customizable comment encoding method (fixes #​525)

v8.0.811: 8.0.811

Merge pull request #​516 from jerriep/allow-overriding-literal-text-element-encoding

v8.0.795: 8.0.795

See #​494

v8.0.746: 8.0.746

Fix #​483

v8.0.744: 8.0.744

Fix #​483

v8.0.723: 8.0.723

Fix for GHSA-43cp-6p3q-2pc4

v8.0.718: 8.0.718

Fix #​469

v8.0.692: 8.0.692

Fixes a bug in CSS url() sanitizing (see #​411)


Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot changed the title Update dependency HtmlSanitizer to v8.0.723 [SECURITY] Update dependency HtmlSanitizer to 8.0.723 [SECURITY] Aug 28, 2024
@renovate renovate bot changed the title Update dependency HtmlSanitizer to 8.0.723 [SECURITY] Update dependency HtmlSanitizer to 8.0.723 [SECURITY] - autoclosed Dec 15, 2025
@renovate renovate bot closed this Dec 15, 2025
@renovate renovate bot deleted the renovate/nuget-htmlsanitizer-vulnerability branch December 15, 2025 17:07
@renovate renovate bot changed the title Update dependency HtmlSanitizer to 8.0.723 [SECURITY] - autoclosed Update dependency HtmlSanitizer to 8.0.723 [SECURITY] Dec 15, 2025
@renovate renovate bot reopened this Dec 15, 2025
@renovate renovate bot force-pushed the renovate/nuget-htmlsanitizer-vulnerability branch 2 times, most recently from b69e121 to 6e1d663 Compare December 15, 2025 21:36
@renovate renovate bot changed the title Update dependency HtmlSanitizer to 8.0.723 [SECURITY] Update dependency HtmlSanitizer to v9 [SECURITY] Feb 3, 2026
@renovate renovate bot force-pushed the renovate/nuget-htmlsanitizer-vulnerability branch from 6e1d663 to f5ae138 Compare February 3, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants