Skip to main content
Menu
Advisories

Scanned content makes cdxgen run project tooling, a gpg program or project code although installs are off

GHSA-QP92-6QFC-M3QPPublished Updated GitHub

Description

Several paths let a scanned repository have its own tooling run, its files imported as code, or its git configuration honoured, although the operator turned installs off or asked for secure mode, or although the path never asked for installs at all. They share one impact: a program of the repository author's choosing, or an option of the author's choosing for an external tool, runs as the user who runs cdxgen. The routes are the project's build wrappers and installers, pnpx, .npmrc settings, the helper piptree.py importing repository files, option injection into go and sourcekitten, and git's gpg program and certificate fetches for a repository that arrives with its own .git directory.

Details

Project tooling

Several paths let a scanned repository have its own tooling run, or have its files imported as code, although the operator turned installs off with --no-install-deps or CDXGEN_SECURE_MODE=true, or although the path never asked for installs at all. The author of a scanned repository can use them to run a program of their choice as the user who runs cdxgen.

  • cdxi. The .create command in bin/repl.js called createBom() with a literal installDeps: true, so the project's gradlew or mvnw and the install steps of other ecosystems ran in a cdxi session started in secure mode.
  • pnpx. createNodejsBom() in lib/cli/jsBom.js let package.json select pnpx as the package manager, which runs pnpm dlx, fetches a package from the registry named in the project's .npmrc and runs it. The list of package managers that get --ignore-scripts was shorter than the list that could be selected.
  • .npmrc keys. The .npmrc blocklist in lib/parsers/npmrc.js was bypassed by quoting a key, and lacked global, prefix, proxy and related keys, so the automatic npm install could apply node-options, replace a global package or send a registry token to a proxy named by the project.
  • Unset installDeps. createNodejsBom() and createPythonBom() tested options.installDeps !== false, so an application that called createBom() without the option ran rush install and pipenv install in secure mode.
  • Compose images. createContainerSpecLikeBom() in lib/cli/index.js scanned an image name that is a link to a project directory with the caller's installDeps option dropped, so the project's build wrapper ran.
  • piptree. getTreeWithPlugin() in lib/managers/piptree.js built PYTHONPATH with an empty first entry, so a versioned Python project type ran with the scanned directory ahead of the standard library on sys.path and executed repository files such as json.py inside cdxgen's own helper.

Option injection

Two code paths put strings from scanned files on the command line of an external tool without checking for a leading dash. A go.sum module name reaches go mod why, and a source file name from a committed Swift build description reaches sourcekitten. The author of a scanned project can add options of their own to those commands. The options reachable through the first route only change which files go reads, and the second route sits next to other ways in which a Swift build description already steers the same run, so the effect is small.

createGoBom() in lib/cli/nativeBom.js, with USE_GOSUM=true, runs go mod why -m -vendor <name> for every component parsed from go.sum. decodeGosumData() takes the first field of a line as the name, and the spawn has no leading-dash check and no --. The branch also runs on image scans and under --no-install-deps.

createSemanticsSlices() in lib/evinser/swiftsem.js appends each source named in a committed description.json that exists to the sourcekitten index arguments after --. Relative names resolve against the directory cdxgen started in, and @file entries are expanded by the Swift tools as response files. sanitizeSwiftModuleArgs() filtered the other arguments of the same file but not the source list. This matches a hardening gap that was public before the fix (cdxgen commit 5fc2a149e99c covered the -I @file form only).

Git configuration of the scanned repository

cdxgen runs git inside the scanned directory for release notes and for the AI provenance audit. Git then honours the configuration and the pointers that the scanned tree supplies. A tree that arrives with its own .git directory can make git start a program from the tree, a signed commit can make cdxgen's helper processes fetch a URL of the commit author's choosing, and a .git pointer file can make cdxgen read the metadata of another repository. These cases apply in secure mode too.

  • gpg program. buildReleaseNotesFromGit() runs git log through hardenedGitCommand() in lib/inventory/source.js. The wrapper pinned only a few settings, so the repository's .git/config still decided log.showSignature and gpg.program, and git started the program named there to verify a signature. The command allowlist only sees git. The tree must arrive with its .git directory (an unpacked archive or CI artifact; a git clone does not copy .git/config), and release notes must be on.
  • X.509 signatures. gitLogCommitsDetailed() in lib/inventory/envcontext.js reads the last 20 commits with %G?, which makes git verify each signature. For an X.509 signature, gpgsm asks dirmngr to download the revocation list from a URL in the signer's certificate. The request does not go through cdxgen's HTTP client, so the host allowlist does not apply, and the author's certificates are imported into the operator's keyring. This needs the AI provenance audit and gpgsm and dirmngr installed.
  • Git pointers. execGitCommand() in lib/inventory/envcontext.js followed a .git file or link that points outside the scanned tree and put the metadata of the other repository into the BOM, even in secure mode.

