/

CVE-2026-59891

Severity:

CRITICAL RISK

(9.6)

Credential Leakage (CWE-522) in sigstore-js Registry Auth

CVE-2026-59891

Awaiting Analysis

Vulnerability type

Category:

Credential Management / Sensitive Data Exposure

CWE:

CWE-522

Impact:

Credential Disclosure and Unauthorized Registry Access

Severity:

CRITICAL RISK

(9.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

sigstore-js used substring matching when selecting Docker registry credentials, causing credentials intended for one registry to be sent to another registry with a similar hostname.

If an attacker controls or can influence connections to such a registry, they may receive valid credentials for a different registry, potentially enabling unauthorized access or account takeover.

Affected context

This issue affects applications that:

  • Use sigstore-js versions prior to 0.7.1
  • Rely on getRegistryCredentials() to obtain Docker registry authentication
  • Have multiple registry credentials stored in the Docker config file (e.g., config.json)
  • Interact with registries whose hostnames may be substrings or supersets of each other

The risk is elevated in environments where private registries coexist with public or third-party registries that share partial hostname patterns.

Exploit preconditions

  • Attack surface: Outbound connections from applications using sigstore-js to container registries.
  • Required access: Ability to:
  • Operate or control a registry whose hostname overlaps by substring with a configured registry, or
  • Influence application configuration or target registry endpoints to direct traffic to such a hostname.
  • Trigger point: When getRegistryCredentials() is called, it reads the Docker config and picks credentials whose auth key contains the target registry string.
  • Why exploitation is possible: The selection logic performs a substring match rather than an exact host match, so credentials for one registry may be incorrectly selected and sent to a different registry with a partially matching hostname.

Why this happens

The root cause is a flawed credential selection algorithm that uses substring matching on registry hostnames when reading entries from the Docker configuration.

Instead of enforcing strict, canonical, host-equivalent matching, the implementation checks whether an auth key contains the target registry string, which can misassociate credentials between registries whose hostnames partially overlap.

This maps to CWE-522: Insufficiently Protected Credentials, as credentials are not properly bound to the intended authentication scope and can be disclosed to unintended parties due to weak association logic.

Potential impact

  • Leakage of valid Docker registry credentials to an unintended or attacker-controlled registry
  • Unauthorized access to private container images or repositories
  • Potential modification, deletion, or tampering with images stored in the affected registry
  • Lateral movement if the leaked credentials are reused across environments or services
  • Compromise of software supply chain via malicious image replacement or poisoning

General mitigation guidance

Defensive measures should focus on correct scoping and handling of credentials and hostname verification:

  • Ensure credential lookup uses exact, canonical host matching (including port and scheme where applicable) rather than substring or prefix checks.
  • Normalize and validate registry hostnames before performing any lookup, applying consistent rules for trailing slashes, ports, and case sensitivity.
  • Restrict the number of registries and credentials stored in shared Docker configuration files, separating highly sensitive registries into distinct contexts where feasible.
  • Apply least privilege to registry accounts: limit permissions to read-only where possible and avoid reusing the same credentials across multiple registries or environments.
  • Treat outbound connections to registries as sensitive operations, layering network policies, TLS verification, and explicit allowlists for trusted registry hosts.

How teams detect issues like this

Detection can center on code-level review and runtime observation:

  • Use static analysis or manual review to flag credential selection logic that:
  • Uses substring, prefix, or suffix matching for hostnames
  • Compares registry identifiers without normalization or canonicalization
  • Enforce code review checklists that explicitly ask how credentials are bound to hosts and whether lookups are exact-match and case-aware.
  • Deploy logging around credential retrieval paths, including the requested registry host and the matched config entry, then review for mismatches or unexpected associations.
  • Monitor registry access logs for anomalous authentication patterns, such as valid credentials being used from unexpected registries or IP ranges.
  • Consider automated security tools that scan dependencies for known credential-handling issues and highlight uses of registry helpers with weak matching logic.

Sources

SourceLink
github.comgithub.com/sigstore/sigstore-js/commit/85c58380758b97ce1b74ef470e55cc21f9d3aa89
github.comgithub.com/sigstore/sigstore-js/releases/tag/%40sigstore%2Foci%400.7.1
github.comgithub.com/sigstore/sigstore-js/security/advisories/GHSA-pf56-329r-95rw

Frequently asked

questions

Exploitability depends on the presence of overlapping registry hostnames and the ability of an attacker to control or impersonate one of those registries. In such configurations, the vulnerability can be leveraged remotely to obtain valid credentials.

An attacker typically needs to run or control a registry whose hostname overlaps by substring with a configured registry, or be able to direct the application to connect to such a registry (for example, by influencing configuration, environment, or network endpoints).

Implement exact, canonical hostname matching for credential lookups and ensure that credentials are tightly bound to a single, verified registry identity. Avoid any credential selection logic based on partial string matches or ambiguous identifiers.

Treat credentials as scoped to explicit principals: normalize hostnames, enforce strict equality when associating credentials with services, avoid reuse of credentials across domains, and incorporate security reviews of authentication and configuration-parsing code paths into your development lifecycle.

Find out what's already
exploitable in your codebase.