GHSA-qhh4-458h-xwh2: @cyclonedx/cdxgen Docker Registry Auth Substring Match Vulnerability

MODERATE
CWE-522 CWE-346
Published
Advisory Summary

GHSA-qhh4-458h-xwh2 is a MODERATE docker registry auth substring match vulnerability (CWE-522: Insufficiently Protected Credentials) affecting @cyclonedx/cdxgen libraries in the npm ecosystem. The issue involves docker registry auth substring match forwards credentials to a different registry. Remediation is available by upgrading affected packages to version 12.3.3.

GHSA-qhh4-458h-xwh2 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-qhh4-458h-xwh2
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-522: Insufficiently Protected Credentials
Affected Product @cyclonedx/cdxgen
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-qhh4-458h-xwh2

To remediate this vulnerability, upgrade all affected @cyclonedx/cdxgen dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@cyclonedx/cdxgen fixed: 12.3.3
npm install @cyclonedx/cdxgen@12.3.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @cyclonedx/cdxgen

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-qhh4-458h-xwh2, inspect your project dependencies using npm:

npm ls @cyclonedx/cdxgen

Analyze the terminal output to locate any version of @cyclonedx/cdxgen in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 12.3.3), your application is affected.

Note: The npm ls @cyclonedx/cdxgen command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-522: Insufficiently Protected Credentials, where the product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval. In @cyclonedx/cdxgen, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# Docker registry auth substring match forwards credentials to a different registry ## Repository `cdxgen/cdxgen` ## Affected product/package - Ecosystem: npm - Package: `@cyclonedx/cdxgen` - Reviewed tree version: `12.3.3` - Reviewed commit: `b1e179869fd7c6032c3d483c3f7bd4d7154ec22b` - Affected file: `lib/managers/docker.js` - Affected from: v9.9.5 The Single Executable Applications (SEA) binaries and container images are also affected. ## Weakness CWE-522 / CWE-346. ## Summary When cdxgen scans or pulls container images through the Docker daemon API, it builds an `X-Registry-Auth` header from Docker credentials in `DOCKER_CONFIG/config.json`. The credential selection logic matches configured registry keys with substring checks: ```js if (forRegistry && !serverAddress.includes(forRegistry)) { continue; } ``` This is not an origin-safe registry comparison. For example, credentials configured for `private-registry.example.com` are selected for a requested image under `registry.example.com`, because: ```js "private-registry.example.com".includes("registry.example.com") === true ``` The selected credentials are then serialized into `X-Registry-Auth` for the Docker API pull request targeting the requested registry. ## Reproduction Use the attached/local proof: ```sh node submissions/github-gsa/cdxgen-docker-registry-auth-substring-forwarding/evidence/cdxgen_docker_registry_auth_substring_probe.mjs ``` The proof is fully local. It creates a temporary Docker config containing credentials for `private-registry.example.com`, starts a localhost mock Docker API endpoint, sets `DOCKER_HOST` to that endpoint, then calls cdxgen's exported Docker request path for a pull from `registry.example.com`. Observed vulnerable output: ```json { "decision": "GO", "dockerConfigAuthHost": "private-registry.example.com", "requestedRegistry": "registry.example.com", "substringMatch": true, "dockerApiUrl": "/images/create?fromImage=registry.example.com/team/app:latest", "headerPresent": true, "decodedHeader": { "username": "trusted-user", "password": "trusted-pass", "serveraddress": "private-registry.example.com" } } ``` ## Impact If an operator has Docker credentials for a private registry and uses cdxgen to scan an image from a different registry whose hostname is a substring of that private registry hostname, cdxgen can attach the private registry credentials to the Docker pull request for the different registry. In a realistic attack, an attacker who controls or can observe the requested registry can induce a victim to scan an image from that registry. The Docker daemon API receives an `X-Registry-Auth` payload containing credentials for the victim's private registry but associated with the attacker-requested pull. This is a credential forwarding/misbinding issue in cdxgen's container image handling. ## References Functions `normalizeRegistryHost` and `registriesMatch` added to normalize and perform strict host matching. Fix PR: https://github.com/cdxgen/cdxgen/pull/3964 Researcher: Francesco SabiuResearcher: Francesco Sabiu

GHSA-qhh4-458h-xwh2 Affected @cyclonedx/cdxgen Versions

1 component(s)
Fixed Versions:
12.3.3
Product / Package Ecosystem Affected Versions Fixed Version
@cyclonedx/cdxgen
npm
≥ 9.9.5
< 12.3.3
12.3.3

References

Frequently Asked Questions

