Skip to main content
Menu
Advisories

Windows: executables in the scanned repository run in place of git, go, node or dotnet

GHSA-G4W7-2Q9V-H6Q2Published Updated GitHub

Description

On Windows, a scanned repository that ships its own git.exe, go.exe, node.cmd or dotnet.cmd can get that file started by cdxgen in place of the real tool, with the rights of the user or CI job running the scan. For the git, go and node cases this also holds with --no-install-deps and in secure mode. The broadest route is git.exe: when formulation is collected, cdxgen runs git with the repository as the working directory in every scan type.

Details

safeSpawnSync() calls isWindowsShellHijackRisk() in lib/core/fs.js to refuse a spawn when a file in the working directory would be found instead of the intended command. The check returns early in two cases:

  • No cwd option. The child then starts in cdxgen's own working directory, which is the repository when cdxgen is run from inside it. This covers the atom --frontend-args-keys and --help probes and two dotnet msbuild spawns (lib/cli/managedBom.js and lib/ecosystems/parsers-dotnet.js).
  • No shell. On Windows, libuv also searches the working directory for name.com and name.exe before PATH. This covers execGitCommand(), the formulation git calls, and go list and go mod graph, all of which set cwd to the project.

The node.cmd and dotnet.cmd routes need cdxgen to be started from inside the repository, and the dotnet msbuild spawns only run with installs on. The git.exe route also applies when the repository is passed by path from another directory.

Impact

Code execution on Windows hosts, including Windows CI runners, for whoever authors the scanned repository or a pull request to it. Formulation, and with it the git route, is on with --include-formulation and --bom-audit, and by default under CI=true from 13.7.0. Linux and macOS hosts are not affected.

Patches

Fixed in @cdxgen/cdxgen 13.8.0. Versions 13.0.0 through 13.7.0 of @cdxgen/cdxgen are affected. The 12.x line, published as @cyclonedx/cdxgen, is also affected from 12.2.0 through 12.9.1, and no 12.x release contains the fix. Users of 12.x should move to @cdxgen/cdxgen 13.8.0 or apply the workarounds below. File paths in this advisory refer to the 13.x source tree; in 12.x most of the same functions are under lib/helpers/ or in lib/cli/index.js.

Workarounds

  • On Windows, remove files named git.exe, git.com, go.exe, go.com, node.cmd, node.exe, dotnet.cmd and dotnet.exe from untrusted checkouts before scanning, or scan untrusted repositories on Linux or macOS.
  • Run cdxgen from a directory other than the checkout.

Credit

This issue was found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-MKLF1OWF.

References

Affected versions

References

GitHub · cdxgen/cdxgen