{"id":"CVE-2026-137198","aliases":["GHSA-m6qr-m48x-3xhh"],"url":"https://o3.security/vulnerability/CVE-2026-137198","summary":"cross-spawn: Argument injection on Windows via backslashes before a double quote","details":"### Impact\n\nOn Windows, when `cross-spawn` runs a command through `cmd.exe`, it quotes each argument and doubles the backslashes that precede a double quote or the end of the argument, so that they aren't taken as escaping the quote.\n\nSince `7.0.4`, `7.0.5` and `6.0.6`, which changed the regular expressions to fix a ReDoS vulnerability (GHSA-3xgq-45jj-v275), backslash runs weren't doubled correctly: `7.0.4` didn't double them at all, and `7.0.5`, `7.0.6` and `6.0.6` added only one backslash to each run. An argument with two or more backslashes before a double quote, or at its end, had its closing quote escaped, which let it split into extra arguments or swallow the next ones:\n\n```js\nconst spawn = require('cross-spawn');\n\n// On Windows, the program received two arguments: `x\\\\` and `--evil`\nspawn.sync('foo.cmd', ['x\\\\\\\\\" --evil']);\n```\n\nThe caller can't tell: the command still exits successfully and nothing is written to stderr. Even an ordinary directory path such as `C:\\some\\dir\\\\` makes the caller's following arguments disappear.\n\nApplications are affected if they pass untrusted input as arguments to a command that runs through `cmd.exe` on Windows, which includes every npm cmd-shim in `node_modules/.bin`. The impact depends on the program: one that accepts extra arguments may act on the injected ones, e.g. a tool called with `--check` receiving an injected `--write`, while one that rejects an unexpected argument fails instead. This doesn't allow running other commands. Other platforms aren't affected.\n\n### Patches\n\nThis is fixed in `7.1.0` and `6.0.7`, which escape backslashes with a loop that handles any number of them in linear time.\n\n### Workarounds\n\nValidate untrusted input so that only a safe subset is allowed.\n\n### Credits\n\nMOXY Studio thanks Duong Bui Thai ([LinkedIn](https://www.linkedin.com/in/thaiducng/)) for privately reporting this vulnerability, and both @trackoor and @ogffx for independently reporting and fixing it in #188 and #190.","published":"2026-11-30T20:36:20.211Z","modified":"2026-12-02T20:45:43.496538048Z","cvss":null,"epss":{"score":0.00562,"percentile":0.48129,"asOf":"2026-12-02"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"npm","name":"cross-spawn","fixedVersion":"7.1.0"},{"ecosystem":"npm","name":"cross-spawn","fixedVersion":"6.0.7"}],"fix":{"url":"https://github.com/moxystudio/node-cross-spawn/commit/1b71aa519a2e4f97d1f3ee27f0e2fc24ba17cf1a","label":"moxystudio/node-cross-spawn@1b71aa5"},"references":[{"type":"WEB","url":"https://github.com/moxystudio/node-cross-spawn/releases/tag/v6.0.7"},{"type":"WEB","url":"https://github.com/moxystudio/node-cross-spawn/releases/tag/v7.1.0"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/137xxx/CVE-2026-137198.json"},{"type":"ADVISORY","url":"https://github.com/moxystudio/node-cross-spawn/security/advisories/GHSA-m6qr-m48x-3xhh"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-137198"},{"type":"FIX","url":"https://github.com/moxystudio/node-cross-spawn/commit/1b71aa519a2e4f97d1f3ee27f0e2fc24ba17cf1a"},{"type":"FIX","url":"https://github.com/moxystudio/node-cross-spawn/commit/244ffeaa8473de0080c93ebbf779bb953b94114b"},{"type":"FIX","url":"https://github.com/moxystudio/node-cross-spawn/pull/191"},{"type":"FIX","url":"https://github.com/moxystudio/node-cross-spawn/pull/192"},{"type":"WEB","url":"https://github.com/moxystudio/node-cross-spawn/issues/188"},{"type":"WEB","url":"https://github.com/moxystudio/node-cross-spawn/pull/160"},{"type":"WEB","url":"https://github.com/moxystudio/node-cross-spawn/pull/162"},{"type":"PACKAGE","url":"https://github.com/moxystudio/node-cross-spawn"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-12-02T20:45:43.496538048Z"}}