What is GHSA-qhh4-458h-xwh2?
GHSA-qhh4-458h-xwh2 is a security vulnerability in @cyclonedx/cdxgen involving Docker registry auth substring match forwards credentials to a different registry under CWE-522: Insufficiently Protected Credentials.
Which @cyclonedx/cdxgen versions are affected?
Affected versions include releases prior to 12.3.3 across affected packages: @cyclonedx/cdxgen.
What version fixes GHSA-qhh4-458h-xwh2?
Upgrading to 12.3.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @cyclonedx/cdxgen affected?
Yes, @cyclonedx/cdxgen is affected in releases prior to 12.3.3. Upgrade your dependency to 12.3.3 or later.
What CWE is associated with GHSA-qhh4-458h-xwh2?
GHSA-qhh4-458h-xwh2 is classified under CWE-522: Insufficiently Protected Credentials (The product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval.).
How can I check npm dependencies for GHSA-qhh4-458h-xwh2?
Run the dependency tree command: 'npm ls @cyclonedx/cdxgen'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qhh4-458h-xwh2",
  "modified" : "2026-05-08T20:06:00Z",
  "published" : "2026-05-08T20:06:00Z",
  "aliases" : [ ],
  "summary" : "@cyclonedx/cdxgen: Docker registry auth substring match forwards credentials to a different registry",
  "details" : "# Docker registry auth substring match forwards credentials to a different registry\n\n## Repository\n\n`cdxgen/cdxgen`\n\n## Affected product/package\n\n- Ecosystem: npm\n- Package: `@cyclonedx/cdxgen`\n- Reviewed tree version: `12.3.3`\n- Reviewed commit: `b1e179869fd7c6032c3d483c3f7bd4d7154ec22b`\n- Affected file: `lib/managers/docker.js`\n- Affected from: v9.9.5\n\nThe Single Executable Applications (SEA) binaries and container images are also affected.\n\n## Weakness\n\nCWE-522 / CWE-346.\n\n## Summary\n\nWhen cdxgen scans or pulls container images through the Docker daemon API, it builds an `X-Registry-Auth` header from Docker credentials in `DOCKER_CONFIG/config.json`. The credential selection logic matches configured registry keys with substring checks:\n\n```js\nif (forRegistry && !serverAddress.includes(forRegistry)) {\n  continue;\n}\n```\n\nThis is not an origin-safe registry comparison. For example, credentials configured for `private-registry.example.com` are selected for a requested image under `registry.example.com`, because:\n\n```js\n\"private-registry.example.com\".includes(\"registry.example.com\") === true\n```\n\nThe selected credentials are then serialized into `X-Registry-Auth` for the Docker API pull request targeting the requested registry.\n\n## Reproduction\n\nUse the attached/local proof:\n\n```sh\nnode submissions/github-gsa/cdxgen-docker-registry-auth-substring-forwarding/evidence/cdxgen_docker_registry_auth_substring_probe.mjs\n```\n\nThe proof is fully local. It creates a temporary Docker config containing credentials for `private-registry.example.com`, starts a localhost mock Docker API endpoint, sets `DOCKER_HOST` to that endpoint, then calls cdxgen's exported Docker request path for a pull from `registry.example.com`.\n\nObserved vulnerable output:\n\n```json\n{\n  \"decision\": \"GO\",\n  \"dockerConfigAuthHost\": \"private-registry.example.com\",\n  \"requestedRegistry\": \"registry.example.com\",\n  \"substringMatch\": true,\n  \"dockerApiUrl\": \"/images/create?fromImage=registry.example.com/team/app:latest\",\n  \"headerPresent\": true,\n  \"decodedHeader\": {\n    \"username\": \"trusted-user\",\n    \"password\": \"trusted-pass\",\n    \"serveraddress\": \"private-registry.example.com\"\n  }\n}\n```\n\n## Impact\n\nIf an operator has Docker credentials for a private registry and uses cdxgen to scan an image from a different registry whose hostname is a substring of that private registry hostname, cdxgen can attach the private registry credentials to the Docker pull request for the different registry.\n\nIn a realistic attack, an attacker who controls or can observe the requested registry can induce a victim to scan an image from that registry. The Docker daemon API receives an `X-Registry-Auth` payload containing credentials for the victim's private registry but associated with the attacker-requested pull. This is a credential forwarding/misbinding issue in cdxgen's container image handling.\n\n\n## References\n\nFunctions `normalizeRegistryHost` and `registriesMatch` added to normalize and perform strict host matching.\n\nFix PR: https://github.com/cdxgen/cdxgen/pull/3964\n\nResearcher: Francesco SabiuResearcher: Francesco Sabiu",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@cyclonedx/cdxgen"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "9.9.5"
      }, {
        "fixed" : "12.3.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cdxgen/cdxgen/security/advisories/GHSA-qhh4-458h-xwh2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cdxgen/cdxgen"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-346", "CWE-522" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-08T20:06:00Z",
    "nvd_published_at" : null
  }
}