Skip to main content
Menu
Advisories

Scanned project's build tooling can run although installs are off or secure mode was requested

GHSA-2M6R-6QMF-PJ6PPublished Updated GitHub

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() in lib/inventory/atomUtils.js passes delombok-mode=no-delombok,fetch-dependencies=false to atom only when the language lower-cases to exactly java, and createSlice() in lib/evinser/evinser.js rewrites javasrc to java but leaves JAVASRC unchanged. A config file in the working directory with "type": "JAVASRC" and "evidence": true makes atom match its Java source frontend case-insensitively and run mvn -B dependency:build-classpath in the checkout. The type tasty does the same for sbt projects through atom's scalasem step. Because atom starts these tools, CDXGEN_ALLOWED_COMMANDS does not stop them. This needs cdxgen to be started inside the checkout without -t, on a host where mvn or sbt is installed.
  • JDK probe in the project directory. ensureCompatibleJdk() in lib/stages/pregen/pregen.js runs java --version and java --list-modules with the scanned repository as the working directory and does not check whether project tooling is allowed. Where java on PATH is 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 neither JAVA_CMD nor a valid JAVA_HOME is set.
  • Permission flags on Node's command line. isSecureMode in lib/core/activity.js (lib/helpers/utils.js in 12.x) is true only when CDXGEN_SECURE_MODE is set or NODE_OPTIONS contains --permission. When an operator starts node --permission ... bin/cdxgen.js, the flag is in process.execArgv instead, so secure mode stays off even though cdxgen prints its secure-mode warning. Installs stay on, so the project's gradlew or mvnw and 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 -t and start cdxgen from outside the checkout, so that config files in the repository are not read.
  • Set CDXGEN_SECURE_MODE=true explicitly when using the Node.js permission model, or put the permission flags in NODE_OPTIONS.
  • Set JAVA_CMD or JAVA_HOME to 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

Affected versions

References

GitHub · cdxgen/cdxgen