---
id: "CVE-2026-116538"
kind: "vulnerability"
aliases: ["CVE-2026-116538"]
title: "HtmlSanitizer: DOM sanitizer skips html and body attributes, allowing script injection"
severity: "medium"
cvss: 4.7
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["dotnet", "html-sanitizer", "nuget", "package"]
not_affected_if: ["does-not-use-sanitizedom", "no-untrusted-html"]
published_at: "2026-10-26T16:17:19+00:00"
first_seen_at: "2026-10-26T16:31:01+00:00"
updated_at: "2026-10-26T16:33:02+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-116538", "first_seen_at": "2026-10-26T16:31:01+00:00"}]
---

# HtmlSanitizer: DOM sanitizer skips html and body attributes, allowing script injection

HtmlSanitizer's SanitizeDom(string) method does not sanitize attributes on the html and body wrapper elements. An attacker can supply input with a second body or html tag carrying event handlers such as onload, which runs script when the application renders the serialized document or body outer HTML.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check the installed HtmlSanitizer package version in your project file or lock file (for example `dotnet list package` for NuGet projects).
- Find code that calls `SanitizeDom(string)` and then renders the result with document or body outer HTML.

## Fix

- Upgrade HtmlSanitizer to `9.2.1039` or later on the 9.x line, or to `10.0.1037-beta` or later on the 10.0 prerelease line.

## Timeline

- 2026-10-26T16:31:01+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-116538

## From the sources

HtmlSanitizer before 9.2.1039 and 10.0 prereleases before 10.0.1037-beta contains a cross-site scripting vulnerability because SanitizeDom(string) never sanitizes attributes on the html and body wrapper elements. Attackers can supply input with a second body or html tag carrying event handlers like onload, executing script when applications render serialized document or body outer HTML.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
