GHSA-M6QR-M48X-3XHH

Vulnerability from github – Published: 2026-12-04 00:14 – Updated: 2026-12-04 00:14
VLAI
Summary
cross-spawn: Argument injection on Windows via backslashes before a double quote
Details

Impact

On 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.

Since 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:

const spawn = require('cross-spawn');

// On Windows, the program received two arguments: `x\\` and `--evil`
spawn.sync('foo.cmd', ['x\\\\" --evil']);

The 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.

Applications 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.

Patches

This 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.

Workarounds

Validate untrusted input so that only a safe subset is allowed.

Credits

MOXY Studio thanks Duong Bui Thai (LinkedIn) for privately reporting this vulnerability, and both @trackoor and @ogffx for independently reporting and fixing it in #188 and #190.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "cross-spawn"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "7.0.4"
            },
            {
              "fixed": "7.1.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "npm",
        "name": "cross-spawn"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "6.0.6"
            },
            {
              "fixed": "6.0.7"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "6.0.6"
      ]
    }
  ],
  "aliases": [
    "CVE-2026-137198"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-88"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-12-04T00:14:09Z",
    "nvd_published_at": "2026-11-30T21:17:25Z",
    "severity": "HIGH"
  },
  "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\u0027t 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\u0027t doubled correctly: `7.0.4` didn\u0027t 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(\u0027cross-spawn\u0027);\n\n// On Windows, the program received two arguments: `x\\\\` and `--evil`\nspawn.sync(\u0027foo.cmd\u0027, [\u0027x\\\\\\\\\" --evil\u0027]);\n```\n\nThe caller can\u0027t 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\u0027s 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\u0027t allow running other commands. Other platforms aren\u0027t 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.",
  "id": "GHSA-m6qr-m48x-3xhh",
  "modified": "2026-12-04T00:14:09Z",
  "published": "2026-12-04T00:14:09Z",
  "references": [
    {
      "type": "WEB",
      "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": "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": "WEB",
      "url": "https://github.com/moxystudio/node-cross-spawn/pull/191"
    },
    {
      "type": "WEB",
      "url": "https://github.com/moxystudio/node-cross-spawn/pull/192"
    },
    {
      "type": "WEB",
      "url": "https://github.com/moxystudio/node-cross-spawn/commit/1b71aa519a2e4f97d1f3ee27f0e2fc24ba17cf1a"
    },
    {
      "type": "WEB",
      "url": "https://github.com/moxystudio/node-cross-spawn/commit/244ffeaa8473de0080c93ebbf779bb953b94114b"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/moxystudio/node-cross-spawn"
    },
    {
      "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"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N",
      "type": "CVSS_V4"
    }
  ],
  "summary": "cross-spawn: Argument injection on Windows via backslashes before a double quote"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.