Scanned project's build tooling can run although installs are off or secure mode was requested
Description
With installs off (--no-install-deps, --lifecycle pre-build, secure mode, or the cdxgen-secure command), cdxgen does not run the scanned project's own build tooling, as described under "Which tools run with installs off" in docs/THREAT_MODEL.md. Three gaps let a scanned repository get Maven, sbt, a JDK it selects, or its own gradlew run anyway, which gives the repository author the usual ways of running code through those tools (.mvn/jvm.config, .mvn/extensions.xml, Maven plugins, build.sbt, project/*.scala, the wrapper scripts).
Details
- Language name spelled in upper case.
atomBuildToolArgs()inlib/inventory/atomUtils.jspassesdelombok-mode=no-delombok,fetch-dependencies=falseto atom only when the language lower-cases to exactlyjava, andcreateSlice()inlib/evinser/evinser.jsrewritesjavasrctojavabut leavesJAVASRCunchanged. A config file in the working directory with"type": "JAVASRC"and"evidence": truemakes atom match its Java source frontend case-insensitively and runmvn -B dependency:build-classpathin the checkout. The typetastydoes the same for sbt projects through atom's scalasem step. Because atom starts these tools,CDXGEN_ALLOWED_COMMANDSdoes not stop them. This needs cdxgen to be started inside the checkout without-t, on a host wheremvnorsbtis installed. - JDK probe in the project directory.
ensureCompatibleJdk()inlib/stages/pregen/pregen.jsrunsjava --versionandjava --list-moduleswith the scanned repository as the working directory and does not check whether project tooling is allowed. WherejavaonPATHis a version-manager shim that picks the JDK from files in the working directory, the repository chooses the program that runs. This applies outside secure mode, when the JVM tool is pinned (a versioned type such as-t maven3.9.9, or the jvm-tool-setup feature) and neitherJAVA_CMDnor a validJAVA_HOMEis set. - Permission flags on Node's command line.
isSecureModeinlib/core/activity.js(lib/helpers/utils.jsin 12.x) is true only whenCDXGEN_SECURE_MODEis set orNODE_OPTIONScontains--permission. When an operator startsnode --permission ... bin/cdxgen.js, the flag is inprocess.execArgvinstead, so secure mode stays off even though cdxgen prints its secure-mode warning. Installs stay on, so the project'sgradlewormvnwand package installation run, and the HTTPS-only rule and redirect restrictions are off.
Impact
The author of a scanned repository or pull request gets code executed with the operator's privileges in configurations that are meant to prevent exactly that. The first route also works in secure mode.
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 by some of the issues above from 11.1.5 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.
First affected release of each issue:
- upper-case language name: 13.5.0 (not in 12.x)
- JDK probe in the project directory: 13.1.0 (not in 12.x)
- permission flags on Node's command line: 11.1.5
Workarounds
- Pass the project type with
-tand start cdxgen from outside the checkout, so that config files in the repository are not read. - Set
CDXGEN_SECURE_MODE=trueexplicitly when using the Node.js permission model, or put the permission flags inNODE_OPTIONS. - Set
JAVA_CMDorJAVA_HOMEto a fixed JDK on hosts that use version-manager shims.
Credit
These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-0Z7TMSMB, ANT-2026-2X07BCFG, ANT-2026-ETAH24CM.
References
- github.com/
cdxgen/ cdxgen/ security/ advisories/ GHSA-phj7-7j69-xmfh (earlier advisory about config files in a scanned repository) - github.com/
cdxgen/ cdxgen/ blob/ master/ SECURITY.md - github.com/
cdxgen/ cdxgen/ blob/ master/ docs/ THREAT_MODEL.md - Fixed in: github.com/
cdxgen/ cdxgen/ pull/ 4787