The findings in this advisory are:

IssueCodeFirst affected release
.npmrc blocklist bypass via quoted keys lets npm apply node-optionscreateNodejsBom() in lib/cli/jsBom.js12.1.5
Blind SSRF via gpgsm CRL fetch on X.509-signed commits, even in secure modeGIT_HARDENING_CONFIG_ARGS() in lib/inventory/envcontext.jsnot stated (no match found in 12.x)
.git pointer leaks another repo's git metadata into BOM, even in secure modeexecGitCommand() in lib/inventory/envcontext.js12.2.0
packageManager pnpx runs a package from the repo's registry via pnpm dlxcreateNodejsBom() in lib/cli/jsBom.js10.5.2
cdxi .create ignores secure mode and runs the project's gradlewaction() in bin/repl.js11.1.3
Secure mode still runs rush and pipenv install if installDeps is unsetcreateNodejsBom() in lib/cli/jsBom.js11.1.3
Compose scan runs mvnw despite --no-install-deps via symlinked image namecreateContainerSpecLikeBom() in lib/cli/index.js13.3.0 (no match found in 12.x)
.npmrc blocklist gaps: global packages replaced, npm token leaked to proxycreateNodejsBom() in lib/cli/jsBom.js10.5.2
Swift evidence: sourcekitten argument injection via description.json sourcescreateSemanticsSlices() in lib/evinser/swiftsem.js13.3.0 (no match found in 12.x)
Release-notes git log runs the repo's gpg program, even in secure modehardenedGitCommand() in lib/inventory/source.js12.3.0
Argument injection into go mod why via go.sum module names (USE_GOSUM)createGoBom() in lib/cli/nativeBom.js9.8.8
piptree.py imports modules from scanned repo via empty PYTHONPATH entrygetTreeWithPlugin() in lib/managers/piptree.js10.9.3

Impact

Code execution as the user running cdxgen, with its environment, from files committed to a scanned tree, in configurations that were meant to keep project code from running. Each route needs a specific project type, lock file layout, embedding or tree layout (the gpg route needs the tree to arrive with its .git directory and release notes or the AI provenance audit to be on), which the vector scores as an attack requirement. The option-injection routes only change which files go reads or add compiler options to sourcekitten, and the piptree route applies in all modes.

Patches

Fixed in @cdxgen/cdxgen 13.9.0 (cdxgen/cdxgen#4880). Versions 13.0.0 through 13.8.0 of @cdxgen/cdxgen are affected. The 12.x line, published as @cyclonedx/cdxgen, is also affected by some of the issues above from 9.8.8 through 12.9.2, and no 12.x release contains the fix. Users of 12.x should move to @cdxgen/cdxgen 13.9.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.

Known limits of the fix. Project .npmrc keys that point npm at another proxy or certificate authority (proxy, https-proxy, cafile, ca, strict-ssl) are now overridden with a warning and the install continues; global, prefix and node-options spellings are refused. CX5NQH1A was already fixed for the symbolic-link route in 13.8.0, and the 13.9.0 change passes the caller's option to the nested scan as defence in depth. EG7G5UAS (git diff.external) was closed in 13.8.0 by commit 563133b77. In secure mode, pip never builds a local project directory (HX8QMYMN).

Workarounds

  • Scan untrusted trees in a disposable container or VM that holds no credentials.
  • Do not use cdxi .create on untrusted trees.
  • Pass an explicit -t that avoids versioned Python types and JavaScript scans of untrusted projects.
  • Leave USE_GOSUM unset for untrusted Go projects.
  • Do not run cdxgen -t swift --evidence on untrusted checkouts from inside them.
  • Scan fresh git clone checkouts rather than unpacked trees that carry a .git directory.
  • Do not use --include-release-notes, --bom-audit or the appsec profile on trees you do not control, or run them in a disposable container without gpgsm.
  • Keep CDXGEN_GIT_ALLOW_EXTERNAL_GITDIR unset.

Credit

These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261117-013) and reported as ANT-2026-2N0UY0S8, ANT-2026-45BHIKYK, ANT-2026-4PQM17OE, ANT-2026-9HQ81IAD, ANT-2026-A38EMC7X, ANT-2026-BMMYM9YN, ANT-2026-CX5NQH1A, ANT-2026-D0MP0VE3, ANT-2026-D44OIDDZ, ANT-2026-G4GK5TAS, ANT-2026-M6PAJX5X, ANT-2026-TU4ZQC80, and were fixed by AI agents working for the cdxgen maintainers.

References

Affected versions

References

GitHub · cdxgen/cdxgen