Skip to main content
Menu
Advisories

Scanned content and server requests can read host files and directories outside the allowed or scanned tree

GHSA-XF67-RMRX-H6MPPublished Updated GitHub

Description

Readers for lock files, manifests, container layers and server requests open paths that content names, or follow symbolic links, without checking that the result stays inside the scanned tree or the allowed paths. The author of a repository, archive, crate, image, manifest or server request learns names, hashes, selected fields or the existence of files on the scanning host, and in a few routes can have a file copied, deleted or probed. The group also holds the CDXGEN_ALLOWED_PATHS bypasses of server mode (comma lists, links, unscoped provenance reads), the settings a scanned tree's .cdxgen.json can override, and one local-user case in OBOM scans.

Details

Server allowed-path bypasses

A client of cdxgen --server, or a user of the command line with CDXGEN_ALLOWED_PATHS set, can scan or write outside the allowed paths. The path may be a comma-separated list whose entries are not checked, a symbolic link or a .cdxgenrc that resolves outside, or a request that makes the provenance reader look at the server's own working directory.

  • Comma lists. createMultiXBom() in lib/cli/index.js splits a path string on commas, but the allowlist compared the whole string, so /allowed,/etc passed.
  • Symbolic links. realPathOrResolved() in lib/inventory/source.js (used for the allowed-path check and by the .cdxgenrc reader) let a link or a missing component bypass the realpath check, and the CLI scanned and wrote bom.json outside the allowed paths.
  • Provenance reader. start() in lib/server/server.js ran the ai-provenance collector on the server's working directory for a request whose path was allowed, so the response carried git metadata of the server's own repository.

Host file disclosure

Readers for lock files, manifests and container layers 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, archive, crate, image or manifest who can later read the BOM learns names, hashes, selected fields or the existence of files on the scanning host. Most routes work with --no-install-deps and with secure mode when the Node.js permission model is not enabled.

The routes read host data in three ways. Some copy fields of a host package.json, gemspec, crate manifest, license file or Go module directory into the BOM. Some record names and hashes of files that a link or an absolute path in an image points to. Some only reveal whether a chosen host path exists, through a component that appears or does not.

A Windows route differs: UNC paths in includes and build files make cdxgen touch a remote share, which sends the user's NTLM hash to the share's host.

OBOM Python environment probe

When root runs cdxgen -t os (OBOM) on a host with other users, the probe for Python virtual environments walks each home directory and follows symbolic links at every step. An unprivileged local user can get names, versions and summaries of Python packages from directories that only root can read into the OBOM, learn whether chosen directories or files exist, or make the scan run out of memory or hang.

sitePackagesOf() and the readers around it in lib/ecosystems/venvProbe.js use statSync(), readdirSync() and plain reads on the path from the home directory through pyvenv.cfg, lib, site-packages, *.dist-info and METADATA, and never check that the real path stays inside the home directory. readMetadata() checks the size with stat, so a link to a zero-size /proc file is read without bound. This is the Python counterpart of the RubyGems probe that was fixed in 13.8.0.

Project configuration file of the scanned tree

When cdxgen is started inside a checkout, a .cdxgen.json or .cdxgenrc in that checkout supplies option values. Three of those options reached code that should have been under the operator's control alone: a type value containing ../ made evinse read and delete another project's evidence files, compile-commands re-enabled the repository's own compilation database in secure mode, and tui made cdxgen start itself without end.

  • Slice type. createSlice() in lib/evinser/evinser.js used the type value from the config in the path of the slice and atom files it copied into the BOM and then deleted. The fix for earlier reports dropped unknown types in the config reader, and the final check at the point of use was missing.
  • compile-commands. findCompileCommands() in lib/inventory/atomUtils.js returned options.compileCommands before it reached the secure-mode check, and yargs merges the config file into the same option, so a repository could name its own compile_commands.json.
  • tui. A repository whose .cdxgen.json contains tui made one cdxgen run start cdxgen and cdxui processes without end when started from a terminal with the cdxui plugin installed; memory grows by about 100 MB per level.

The findings in this advisory are:

