Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2026-25543: CWE-116: Improper Encoding or Escaping of Output in mganss HtmlSanitizer

0
Medium
VulnerabilityCVE-2026-25543cvecve-2026-25543cwe-116
Published: Wed Feb 04 2026 (02/04/2026, 21:45:25 UTC)
Source: CVE Database V5
Vendor/Project: mganss
Product: HtmlSanitizer

Description

HtmlSanitizer is a .NET library for cleaning HTML fragments and documents from constructs that can lead to XSS attacks. Prior to versions 9.0.892 and 9.1.893-beta, 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. This issue has been patched in versions 9.0.892 and 9.1.893-beta.

AI-Powered Analysis

AILast updated: 02/04/2026, 22:15:12 UTC

Technical Analysis

CVE-2026-25543 is a vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) affecting the mganss HtmlSanitizer library, a widely used .NET component designed to clean HTML fragments and documents to prevent XSS attacks. The flaw exists in versions prior to 9.0.892 and 9.1.893-beta, where if the <template> HTML tag is allowed by the sanitizer configuration, its contents are not sanitized. The <template> tag is unique in that its contents do not render directly in the DOM unless the shadowrootmode attribute is set to 'open' or 'closed', which activates the shadow DOM and can cause the embedded scripts or malicious content to execute. Because the sanitizer fails to clean the inner content of this tag, attackers can inject malicious scripts that bypass the sanitization process, leading to potential XSS attacks. The vulnerability does not require authentication or user interaction and can be exploited remotely by submitting crafted HTML content to applications using vulnerable versions of HtmlSanitizer. The issue has been addressed in versions 9.0.892 and 9.1.893-beta by ensuring proper sanitization of the <template> tag contents. The CVSS 4.0 base score is 6.3, indicating a medium severity with network attack vector, low attack complexity, no privileges required, and no user interaction needed. No known exploits have been reported in the wild, but the risk remains significant for applications that rely on HtmlSanitizer to clean untrusted HTML input.

Potential Impact

For European organizations, this vulnerability poses a risk primarily to web applications that incorporate user-generated or third-party HTML content and rely on the mganss HtmlSanitizer library for sanitization. Successful exploitation can lead to cross-site scripting (XSS) attacks, which may result in session hijacking, credential theft, unauthorized actions on behalf of users, or distribution of malware. This compromises confidentiality and integrity of user data and can damage organizational reputation. The vulnerability's exploitation does not require user interaction or authentication, increasing the risk of automated or large-scale attacks. Organizations in sectors such as finance, healthcare, and government, which handle sensitive data and have strict compliance requirements under GDPR, may face regulatory and legal consequences if exploited. Additionally, the presence of the shadow DOM feature in modern browsers increases the attack surface, making this vulnerability relevant in contemporary web environments. The medium severity score reflects a moderate but non-negligible threat that should be addressed promptly to prevent potential exploitation.

Mitigation Recommendations

To mitigate this vulnerability, organizations should immediately upgrade all instances of mganss HtmlSanitizer to version 9.0.892 or later, or 9.1.893-beta or later, where the issue is patched. Review and audit all web applications that sanitize HTML content to identify usage of the <template> tag and ensure it is either disallowed or properly sanitized. Implement strict Content Security Policies (CSP) to restrict script execution and reduce the impact of potential XSS attacks. Conduct thorough input validation and output encoding beyond relying solely on HtmlSanitizer, especially for user-generated content. Monitor web application logs and security alerts for unusual activity that may indicate attempted exploitation. Educate developers about the risks associated with the <template> tag and shadow DOM features in the context of sanitization. Finally, consider employing runtime application self-protection (RASP) or web application firewalls (WAF) with rules tailored to detect and block XSS payloads targeting this vulnerability.

Need more detailed analysis?Upgrade to Pro Console

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-02-02T19:59:47.375Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 6983c169f9fa50a62faf7afd

Added to database: 2/4/2026, 10:00:09 PM

Last enriched: 2/4/2026, 10:15:12 PM

Last updated: 2/7/2026, 2:50:17 AM

Views: 38

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats