Skip to main content
Menu
Advisories

Registry, API and forge credentials are sent to hosts that scanned content or project files choose

GHSA-374F-WC4J-7GVHPublished Updated GitHub

Description

cdxgen attaches the operator's credentials to outgoing requests based on a host name or an environment variable, while a scanned project, a project configuration file, a commit or an OCI referrer descriptor decides where the request goes. The author of such content can have a Docker registry login, a Dependency-Track API key, a TEA token, a gem server key, an npm registry login or a forge token sent to a host they choose.

Details

Registry referrer descriptors

When cdxgen fetches an SBOM attached to a container image, a referrer descriptor that carries a reference field decides which host receives the next manifest request, and that request carries the credential cdxgen obtained for the image's own registry. A user who can push tags or an image index to a repository on a registry can therefore collect the registry login of anyone who fetches that image's attached SBOM with cdx-validate -i, cdx-verify -i or cdx-audit --bom ... --direct-bom-audit.

getManifestImageRef() in lib/managers/oci.js returns the descriptor's reference verbatim. The loop in getBomWithOras() runs it through parseImageRef() and calls fetchManifest() on the host it names, passing the token obtained for the registry of the image the operator named. Nothing compares the two hosts. If the planted index keeps the genuine SBOM descriptor next to the hostile one, the command still succeeds and cdx-verify still reports a valid signature, because the request goes out before any signature check.

On registries that use bearer tokens, only a pull token for the repository the attacker can already push to leaks, or an anonymous token when the token endpoint is on another host. On registries that accept basic authentication, the leaked value is the Basic credential from the Docker configuration or DOCKER_AUTH.

Credentials and the host that receives them

cdxgen attaches the operator's credentials to outgoing requests based on a host name or on an environment variable, while a scanned project, a project configuration file or a commit decides where the request goes. The author of a repository, compose file, lock file or commit can have a Docker registry login, a Dependency-Track API key, a TEA token, a gem server API key, an npm registry login or a forge token sent to a host they choose, or to a place where they can read it.

The credential and the way the destination is chosen differ per case:

  • DOCKER_AUTH. getDockerCreds() in lib/managers/oci.js returns DOCKER_AUTH for any registry when no stored login matches. The container-risk rules CTR-009 and CTR-010 rebuild an image reference from the scanned content and ask that registry for an SBOM, so a compose file, Dockerfile, Kubernetes manifest or BOM can name a registry that receives the login.
  • Docker Hub login and the allowlist. getImage() in lib/managers/docker.js retries a failed pull of docker.io/<host>/<name> as <host>/<name> after the allowlist approved the first form, and the retry carries the Docker Hub login in X-Registry-Auth.
  • Dependency-Track key and TEA token from .cdxgen.json. sanitizeProjectConfig() in lib/core/projectConfig.js let a committed .cdxgen.json set server-url, tea-fetch and tea-publish while the key or token came from the operator, so the credential went to the repository's host.
  • Server mode. validateRequestOptions() in lib/server/server.js refused a client-chosen serverUrl with the operator's API key only when the origin differed, so another path on the same origin received the key.
  • npm registry login. registryLookupForPurl() in lib/inventory/source.js assumed that the registry ends in a slash. With a host-only NPM_URL that carries a login, a scoped package name becomes the host of the request and the login goes to it. parseDenoLock() in lib/ecosystems/denoutils.js let a project .npmrc override NPM_URL even in secure mode.
  • Gem server key. getRubyGemsMetadata() in lib/ecosystems/rubyutils.js falls back to rubygems.org per endpoint while the Authorization header is built once, so a partly overridden configuration sends GEM_HOST_API_KEY to rubygems.org.
  • Forge token. gitLogCommitsDetailed() in lib/inventory/envcontext.js split git log output on a byte that a commit message may contain, so a commit could steer up to five GitHub or GitLab API requests that carry GITHUB_TOKEN or GITLAB_TOKEN. parseGitHubUrl() and parseGitLabUrl() in lib/inventory/forgeEnricher.js accepted a host name hidden in the path of another URL, so a clone from such an origin made cdxgen query a private repository with the operator's token.

The findings in this advisory are:

IssueCodeFirst affected release
Secure mode: project .npmrc overrides NPM_URL in deno.lock scansparseDenoLock() in lib/ecosystems/denoutils.js12.8.0
forgeEnricher host check bypass leaks private PR review metrics into BOMparseGitHubUrl() in lib/inventory/forgeEnricher.js12.7.1
Predictive audit leaks NPM_URL credentials to a host named by an npm scoperegistryLookupForPurl() in lib/inventory/source.jsnot stated (no match found in 12.x)
Registry credential leak to any host named in OCI referrer descriptorsgetManifestImageRef() in lib/managers/oci.js12.7.0
CDXGEN_ALLOWED_HOSTS bypass: pull retry drops docker.io but keeps Hub logingetImage() in lib/managers/docker.js13.5.0 (12.x: 12.8.7)
BOM audit leaks DOCKER_AUTH to any registry named by scanned projectsgetDockerCreds() in lib/managers/oci.js12.7.0
Private gem server API key leaks to rubygems.org for multi-platform gemsgetRubyGemsMetadata() in lib/ecosystems/rubyutils.js12.8.3
Commits with 0x1e forge git log records and steer GITHUB_TOKEN API requestsgitLogCommitsDetailed() in lib/inventory/envcontext.js12.7.1
Operator's API key and TEA token leak to hosts set in repo's .cdxgen.jsonsanitizeProjectConfig() in lib/core/projectConfig.js9.8.10
Server mode leaks operator's API key if serverUrl differs only in pathvalidateRequestOptions() in lib/server/server.js9.8.10

Impact

Disclosure of the operator's credentials, or of data read with them, to the author of scanned content. Each route needs the operator to run a specific command (a BOM audit, cdx-validate -i, a deep scan, --tea-fetch) or a server with a credential set. A leaked credential gives the recipient the access that credential grants on another system, which the vector scores as a subsequent-system impact. With a basic registry credential this can be everything the account reaches.

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 9.8.10 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. S1S6CK7F was fixed in two steps: the TEA half is in 13.8.0 (commit 32cd80fd8) and the Dependency-Track half in 13.9.0. DOCKER_AUTH still defaults to docker.io and is sent only to the registry named by DOCKER_SERVER_ADDRESS. A referrer descriptor is accepted only when it is a digest reference in the same repository as the image.

Workarounds

  • Use a registry login limited to read access on the repositories that the workflow needs, and avoid DOCKER_AUTH with a shared account.
  • Verify attached SBOMs only for images from registries and repositories that you control, or with CDXGEN_ALLOWED_HOSTS restricted to the registry host in secure mode.
  • Give cdxgen credentials that can read only what the scan needs, and unset DOCKER_AUTH, GEM_HOST_API_KEY, GITHUB_TOKEN and NPM_URL credentials for scans of untrusted content.
  • Run scans of untrusted content in secure mode with CDXGEN_ALLOWED_HOSTS set, and review a .cdxgen.json in a tree before you scan inside it.
  • In server mode, do not let clients choose serverUrl.

Credit

These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261117-013) and reported as ANT-2026-0RATASDL, ANT-2026-5WY66LEN, ANT-2026-B9DTNE02, ANT-2026-DQDYCVXP, ANT-2026-GE7TK2CI, ANT-2026-GQVD3JVU, ANT-2026-GSJ0J4OE, ANT-2026-L42RWFS3, ANT-2026-S1S6CK7F, ANT-2026-YKRA3Y9F, and were fixed by AI agents working for the cdxgen maintainers.

References

Affected versions

References

GitHub · cdxgen/cdxgen