{"vuln_id":"CVE-2026-27942","aliases":[],"description":"fast-xml-parser allows users to validate XML, parse XML to JS object, or build XML from JS object without C/C++ based libraries and no callback. Prior to version 5.3.8, the application crashes with stack overflow when user use XML builder with `preserveOrder:true`. Version 5.3.8 fixes the issue. As a workaround, use XML builder with `preserveOrder:false` or check the input data before passing to builder.","published_at":"2026-02-26T02:16:22.357000Z","modified_at":"2026-06-17T10:27:56.887000Z","first_seen_at":"2026-11-21T19:15:20.158024Z","severity":"low","severity_source":"nvd","cvss_score":2.7,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","cwe":["CWE-120"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00535,"epss_percentile":0.46047,"nvd_status":"Analyzed","enriched_at":"2026-11-22T13:36:52.775185Z","links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-27942"},"matched_alias":null,"items":[{"id":2445,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-gh4j-gqv2-49f6 / CVE-2026-41650: fast-xml-parser XMLBuilder: XML Comment and CDATA Injection via Unescaped Delimiters","summary":"fast-xml-parser XMLBuilder: XML Comment and CDATA Injection via Unescaped Delimiters\n\n# fast-xml-parser XMLBuilder: Comment and CDATA Injection via Unescaped Delimiters\n\n## Summary\n\nfast-xml-parser v5.5.12 (latest) XMLBuilder does not escape the `-->` sequence in comment content or the `]]>` sequence in CDATA sections when building XML from JavaScript objects. This allows XML injection when user-controlled data flows into comments or CDATA elements, leading to XSS, SOAP injection, or data manipulation.\n\nExisting CVEs for fast-xml-parser cover different issues:\n- CVE-2023-26920: Prototype pollution (parser)\n- CVE-2023-34104: ReDoS (parser)\n- CVE-2026-27942: Stack overflow in XMLBuilder with preserveOrder\n- CVE-2026-25896: Entity encoding bypass via regex in DOCTYPE entities\n\nThis finding covers **unescaped comment/CDATA delimiters in XMLBuilder** - a distinct vulnerability.\n\n## Vulnerable Code\n\n**File**: `src/fxb.js`\n\n```javascript\n// Line 442 - Comment building with NO escaping of -->\nbuildTextValNode(val, key, attrStr, level) {\n// ...\nif (key === this.options.commentPropName) {\nreturn this.indentate(level) + `\n` + this.newLine; // VULNERABLE\n}\n// ...\nif (key === this.options.cdataPropName) {\nreturn this.indentate(level) + `\n` + this.newLine; // VULNERABLE\n}\n}\n```\n\nCompare with attribute/text escaping which IS properly handled via `replaceEntitiesValue()`.\n\n## Proof of Concept\n\n### Test 1: Comment Injection (XSS in SVG/HTML context)\n\n```javascript\nimport { XMLBuilder } from 'fast-xml-parser';\n\nconst builder = new XMLBuilder({\ncommentPropName: \"#comment\",\nformat: true,\nsuppressEmptyNode: true\n});\n\nconst xml = {\nroot: {\n\"#comment\": \"-->\n\nlegitimate content\n\n```\n\n### Test 2: CDATA Injection (RSS feed)\n\n```javascript\nconst builder = new XMLBuilder({\ncdataPropName: \"#cdata\",\nformat: true,\nsuppressEmptyNode: true\n});\n\nconst rss = {\nrss: { channel: { item: {\ntitle: \"Article\",\ndescription: {\n\"#cdata\": \"Content]]>\n\nArticle\n\n```\n\n### Test 3: SOAP Message Injection\n\n```javascript\nconst builder = new XMLBuilder({\ncommentPropName: \"#comment\",\nformat: true\n});\n\nconst soap = {\n\"soap:Envelope\": {\n\"soap:Body\": {\n\"#comment\": \"Request from user: -->\ndeleteAll","url":"https://github.com/advisories/GHSA-gh4j-gqv2-49f6","published_at":"2026-04-22T20:04:17Z","updated_at":"2026-11-18T00:23:52Z","fetched_at":"2026-11-21T19:15:18.416841Z","severity":"critical","cvss_score":9.3,"epss":0.01152,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"fast-xml-parser","vuln_id":"CVE-2026-41650","vuln_ids":["CVE-2023-26920","CVE-2023-34104","CVE-2026-25896","CVE-2026-27942","CVE-2026-41650","GHSA-GH4J-GQV2-49F6"],"tags":["ghsa","npm","CWE-91"],"cluster_id":2323,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2445","html":"https://vulnwatch.ve1ve2.com/item/2445"}}]}