Scanned content can make cdxgen read host files outside the scanned tree into the BOM
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()inlib/inventory/communityAiConfigParser.jsreads every discovered rule, command and skill markdown file withreadFileSync()and copies its text, up to the first blank line and with no length limit, intocdx:agent:description. A committed link to a private key or to/proc/self/environputs that content into the BOM; only nine token shapes are redacted. This reader runs for-t ai-skilland the ai-agent audit category. More than a dozen other readers open files the same way, including the Jenkinsfile reader (untyped scans withCI=true) and the Gradle wrapper reader (any-t javascan). - pnpm lock file names.
findPnpmPackagePath()inlib/ecosystems/parsers-js.jsjoins a locked package name, orname@version, ontonode_moduleswithout checking that the result stays inside, andpnpmMetadata()copies description, author, license, homepage, repository URL, bin and script names from thepackage.jsonfound 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()inlib/ecosystems/jsEvidence.js(in 12.x, theLocalNodeModulesPathlookup inlib/helpers/utils.js) readspackage.jsonat 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()inlib/ecosystems/kosi.jspasses<scanned dir>/classpath.txtto 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()inlib/evinser/swiftsem.jsreads.swiftfiles listed in a committeddescription.jsonwherever 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()inlib/helpers/vsixutils.jsfollows linked extension entries out of a scanned extensions folder and copies the name, version, description and repository URL from the linked directory'spackage.json, with the SHA-256 of its main file (-t vscode-extension). - Windows image paths.
imageGemDirs()inlib/managers/docker.jsdropsGEM_HOME,GEM_PATHandBUNDLE_PATHentries 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()inlib/ecosystems/parsers-dotnet.jschecksproject.restore.projectPathfrom a scannedproject.assets.json, and whether a lock file package appears in the BOM depends on the answer.getCppModules()inlib/ecosystems/cppEvidence.jsandisFirstPartyHeader()resolve#includepaths containing.., and the component's group and purl depend on whether the path exists.identifyCompilers()andtrustedCompilerPath()inlib/ecosystems/cppBuildContext.jsstat and execute-check every driver named incompile_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)
#includepaths (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-secureimage. - Scan untrusted content in a container that holds no secrets or other projects.
- Scan fresh clones made with
git clonerather than copied or unpacked trees; cdxgen's own clones setcore.symlinks=false. - Avoid
--deepand--evidencefor 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.