Skip to main content
Menu
Advisories

Scanned content can make cdxgen read host files outside the scanned tree into the BOM

GHSA-HXX2-G8W7-CQX4Published Updated GitHub

Description

Several readers open paths that scanned content names, or follow symbolic links in scanned content, without checking that the result stays inside the scanned tree. The author of a repository, pull request, archive, extension folder or container image who can later read the BOM learns the contents, selected fields, or existence of files on the scanning host. Most routes work with --no-install-deps and with CDXGEN_SECURE_MODE=true when the Node.js permission model is not enabled, and some return data through cdxgen --server for paths that CDXGEN_SERVER_ALLOWED_PATHS refuses.

Details

Contents or fields of host files

  • AI and CI readers that follow links. communityAiConfigParser.parse() in lib/inventory/communityAiConfigParser.js reads every discovered rule, command and skill markdown file with readFileSync() and copies its text, up to the first blank line and with no length limit, into cdx:agent:description. A committed link to a private key or to /proc/self/environ puts that content into the BOM; only nine token shapes are redacted. This reader runs for -t ai-skill and the ai-agent audit category. More than a dozen other readers open files the same way, including the Jenkinsfile reader (untyped scans with CI=true) and the Gradle wrapper reader (any -t java scan).
  • pnpm lock file names. findPnpmPackagePath() in lib/ecosystems/parsers-js.js joins a locked package name, or name@version, onto node_modules without checking that the result stays inside, and pnpmMetadata() copies description, author, license, homepage, repository URL, bin and script names from the package.json found there. No link is needed, so this also works for trees the server clones from a git URL.
  • npm metadata in deep mode. With --deep (or --evidence, or a profile that implies it), fillMissingMetadataFromLocalNodeModules() in lib/ecosystems/jsEvidence.js (in 12.x, the LocalNodeModulesPath lookup in lib/helpers/utils.js) reads package.json at a location derived from lock file keys. Keys written with backslashes become paths outside the project, or absolute paths, after Arborist normalizes them. Description, author and license of the target are copied.
  • kosi class path. kosiArgs() in lib/ecosystems/kosi.js passes <scanned dir>/classpath.txt to kosi after checking only that it exists. Absolute or ../ entries make kosi analyze jars elsewhere on the host, and their class and method names appear in callstack evidence (-t kotlin --evidence).
  • Swift source lists. createSemanticsSlices() in lib/evinser/swiftsem.js reads .swift files listed in a committed description.json wherever they are, and records their paths and the line numbers of import lines for module names the repository chooses (-t swift --evidence).
  • VS Code extension folders. collectIdeFolder() in lib/helpers/vsixutils.js follows linked extension entries out of a scanned extensions folder and copies the name, version, description and repository URL from the linked directory's package.json, with the SHA-256 of its main file (-t vscode-extension).
  • Windows image paths. imageGemDirs() in lib/managers/docker.js drops GEM_HOME, GEM_PATH and BUNDLE_PATH entries containing .. only when they are split on forward slashes. On Windows, backslash traversal in an image's environment makes cdxgen scan a host directory on the same drive as part of the image.

Existence of host paths

  • dotnetManifestProjectDir() in lib/ecosystems/parsers-dotnet.js checks project.restore.projectPath from a scanned project.assets.json, and whether a lock file package appears in the BOM depends on the answer.
  • getCppModules() in lib/ecosystems/cppEvidence.js and isFirstPartyHeader() resolve #include paths containing .., and the component's group and purl depend on whether the path exists.
  • identifyCompilers() and trustedCompilerPath() in lib/ecosystems/cppBuildContext.js stat and execute-check every driver named in compile_commands.json, and a formulation property shows whether a path is an executable file.

Impact

Disclosure of host files to anyone who authors scanned content and can read the resulting BOM, for example as a CI artifact, a Dependency-Track project, a release attachment or a server response. The worst case is private keys and the environment of the cdxgen process. Other routes expose metadata of other projects on the host, class names of host jars, or yes/no answers about chosen paths. Nothing is written or executed. Running under the Node.js permission model with narrow --allow-fs-read grants, as the cdxgen-secure image does, blocks the reads.

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 9.7.2 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.

cdxgen-plugins-bin 4.4.0 (cdxgen/cdxgen-plugins-bin#193) also hardens the kosi helper, which now confines the classpath entries it discovers to the project, the dependency caches, the JDK and Android SDKs, GRADLE_USER_HOME and roots named with --classpath-root. cdxgen 13.8.0 is fixed with any plugins-bin release; the plugins-bin change adds a second layer.

First affected release of each issue:

  • AI and CI readers that follow links: 12.3.1
  • pnpm lock file names: 11.5.0
  • npm metadata in deep mode: 10.0.4
  • kosi class path: 13.2.0 (not in 12.x)
  • Swift source lists: 13.3.0 (not in 12.x)
  • VS Code extension folders: 13.6.0 (not in 12.x)
  • Windows image paths: 13.6.0 (not in 12.x)
  • .NET project paths (existence): 13.4.0 (not in 12.x)
  • #include paths (existence): 9.7.2
  • compiler paths (existence): 13.4.0 (not in 12.x)

Workarounds

  • Run scans of untrusted content under the Node.js permission model with read access limited to the scanned tree and the tools cdxgen needs, for example with the cdxgen-secure image.
  • Scan untrusted content in a container that holds no secrets or other projects.
  • Scan fresh clones made with git clone rather than copied or unpacked trees; cdxgen's own clones set core.symlinks=false.
  • Avoid --deep and --evidence for untrusted repositories, and review BOMs before sharing them.

Credit

These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-TBXY3XZ6, ANT-2026-XFMXE0K1, ANT-2026-IXPELN80, ANT-2026-TFHS9ZHO, ANT-2026-1L74B55N, ANT-2026-99G22PG4, ANT-2026-U9YQFH1L, ANT-2026-PS9OCH3C, ANT-2026-UU2MGDK6, ANT-2026-H08SY0XO.

References

Affected versions

References

GitHub · cdxgen/cdxgen