<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gnawky</title>
    <description>The latest articles on DEV Community by Gnawky (@gnawky).</description>
    <link>https://dev.to/gnawky</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4282906%2Fee577f45-8945-47b6-8621-194b986f2728.png</url>
      <title>DEV Community: Gnawky</title>
      <link>https://dev.to/gnawky</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gnawky"/>
    <language>en</language>
    <item>
      <title>cross-spawn fixes two Windows argument flaws in 7.1.0 and 6.0.7</title>
      <dc:creator>Gnawky</dc:creator>
      <pubDate>Fri, 04 Dec 2026 13:55:08 +0000</pubDate>
      <link>https://dev.to/gnawky/cross-spawn-fixes-two-windows-argument-flaws-in-710-and-607-4o5f</link>
      <guid>https://dev.to/gnawky/cross-spawn-fixes-two-windows-argument-flaws-in-710-and-607-4o5f</guid>
      <description>&lt;p&gt;cross-spawn, the small package many Node tools use to start other programs the same way on every platform, was downloaded 359,331,942 times in the week before its maintainers published two Windows advisories. GitHub rates the first, GHSA-ghv9-86vm-4v8m (CVE-2026-137199, published 1 December 2026), critical: a crafted argument can run arbitrary commands. The second, GHSA-m6qr-m48x-3xhh (CVE-2026-137198, published 4 December 2026), is rated high and lets an argument split into extra arguments. Versions 7.1.0 and 6.0.7 fix both.&lt;/p&gt;

&lt;p&gt;Most projects never call cross-spawn themselves, but it sits deep in many dependency trees, so it's worth a two-minute check.&lt;/p&gt;

&lt;h2&gt;
  
  
  What went wrong
&lt;/h2&gt;

&lt;p&gt;On Windows, a command that isn't an &lt;code&gt;.exe&lt;/code&gt; or &lt;code&gt;.com&lt;/code&gt;, such as a &lt;code&gt;.bat&lt;/code&gt; or &lt;code&gt;.cmd&lt;/code&gt; file, has to run through &lt;code&gt;cmd.exe&lt;/code&gt;, so cross-spawn adds the quoting and escaping that &lt;code&gt;cmd.exe&lt;/code&gt; expects. A batch file that passes its arguments on, for example with &lt;code&gt;%*&lt;/code&gt;, makes &lt;code&gt;cmd.exe&lt;/code&gt; read them a second time. According to the maintainers' advisory, cross-spawn only handled that second pass for npm's own shims in &lt;code&gt;node_modules/.bin&lt;/code&gt;. For any other batch file, &lt;code&gt;npm.cmd&lt;/code&gt; and globally installed shims included, an argument could escape its quotes and start another program. The advisory also lists a detection bypass with trailing dots or spaces in the command name, and environment variable expansion inside arguments in some setups.&lt;/p&gt;

&lt;p&gt;The second flaw came from an earlier ReDoS fix. Starting with 7.0.4, 7.0.5 and 6.0.6, backslashes in front of a double quote were no longer doubled correctly, so an argument such as a directory path ending in two backslashes could close its quote early. The advisory explains that the extra or missing arguments go unnoticed: the command still succeeds and prints nothing on stderr. This one can't run other commands, but a tool that accepts extra flags may act on injected ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who is affected
&lt;/h2&gt;

&lt;p&gt;Both advisories limit the impact to Windows, and to applications that pass untrusted input as arguments to a command that runs through &lt;code&gt;cmd.exe&lt;/code&gt;. macOS and Linux aren't affected, and neither is the &lt;code&gt;shell&lt;/code&gt; option, which doesn't escape anything by design. If your code only uses cross-spawn indirectly, through build or test tools running fixed commands on your own machine, the practical risk is low, but the upgrade is still cheap.&lt;/p&gt;

&lt;p&gt;The affected ranges:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Command injection: below 6.0.7, and 7.0.0 up to (not including) 7.1.0.&lt;/li&gt;
&lt;li&gt;Argument injection: 6.0.6, and 7.0.4 up to (not including) 7.1.0.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to check and fix
&lt;/h2&gt;

&lt;p&gt;See which versions your lockfile installs and which packages bring them in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm ls cross-spawn --all
yarn why cross-spawn        &lt;span class="c"&gt;# Yarn 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the packages that bring it in ask for a &lt;code&gt;^7&lt;/code&gt; or &lt;code&gt;^6&lt;/code&gt; range, the fixed releases already fit it, and refreshing the lockfile is enough:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm audit fix
npm ls cross-spawn --all    &lt;span class="c"&gt;# every copy should now be 7.1.0+ or 6.0.7+&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a package pins an older version, npm can't move it on its own. An &lt;code&gt;"overrides"&lt;/code&gt; entry in &lt;code&gt;package.json&lt;/code&gt; (&lt;code&gt;"resolutions"&lt;/code&gt; in Yarn 1) forces the patched release; keep 6.x copies on 6.0.7 rather than jumping them to 7.x. The maintainers' only workaround is validating untrusted input and calling executables directly instead of batch files.&lt;/p&gt;

&lt;h2&gt;
  
  
  With Gnawky
&lt;/h2&gt;

&lt;p&gt;Running &lt;code&gt;gnawky&lt;/code&gt; in the project shows both advisories as one cross-spawn item, marked production or dev-only depending on which of your dependencies bring it in (&lt;a href="https://gnawky.dev/docs/#production" rel="noopener noreferrer"&gt;Production first&lt;/a&gt;). Choosing Fix refreshes the lockfile on a new branch with install scripts off, and when a parent pins an old version, Gnawky writes the override for you and asks whether to keep it as a &lt;code&gt;^&lt;/code&gt; range or an exact pin (&lt;a href="https://gnawky.dev/docs/#overrides" rel="noopener noreferrer"&gt;Forcing a sub-dependency&lt;/a&gt;). If you've turned on the &lt;a href="https://gnawky.dev/docs/#pre-push" rel="noopener noreferrer"&gt;pre-push warning&lt;/a&gt;, your next &lt;code&gt;git push&lt;/code&gt; lists cross-spawn when a production dependency still installs a vulnerable copy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/advisories/GHSA-ghv9-86vm-4v8m" rel="noopener noreferrer"&gt;GitHub advisory GHSA-ghv9-86vm-4v8m: cross-spawn: Command injection on Windows when spawning batch files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/advisories/GHSA-m6qr-m48x-3xhh" rel="noopener noreferrer"&gt;GitHub advisory GHSA-m6qr-m48x-3xhh: cross-spawn: Argument injection on Windows via backslashes before a double quote&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://gnawky.dev/blog/2026-12-04-cross-spawn-windows-argument-flaws/" rel="noopener noreferrer"&gt;Gnawky blog&lt;/a&gt;. Drafted with AI assistance, checked against the sources and reviewed by a person before publishing.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>node</category>
      <category>npm</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
