Skip to main content
Menu
Advisories

Git host, server path and registry host allowlists can be bypassed through parser differences

GHSA-XMPW-48GX-8X9XPublished Updated GitHub

Description

In four places cdxgen checks a git URL, an image name or a path against an allowlist, while the program that later uses the value (git and ssh, the container daemon, or the file system) reads it differently. A client of cdxgen --server, or a manifest in a scanned repository, can therefore reach hosts or directories that CDXGEN_GIT_ALLOWED_HOSTS, CDXGEN_SERVER_ALLOWED_HOSTS, CDXGEN_SERVER_ALLOWED_PATHS, CDXGEN_ALLOWED_PATHS or CDXGEN_ALLOWED_HOSTS exclude. These are gaps left by the fix for GHSA-259h-c659-9x53; none of them runs code.

Details

  • ssh remotes with @[ in the path. getGitRemoteHost() in lib/inventory/source.js, which validateAndRejectGitSource() relies on, ends the authority of an ssh remote at the first slash (or at the first colon for git@host:path). git searches the whole remote, path included, for @[, takes the bracketed text as the host and puts everything before it into the ssh user name. A remote that names an allowed host first passes the check while ssh connects to another host and port. With stock OpenSSH settings the connection stops at host key verification; if the server account accepts new host keys (StrictHostKeyChecking=accept-new or no), the off-list repository is cloned and its BOM returned. The same string is reachable from an /sbom request, from repository URLs in registry metadata when a purl is scanned, and from the origin URL with --include-release-notes. Secure mode keeps ssh in its protocol list.
  • Image names that are also relative paths. isFollowableManifestImage() in lib/managers/docker.js checks only that an image name in a compose file, Kubernetes manifest or Dockerfile is shaped like an image reference. createBomForPath() looks for the name on disk before it considers a registry, so a name such as team/service that exists below cdxgen's working directory is scanned as an unpacked image, or unpacked if it ends in .tar or .tar.gz, and neither path allowlist sees it. The BOM then lists file names and MD5/SHA-1 hashes from its bin directories, its OS packages and package metadata.
  • file:// git URLs through links. The file: branch of validateAndRejectGitSource() checks the URL path with isAllowedPath(), which compares resolved path strings, and never calls isAllowedRealPath() as the path= branch does. A symbolic link inside an allowed directory, a <path>.git or <path>/.git link, or a .git file containing gitdir: makes git clone a repository outside it. This needs the operator to have added file to CDXGEN_GIT_ALLOW_PROTOCOL, and the link must already exist.
  • Registry names Docker reads differently. With CDXGEN_ALLOWED_HOSTS including docker.io, isFollowableManifestImage() takes the registry from parseImageName(), which lower-cases the name and treats the first component as a registry only when it contains a dot or a colon. Docker also treats localhost, or a first component that is not all lower case, as a registry host. A manifest can therefore make the daemon pull from a registry on the daemon host's own localhost or from a single-label intranet name, and for the mixed-case form cdxgen attaches the operator's Docker Hub login to the pull.

Impact

Unauthenticated clients of cdxgen --server can obtain inventories of directories and repositories outside the allowed paths, and can make the server open ssh connections to hosts outside the allowlist. Authors of scanned manifests can do the same in command-line scans that use the container-spec project types (universal, docker-compose, dockerfile, kubernetes and related types), past CDXGEN_ALLOWED_PATHS and secure mode, and can make the container daemon contact local or intranet registries.

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 from 11.2.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:

  • ssh remotes with @[ in the path: 11.2.5
  • image names that are also paths: 12.3.3
  • file:// git URLs through links: 13.5.0, and 12.8.7 on the 12.x line
  • registry names Docker reads differently: 13.5.0, and 12.8.7 on the 12.x line

Workarounds

  • Start the server from an empty working directory, or one that holds only content clients may scan.
  • Keep file out of CDXGEN_GIT_ALLOW_PROTOCOL, and set StrictHostKeyChecking=yes for the account that runs the server.
  • Do not use the container-spec project types on untrusted repositories, and do not leave a Docker Hub login in the environment of such scans.
  • Put the server behind a reverse proxy that authenticates clients, as docs/THREAT_MODEL.md recommends.

Credit

These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-DM3FZHQR, ANT-2026-VOIJ6X3Q, ANT-2026-KMSALCGW, ANT-2026-8R2RF76X.

References

Affected versions

References

GitHub · cdxgen/cdxgen