Patch transitive fast-xml-parser to 5.3.5 for CVE-2026-25896 (GHSA-m7jm-9gc2-mpf2)#229
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix fast-xml-parser entity encoding bypass vulnerability
Patch transitive fast-xml-parser to 5.3.5 for CVE-2026-25896 (GHSA-m7jm-9gc2-mpf2)
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fast-xml-parser< 5.3.5 allows entity-encoding bypass via regex injection in DOCTYPE entity names, enabling shadowing of built-in entities and downstream injection risk. This repository resolvedfast-xml-parser@5.2.5transitively via AWS SDK internals, which leaves the vulnerable path present in shipped dependencies.Dependency remediation
@aws-sdk/xml-builder > fast-xml-parserto the minimum patched version5.3.5.pnpm-lock.yamlaccordingly so AWS SDK XML builder no longer resolvesfast-xml-parser@5.2.5.Reachability assessment
XMLParserentity processing) is used in repo code:src/utils/xml.tsconstructsnew XMLParser(...).src/core/tools/askFollowupQuestionTool.tscallsparseXml(...)on follow-up XML payloads.What changed (snippet)
{ "pnpm": { "overrides": { "@aws-sdk/xml-builder>fast-xml-parser": "5.3.5" } } }Original prompt
This section details the Dependabot vulnerability alert you should resolve
<alert_title>fast-xml-parser has an entity encoding bypass via regex injection in DOCTYPE entity names</alert_title>
<alert_description># Entity encoding bypass via regex injection in DOCTYPE entity names
Summary
A dot (
.) in a DOCTYPE entity name is treated as a regex wildcard during entity replacement, allowing an attacker to shadow built-in XML entities (<,>,&,",') with arbitrary values. This bypasses entity encoding and leads to XSS when parsed output is rendered.Details
The fix for CVE-2023-34104 addressed some regex metacharacters in entity names but missed
.(period), which is valid in XML names per the W3C spec.In
DocTypeReader.js, entity names are passed directly toRegExp():An entity named
l.produces the regex/&l.;/gwhere.matches any character, including thetin<. Since DOCTYPE entities are replaced before built-in entities, this shadows<entirely.The same issue exists in
OrderedObjParser.js:81(addExternalEntities), and in the v6 codebase -EntitiesParser.jshas avalidateEntityNamefunction with a character blacklist, but.is not included:Shadowing all 5 built-in entities
l./&l.;/g<g./&g.;/g>am./&am.;/g&quo./&quo.;/g"apo./&apo.;/g'PoC
No special parser options needed -
processEntities: trueis the default.When an app renders
result.root.textin a page (e.g.innerHTML, template interpolation, SSR), the injected<img onerror>fires.&can be shadowed too:Impact
This is a complete bypass of XML entity encoding. Any application that parses untrusted XML and uses the output in HTML, SQL, or other injection-sensitive contexts is affected.
</>/&/"/'with arbitrary stringsSuggested fix
Escape regex metacharacters before constructing the replacement regex:
For v6, add
.to the blacklist invalidateEntityName:Severity
CWE-185 (Incorrect Regular Expression)
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:N - 9.3 (CRITICAL)
Entity decoding is a fundamental trust boundary in XML processing. This completely undermines it with no preconditions.</alert_description>
critical
https://github.com/NaturalIntelligence/fast-xml-parser/security/advisories/GHSA-m7jm-9gc2-mpf2 https://github.com/NaturalIntelligence/fast-xml-parser/commit/943ef0eb1b2d3284e72dd74f44a042ee9f07026e https://github.com/NaturalIntelligence/fast-xml-parser/commit/ddcd0acf26ddd682cb0dc15a2bd6aa3b96bb1e69 https://github.com/NaturalIntelligence/fast-xml-parser/releases/tag/v5.3.5 https://nvd.nist.gov/vuln/detail/CVE-2026-25896 https://github.com/advisories/GHSA-m7jm-9gc2-mpf2GHSA-m7jm-9gc2-mpf2, CVE-2026-25896
fast-xml-parser
npm
<vulnerable_versions>5.2.5</vulnerable_versions>
<patched_version>5.3.5</patched_version>
<manifest_path>pnpm-lock.yaml</manifest_path>
<agent_instructions>Please resolve this any way you can</agent_instructions>
<task_instructions>Resolve this alert by updating the affected package to a non-vulnerable version. Prefer the lowest non-vulnerable version (see the patched_version field above) over the latest to minimize breaking changes. Include a Reachability Assessment section in the PR description. Review the alert_description field to understand which APIs, features, or configurations are affected, then se...