Sigstore/OCI Credential Confusion Vulnerability (CVE-2026-59891)
A critical credential exposure vulnerability (CVE-2026-59891) exists in `@sigstore/oci` versions prior to 0.7.1. The `getRegistryCredentials()` function, used to read credentials from `~/.docker/config.json`, employs a substring match instead of an exact host match when selecting credentials. This flaw allows credentials for a legitimate registry (e.g., `ghcr.io`) to be inadvertently transmitted to an attacker-controlled registry if its hostname is a substring of the legitimate one (e.g., `cr.io`). This impacts consumers of `@sigstore/oci` and related GitHub Actions (`actions/attest`, `actions/attest-build-provenance`, `actions/attest-sbom`) when pushing artifacts to untrusted or attacker-influenced destination registries, potentially leading to the leakage of long-lived registry tokens. The vulnerability is fixed in `@sigstore/oci@0.7.1` by enforcing exact host matching.
A critical credential exposure vulnerability, tracked as CVE-2026-59891, has been identified in @sigstore/oci versions <= 0.7.0. This flaw resides within the getRegistryCredentials() function, which is responsible for retrieving OCI registry authentication tokens from the Docker configuration file (~/.docker/config.json). The vulnerability stems from an insecure credential selection mechanism that uses a substring match instead of a precise host match. This means that credentials configured for a legitimate registry (e.g., ghcr.io) could be mistakenly associated with, and subsequently transmitted to, an attacker-controlled registry if its hostname is a substring of the legitimate one (e.g., cr.io). This impacts any application using @sigstore/oci to upload artifacts, including @actions/attest and the actions/attest, actions/attest-build-provenance, and actions/attest-sbom GitHub Actions, particularly when the destination registry or image reference (subject-name input) can be influenced by untrusted sources. This could lead to the leakage of long-lived registry tokens to malicious actors. The vulnerability was patched in @sigstore/oci@0.7.1, which implements exact host matching.
Attack Chain
- An attacker identifies a target system utilizing
@sigstore/oci(or GitHub Actions likeactions/attest) for pushing artifacts to OCI registries. - The attacker researches or infers that the target system has configured credentials for a legitimate OCI registry (e.g.,
ghcr.io) stored in its~/.docker/config.json. - The attacker registers or gains control over a malicious OCI registry with a hostname that is a substring of the legitimate registry's hostname (e.g.,
cr.ioforghcr.io). - The attacker influences the target system to push artifacts to the attacker-controlled registry by manipulating the destination registry or image reference. In the context of GitHub Actions, this might involve influencing the
subject-nameinput whenpush-to-registry: true. - During the artifact push operation, the
@sigstore/ocilibrary callsgetRegistryCredentials()to retrieve authentication. - Due to the substring matching logic,
getRegistryCredentials()incorrectly selects the credentials intended forghcr.io(becausecr.iois a substring). - The
@sigstore/ocilibrary then transmits these long-lived registry credentials to the attacker-controlled registry (cr.io). - The attacker captures the stolen registry credentials, gaining unauthorized access to the legitimate registry.
Impact
The primary impact of CVE-2026-59891 is the potential exposure of sensitive, long-lived OCI registry credentials. Any consumer of @sigstore/oci or related GitHub Actions (such as actions/attest, actions/attest-build-provenance, and actions/attest-sbom) that pushes artifacts using credentials from a Docker configuration file is susceptible. While no specific victim count is provided, the theoretical worst-case scenario involves the theft of valuable authentication tokens, granting attackers unauthorized access to artifact repositories, enabling supply chain attacks, or facilitating further lateral movement. Exploitation requires specific conditions: credentials in the Docker config, untrusted influence over the destination registry, and an attacker-controlled registry with a substring hostname.
Recommendation
- Patch CVE-2026-59891 immediately: Upgrade
@sigstore/ocito version0.7.1or later to fix the credential selection logic. - Update GitHub Actions: Ensure that your GitHub Actions workflows using
actions/attest,actions/attest-build-provenance, oractions/attest-sbomare updated to versions that bundle the patched@sigstore/ocilibrary. - Validate input: Treat the destination registry/image reference as trusted input; do not allow untrusted sources to influence the registry/image reference passed to
@sigstore/ocior thesubject-nameofactions/attest*whenpush-to-registry: true. - Limit
~/.docker/config.jsoncredentials: Restrict the credentials available in the host's Docker config file (~/.docker/config.json) to only those strictly necessary for operations, and avoid authenticating to registries whose hostnames could have substring relationships with potential untrusted destinations. - Scope tokens narrowly: Prefer using narrowly scoped and short-lived registry tokens to minimize the impact of potential credential leakage.