Summary
In cosign verify-blob and cosign verify-blob-attestation, keyless verification using --certificate-identity and --certificate-oidc-issuer (or their regular expression equivalents) can be bypassed when a legacy JSON --bundle is supplied. When reading the cert field of a legacy bundle, if the contents failed to parse as an X.509 certificate, Cosign silently fell back to loading the input as a raw public key and populated co.SigVerifier. In downstream verification, whenever co.SigVerifier is set, X.509 certificate chain validation and policy enforcement (CheckCertificatePolicy) are skipped, causing --certificate-identity and --certificate-oidc-issuer flags to be ignored. This does not affect verification with the newer standardized Sigstore protobuf bundle format, which is the default in Cosign v3.
Impact
An attacker can bypass keyless identity and OIDC issuer pinning in cosign verify-blob and cosign verify-blob-attestation by supplying a legacy bundle whose cert field contains an arbitrary bare public key (-----BEGIN PUBLIC KEY-----) instead of a Fulcio X.509 certificate. Verification completes with exit code 0 and reports Verified OK, causing operators or CI/CD pipelines to trust and consume artifacts signed by an unauthorized key. Additionally, if an operator explicitly specifies --key while verifying against a legacy bundle containing a bare public key, the attacker's bundle key silently overrides the --key value. OCI container image verification (cosign verify and cosign verify-attestation) is not affected.
Detection
Inspect CI/CD pipeline invocations of cosign verify-blob or cosign verify-blob-attestation to identify calls that use --bundle with legacy JSON bundles. Audit bundle files to confirm the cert field contains a PEM-encoded X.509 certificate (beginning with -----BEGIN CERTIFICATE-----) rather than a bare public key (beginning with -----BEGIN PUBLIC KEY-----). Any pipeline that relies on --certificate-identity or --certificate-oidc-issuer for verification against a legacy bundle should be treated as potentially bypassed on affected versions.
Mitigation
Upgrade Cosign to a patched version:
- Cosign v3.x: upgrade to v3.1.3 or later
- Cosign v2.x: upgrade to v2.6.5 or later
As a workaround, migrate from legacy JSON bundles to the modern Sigstore protobuf bundle format (--new-bundle-format). The protobuf bundle verification engine is not affected by this vulnerability. Existing legacy bundles can be upgraded using cosign bundle create.
Related Security Guidance
References
- GHSA-fx35-mq7g-6g98 — GitHub Security Advisory