Skip to main content

AngleSharp CVE-2026-54570

| EUVDEUVD-2026-61128 MEDIUM
Basic XSS (CWE-80)
2026-07-17 https://github.com/AngleSharp/AngleSharp GHSA-pgww-w46g-26qg
6.9
CVSS 3.1 · Vendor: https://github.com/AngleSharp/AngleSharp
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Attacker crafts HTML with annotation-xml encoding='text/html' and RCDATA payload
  2. Delivery
    Application passes input to AngleSharp sanitizer
  3. Exploit
    AngleSharp parser misidentifies annotation-xml namespace, misses injected element
  4. Install
    Serializer emits OuterHtml with unescaped < > in attribute values
  5. C2
    Victim browser renders serialized output
  6. Execute
    Browser applies HTML5 integration point rules, breaks attribute boundary
  7. Impact
    Injected img onerror payload executes in victim browser context

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization HTML tag escaping
MITRE ATT&CK

1 technique across 1 tactic: Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires a specific application-level pattern: the target application must use AngleSharp versions before 1.5.0 as an HTML sanitizer and subsequently pass the serialized output (e.g., OuterHtml) to a browser that re-parses it - this is the mXSS parse-serialize-reparse attack model. The injected payload must contain a MathML annotation-xml element with encoding='text/html' or encoding='application/xhtml+xml', combined with an RCDATA element (title, style, or similar) that carries unescaped angle brackets in an attribute value. User interaction is required (UI:R) because a victim browser must render the application's output. The fragment parsing code path (innerHTML setter) is additionally vulnerable because the IsFragmentCase guard disables the only partial compensating check. Applications that use AngleSharp purely for server-side DOM inspection without browser re-rendering of the serialized output are not affected by this attack path.

Impact

The CVSS 3.1 base score of 6.9 (AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N) accurately reflects the conditional nature of the attack: AC:H captures the requirement for the specific annotation-xml/RCDATA/browser-re-render chain, and S:C models the browser as the subsequent impacted system. For applications specifically using AngleSharp as an HTML sanitizer before rendering user-controlled content in a browser - a documented and common deployment pattern - the real-world risk is significantly higher than the score implies, because the attack chain is fully demonstrated with a public PoC and no special network position is required. For applications using AngleSharp purely for server-side DOM processing without browser re-rendering, this issue has no exploitable impact. No EPSS score was provided in the available data, and no CISA KEV listing was found, meaning exploitation prevalence is unconfirmed beyond PoC availability. The I:H (integrity high) and S:C (scope changed) are well-justified by the XSS impact model. No conflicting signals were identified between the CVSS vector and the vulnerability description.

Exploit ScenarioDerived

An attacker submits crafted HTML to a web application that uses AngleSharp to sanitize user content before storing and rendering it: the payload embeds a MathML annotation-xml element with encoding='text/html' containing a title element whose attribute value includes a raw </title><img src=x onerror=alert()> sequence. AngleSharp parses the input, fails to recognize the annotation-xml as an HTML integration point, never sees the img element in the DOM, and serializes what appears to be a clean document. When a victim's browser receives the serialized OuterHtml, it correctly implements the HTML5 spec, breaks the attribute boundary at </title>, and fires the onerror handler. A fully working PoC demonstrating this exact scenario is published in GHSA-pgww-w46g-26qg.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 17, 2026

Mutation XSS (mXSS) in AngleSharp versions before 1.5.0 allows sanitizer bypass through two compounding parser flaws: the MathML annotation-xml element never receives the HtmlTip flag, causing the parser to diverge from browser behavior, and the HTML serializer emits unescaped angle brackets in attribute values. Applications using AngleSharp as an HTML sanitizer before browser rendering are vulnerable - the sanitizer inspects a benign DOM while the serialized output re-parses in browsers with live XSS payloads active. A detailed public proof-of-concept is included in the upstream advisory (GHSA-pgww-w46g-26qg); no confirmed active exploitation (CISA KEV) has been identified at time of analysis.

RemediationAI

Upgrade AngleSharp to version 1.5.0 or later, which explicitly patches GHSA-pgww-w46g-26qg. The release is available via NuGet and documented at https://github.com/AngleSharp/AngleSharp/releases/tag/1.5.0. If an immediate upgrade is not feasible, the primary compensating control is to avoid the sanitize-then-re-render pattern: do not pass AngleSharp's OuterHtml serialized output directly to a browser parser. Applications performing server-side HTML sanitization should either introduce an additional serialization-safe layer or switch temporarily to a parser that correctly implements the HTML5 integration point specification. Restricting or rejecting input containing MathML annotation-xml elements at an input validation layer is a targeted workaround but may break legitimate MathML content. Note that the innerHTML setter code path is specifically more vulnerable because the IsFragmentCase guard bypasses the partial ForeignNormalTag() compensating check - fragment parsing scenarios should be treated as highest priority.

Affected VersionsENISA

AngleSharp < 1.5.0

Affected Packages

nuget anglesharp fix: 1.5.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in nuget

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