IssueCodeFirst affected release
Zig resolver leaks user name via absolute Zig cache paths in the BOMparseManifestAt() in lib/ecosystems/zigResolver.jsnot stated (no match found in 12.x)
Symlinks bypass realpath checks for server allowed paths and .cdxgenrcrealPathOrResolved() in lib/inventory/source.js13.5.0 (12.x: 12.8.7)
Server path allowlist bypass: createMultiXBom splits path on commascreateMultiXBom() in lib/cli/index.js11.2.5
Path traversal via OCI index.json digest: host file read and DoSresolveArchiveManifest() in lib/managers/docker.js12.3.0
Repo symlink lets CLI scan and write bom.json outside CDXGEN_ALLOWED_PATHSbin/cdxgen.js12.3.0
Secure mode lets a scanned repo's .cdxgen.json set compile-commandsfindCompileCommands() in lib/inventory/atomUtils.js13.3.0 (no match found in 12.x)
Path traversal in scalasem classpath leaks host jar class names into BOMbuildScalaJoinIndex() in lib/ecosystems/scalasem.jsnot stated (no match found in 12.x)
Server mode: ai-provenance leaks server cwd's git metadata past allowed pathsstart() in lib/server/server.js12.7.1
vcpkg .list path traversal lets the BOM leak whether host files existreadVcpkgInstalledIndex() in lib/ecosystems/cppIncludeResolver.jsnot stated (no match found in 12.x)
Endless cdxgen-cdxui spawn loop when a repo's .cdxgen.json enables tuibin/cdxgen.js12.6.0
C/C++ scans leak NTLM hashes via UNC paths in includes and build fileslib/ecosystems/cppBuildContext.js13.4.0 (no match found in 12.x)
Path traversal via .cdxgen.json type reads and deletes evidence slicescreateSlice() in lib/evinser/evinser.js11.2.6
Repo symlinks and manifest paths leak host files and env vars into the BOMgetAllFilesWithIgnore() in lib/core/fs.jsnot stated (no match found in 12.x)
Python first-party check follows symlinks, leaking whether host paths existisFirstPartyModule() in lib/ecosystems/pythonutils.js13.4.0 (no match found in 12.x)
Symlinked license-file in unpacked crate leaks host files into the BOMreadExtractedManifest() in lib/ecosystems/cargoCache.js13.4.0 (no match found in 12.x)
Path traversal in Go license lookup: parseGoListDep strips quotes from DirparseGoListDep() in lib/ecosystems/parsers-go.js12.1.2
Path traversal in registry lookup URLs leaks private package metadatanpmRegistryKey() in lib/ecosystems/ecosystems.js10.1.0 (no match found in 12.x)
Symlink escape in rootfs scans leaks host packages into the image BOMgetPkgPathList() in lib/managers/docker.js5.2.1
OBOM venv probe follows user symlinks as root, leaking root-only metadatasitePackagesOf() in lib/ecosystems/venvProbe.jsnot stated (no match found in 12.x)
Directory.Packages.props lookup ignores allowed paths, leaks versionsgetCentralPackageVersions() in lib/ecosystems/parsers-dotnet.js13.0.0 (12.x: 12.8.3)
Path traversal via Cargo.lock crate version leaks host files into BOMreadExtractedManifest() in lib/ecosystems/cargoCache.js12.8.0 (no match found in 12.x)
Path traversal in container scans leaks host file names and hashescollectExecutables() in lib/inventory/osPackageResolver.js12.4.0

Impact

Disclosure of host file metadata to anyone who authors scanned content and can read the resulting BOM, for example as a CI artifact, a Dependency-Track project or a server response. Contents of arbitrary files are not copied by most routes; the fields that are copied come from files with a particular name or format. The settings routes can also copy and delete another project's evidence files and start cdxgen without end from a tui setting. The OBOM venv probe is a local-user case: an unprivileged user gets metadata of root-only Python environments into a root-run OBOM. 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.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 5.2.1 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. Rootfs scans now resolve links inside the image root, so usr/bin/sh -> /bin/sh keeps working and links to host paths do not (SE21G4LR). Discovery of files by glob skips links that resolve outside the searched directory, with CDXGEN_FOLLOW_EXTERNAL_SYMLINKS=true as an opt-in that is ignored in secure mode (NWLZ4BSK). Comma-separated paths are split only when the whole string is not an existing path, and each entry is checked. The kosi helper follows links out of its directory on its own account and is tracked as cdxgen/cdxgen-plugins-bin#216.

Workarounds

  • Do not expose cdxgen --server to clients that you do not trust, and run it in a container that holds no other projects or secrets.
  • Use one path per request and avoid comma-separated values.
  • 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, and scan fresh clones rather than copied or unpacked trees.
  • Avoid --deep and --evidence for untrusted repositories, and review BOMs before sharing them.
  • Run OBOM scans with a restrictive umask (for example umask 077) and keep the BOM unreadable to other users.
  • Where other users can write their home directories, run OBOM scans in a time-limited job.
  • Review or remove .cdxgen.json, .cdxgenrc and .cdxgen.yml in trees that you do not control before you scan inside them, or start cdxgen from a directory outside the tree.
  • Pass --no-tui explicitly.

Credit

These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261117-013) and reported as ANT-2026-1MPRQPVO, ANT-2026-5SBZDSFO, ANT-2026-6AMW7ADX, ANT-2026-6BBSL7YN, ANT-2026-7X4Y7AQ0, ANT-2026-9ZHAWOJL, ANT-2026-A7OJ8TJ2, ANT-2026-CQEF7LZA, ANT-2026-EEHIOKSS, ANT-2026-GI3FN01B, ANT-2026-HWBMNA24, ANT-2026-MUWOP0DN, ANT-2026-NWLZ4BSK, ANT-2026-O2VRACXZ, ANT-2026-P2KWC5ER, ANT-2026-R74V9Z4H, ANT-2026-S1X567W5, ANT-2026-SE21G4LR, ANT-2026-SMU2HDXR, ANT-2026-SXUPK9JW, ANT-2026-T0LRUGJB, ANT-2026-VQ3XMQFB, and were fixed by AI agents working for the cdxgen maintainers.

References

Affected versions

References

GitHub · cdxgen/cdxgen