Microsoft.OpenApi.YamlReader vulnerable to denial of service via YAML alias expansionGHSA-7pxr-59rr-hqj2
HIGHFix: microsoft/OpenAPI.NET#3000GHSA-7pxr-59rr-hqj2 is a high-severity (CVSS 7.5) Uncontrolled Resource Consumption vulnerability in Microsoft.OpenApi.YamlReader. A fix is available for Microsoft.OpenApi.YamlReader — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-7pxr-59rr-hqj2.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
GHSA-7pxr-59rr-hqj2 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 394,803 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
Microsoft.OpenApi.YamlReader.NETMicrosoft.OpenApi.YamlReader.NETMicrosoft.OpenApi.ReadersReal-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
Impact
A small YAML OpenAPI document containing nested anchors and aliases can cause uncontrolled resource consumption in Microsoft.OpenApi.YamlReader and Microsoft.OpenApi.Readers. The issue affects OpenAPI document parsing through the public YAML reader APIs and can cause the parsing process to allocate excessive memory and terminate through out-of-memory conditions.
Affected versions
Microsoft.OpenApi.YamlReader
>= 2.0.0-preview.11, < 2.12.0>= 3.0.0, < 3.10.0
Microsoft.OpenApi.Readers
< 1.6.30
Patches
- For the 1.X major version, versions 1.6.30 and above are patched.
- For the 2.X major version, versions 2.12.0 and above are patched.
- For the 3.X major version, versions 3.10.0 and above are patched.
Impact
Applications, CLIs, developer tools, or services that parse untrusted YAML OpenAPI documents in-process may be terminated by a crafted YAML document containing nested anchors and aliases.
The impact is availability/process termination only. This report does not claim remote code execution, authentication bypass, credential exposure, privilege escalation, data exposure, or Microsoft hosted service impact.
Details
Microsoft.OpenApi.YamlReader and Microsoft.OpenApi.Readers parses YAML through SharpYaml. SharpYaml represents aliases as shared YamlNode instances in a directed acyclic graph, so the initial parsed YAML graph remains small. During conversion to System.Text.Json.Nodes.JsonNode, aliases must be materialized as independent nodes because JsonNode instances cannot be attached to multiple parents.
Without a bound on that conversion work, a small YAML document using nested anchors and aliases can expand exponentially during conversion. With N nested anchors each referenced k times, conversion can require k^N materialized JSON nodes, leading to excessive memory allocation and possible process termination.
This is an uncontrolled resource consumption vulnerability, also known as a "billion laughs" style denial of service.
Example payload
openapi: 3.0.0
info:
title: Test
version: 0.0.1
paths: {}
x-a: &a ["lol", "lol", "lol", "lol", "lol", "lol", "lol", "lol", "lol"]
x-b: &b [*a, *a, *a, *a, *a, *a, *a, *a, *a]
x-c: &c [*b, *b, *b, *b, *b, *b, *b, *b, *b]
x-d: &d [*c, *c, *c, *c, *c, *c, *c, *c, *c]
x-e: &e [*d, *d, *d, *d, *d, *d, *d, *d, *d]
x-f: &f [*e, *e, *e, *e, *e, *e, *e, *e, *e]
Remediation
Users should upgrade to Microsoft.OpenApi.YamlReader 2.12.0 or 3.10.0, or Microsoft.OpenApi.Readers 1.6.30, depending on the major version line they consume.
The patched versions bound YAML-to-JSON conversion work and fail fast instead of allowing unbounded expansion. The default limits are:
- Maximum materialized node count:
5,000,000 - Maximum nesting depth:
64
When the limits are exceeded, OpenApiYamlReader.Read reports an OpenApiDiagnostic error and does not return a parsed document.
The limits are exposed as process-wide static properties on YamlConverter for consumers that need to tune them for trusted workloads:
YamlConverter.MaxNodeCountYamlConverter.MaxDepth
Applications that parse OpenAPI documents from untrusted sources should avoid parsing those documents in the primary application process when possible. Running parsing in an isolated process can reduce the blast radius of parser failures.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| .NETNuGet | Microsoft.OpenApi.YamlReader | ≥ 3.0.0&&< 3.10.0 | 3.10.0dotnet add package Microsoft.OpenApi.YamlReader --version 3.10.0 |
| .NETNuGet | Microsoft.OpenApi.YamlReader | ≥ 2.0.0-preview.11&&< 2.12.0 | 2.12.0dotnet add package Microsoft.OpenApi.YamlReader --version 2.12.0 |
| .NETNuGet | Microsoft.OpenApi.Readers | all versions | 1.6.30dotnet add package Microsoft.OpenApi.Readers --version 1.6.30 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for Microsoft.OpenApi.YamlReader, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update Microsoft.OpenApi.YamlReader to 3.10.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-7pxr-59rr-hqj2 is resolved across your whole dependency graph.
Workarounds
Close the privilege gap rather than the entry point: audit which accounts, roles and service identities can reach the affected operation, drop the component to the least privilege it actually needs, and review file and directory permissions created by earlier installs — a default left in place is what makes this reachable.
Frequently Asked Questions
Is GHSA-7pxr-59rr-hqj2 in your dependencies?
Find it across NuGet, including transitive dependencies.