AngleSharp (pkg:nuget/anglesharp) is a .NET HTML5 parsing library commonly used for server-side HTML sanitization. The HTML5 specification designates MathML annotation-xml elements carrying encoding='text/html' or encoding='application/xhtml+xml' as HTML integration points - their content must be parsed as HTML, not MathML. Two independent defects in AngleSharp combine into an exploitable mXSS chain. First, MathAnnotationXmlElement (AngleSharp/Mathml/Dom/Internal/MathAnnotationXmlElement.cs) never sets NodeFlags.HtmlTip in its constructor, so Consume() unconditionally dispatches tokens to Foreign() mode regardless of the encoding attribute, producing a DOM namespace tree that diverges from what a conformant browser builds. A partial compensating check in ForeignNormalTag() covers only tags in AllForeignExceptions and is completely bypassed during innerHTML/fragment parsing due to an if (!IsFragmentCase) guard. Second, HtmlMarkupFormatter.WriteAttributeValue() (AngleSharp/Html/HtmlMarkupFormatter.cs) escapes ampersand, double-quote, and non-breaking space but passes raw < and > characters through to the serialized output. This violates the HTML serialization spec requirement referenced in whatwg/html issue #6235. The root cause class is CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/AngleSharp/AngleSharp) PRIMARY 6.9 MEDIUM
AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N
vuln.today AI 6.9 MEDIUM

AC:H for chained conditions requiring annotation-xml, RCDATA elements, and browser re-parse; S:C and I:H because XSS executes in the victim browser as a subsequent system.

3.1 AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N
4.0 AV:N/AC:H/AT:P/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:H/SA:N

Primary rating from Vendor (https://github.com/AngleSharp/AngleSharp).

CVSS VectorVendor: https://github.com/AngleSharp/AngleSharp

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
High
Availability
None

DescriptionCVE.org

Summary

The HTML specification requires that a MathML <annotation-xml> element with encoding="text/html" or encoding="application/xhtml+xml" is treated as an HTML integration point. Content inside it must be parsed as HTML, not MathML.

AngleSharp does not implement this correctly. As a result, the parser produces a DOM tree that differs from what a browser will build (different namespaces if encoding="text/html" is not treated) when given the same serialized output. Two bugs combine to make this exploitable:

  • Missing HtmlTip flag: MathAnnotationXmlElement is never assigned NodeFlags.HtmlTip based on its encoding attribute, so the Consume() dispatch always routes tokens to Foreign() instead of Home() (HTML mode).
  • Unescaped < > in attribute values: HtmlMarkupFormatter.WriteAttributeValue() does not escape < or > characters, only & and ". This allows injected markup to break out of attribute values on re-parse. _See [Escape "<" and ">" in attributes when serializing HTML #6235

](https://github.com/whatwg/html/issues/6235)_

Details

In MathAnnotationXmlElement (AngleSharp/Mathml/Dom/Internal/MathAnnotationXmlElement.cs):

cs
// Current - HtmlTip is never set
: base(owner, TagNames.AnnotationXml, prefix, NodeFlags.Special | NodeFlags.Scoped)

Because HtmlTip is absent, the token dispatch in Consume() always sends tokens to Foreign() when inside annotation-xml, regardless of the encoding attribute. The compensating check in ForeignNormalTag() only covers tags in AllForeignExceptions and is entirely bypassed during fragment parsing (innerHTML setter) due to an if (!IsFragmentCase) guard.

In HtmlMarkupFormatter.WriteAttributeValue() (AngleSharp/Html/HtmlMarkupFormatter.cs):

cs
// Escapes & " and \u00A0, but NOT < or >
case Symbols.Ampersand:    stringBuilder.Append("&amp;");  break;
case Symbols.NoBreakSpace: stringBuilder.Append("&nbsp;"); break;
case Symbols.DoubleQuote:  stringBuilder.Append("&quot;"); break;
default:                   stringBuilder.Append(value[i]); break; // < and > pass through raw

PoC

The following program demonstrates that AngleSharp’s parser misses the injected <img> element. A sanitizer walking this DOM would see nothing dangerous, yet the serialized output re-parses in a browser as a live <img onerror> trigger.

cs
using System;
using System.Linq;
using AngleSharp.Html.Parser;

public class Program
{
    static readonly string Payload1 =
        "<math>" +
        "<annotation-xml encoding=\"text/html\">" +
        "<title><a encoding=\"</title><img src=x onerror=alert()>\">" +
        "</annotation-xml></math>";

    public static void Main()
    {
        var parser = new HtmlParser();

        Check(parser, Payload1, "IMG",
            "AngleSharp missed <img> - VULNERABLE (mXSS via attribute serialization)",
            "AngleSharp found <img> - SAFE");
    }

    static void Check(HtmlParser parser, string html, string tag,
                      string failMsg, string passMsg)
    {
        var doc     = parser.ParseDocument(html);
        var tags    = doc.All.Select(e => e.TagName).ToHashSet();
        var found   = tags.Contains(tag);

        Console.WriteLine(found ? passMsg : failMsg);
        Console.WriteLine("Serialized output:");
        Console.WriteLine(doc.DocumentElement.OuterHtml);
    }
}

Output:

AngleSharp missed <img> - VULNERABLE (mXSS via attribute serialization)
Serialized output:
<html><head></head><body><math><annotation-xml encoding="text/html"><title><a encoding="</title><img src=x onerror=alert()>"></a></title></annotation-xml></math></body></html>

_The title tag may be swapped out for style and other RCDATA elements._

When a browser receives this string and parses annotation-xml encoding="text/html" as an HTML integration point, the </title> closes the title element and the <img> fires its onerror handler.

Impact

Implemented HTML sanitizers that depend and trust AngleSharp's ability to parse HTML correctly may be bypassable, as AngleSharp fails to acknowledge certain vectors under certain conditions.

This reduces AngleSharp's credibility as a conformant HTML parser.

Threat Intelligence Overview

EPSS Score
0.2%
Top 84% exploitable
Prevalence
Medium
popular .NET HTML parsing and sanitization library in the NuGet ecosystem
Threat Intel
1
1 source
Exploit
POC
Public exploit code exists
Social Media
1
Sightings
Data Quality
5 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC Yes
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
Poc
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

54
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +34
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy