Impact
A Cosign bundle can be crafted to successfully verify an artifact even if the embedded Rekor entry does not reference the artifact's digest, signature or public key. When verifying a Rekor entry, Cosign verifies the Rekor entry signature, and also compares the artifact's digest, the user's public key from either a Fulcio certificate or provided by the user, and the artifact signature to the Rekor entry contents. Without these comparisons, Cosign would accept any response from Rekor as valid. A malicious actor that has compromised a user's identity or signing key could construct a valid Cosign bundle by including any arbitrary Rekor entry, thus preventing the user from being able to audit the signing event.
This vulnerability only affects users that provide a trusted root via --trusted-root or when fetched automatically from a TUF repository, when no trusted key material is provided via SIGSTOREREKORPUBLICKEY. When using the default flag values in Cosign v3 to sign and verify (--use-signing-config=true and --new-bundle-format=true for signing, --new-bundle-format=true for verification), users are unaffected. Cosign v2 users are affected using the default flag values.
This issue had previously been fixed in https://github.com/sigstore/cosign/security/advisories/GHSA-8gw7-4j42-w388 but recent refactoring caused a regression. We have added testing to prevent a future regression.
Steps to Reproduce
echo blob > /tmp/blob cosign sign-blob -y --new-bundle-format=false --bundle /tmp/bundle.1 --use-signing-config=false /tmp/blob cosign sign-blob -y --new-bundle-format=false --bundle /tmp/bundle.2 --use-signing-config=false /tmp/blob jq ".rekorBundle |= $(jq .rekorBundle /tmp/bundle.2)" /tmp/bundle.1 > /tmp/bundle.3 cosign verify-blob --bundle /tmp/bundle.3 --certificate-identity-regexp='.' --certificate-oidc-issuer-regexp='.' /tmp/blob
Patches
Upgrade to Cosign v2.6.2 or Cosign v3.0.4. This does not affect Cosign v1.
Workarounds
You can provide trusted key material via a set of flags under certain conditions. The simplest fix is to upgrade to the latest Cosign v2 or v3 release.
Note that the example below works for cosign verify, cosign verify-blob, cosign verify-blob-attestation, and cosign verify-attestation.
SIGSTOREREKORPUBLICKEY=<path to Rekor pub key> cosign verify-blob --use-signing-config=false --new-bundle-format=false --bundle=<path to bundle> <artifact>
Summary
A number of vulnerabilities have been found in cosign verify-blob, where Cosign would successfully verify an artifact when verification should have failed.
Vulnerability 1: Bundle mismatch causes invalid verification.
Summary A cosign bundle can be crafted to successfully verify a blob even if the embedded rekorBundle does not reference the given signature.
Details Cosign supports "bundles" which intend to allow offline verification of the signature and rekor inclusion. By using the --bundle flag in cosign sign-blob, cosign will create a JSON file called a "bundle". These bundles include three fields: base64Signature, cert, and rekorBundle. The desired behavior is that the verification of these bundles would:
- verify the provided blob using the included signature and certificate - verify the rekorBundle SET - verify the rekorBundle payload references the given artifact.
It appears that step three is not being performed, allowing "any old rekorBundle" to pass validation, even if the rekorBundle payload does not reference the provided blob or the certificate and signature in the rekorBundle do not match those at the top level.
Steps to reproduce Enable keyless signing:
export COSIGNEXPERIMENTAL=1 Create two random blobs: dd bs=1 count=50 </dev/urandom >blob1 dd bs=1 count=50 </dev/urandom >blob2 Sign each blob: cosign sign-blob blob1 --bundle bundle1 cosign sign-blob blob2 --bundle bundle2 Create a falsified bundle including the base64Signature and cert fields from bundle1 and the rekorBundle from bundle2: jq --slurpfile bundle2 bundle2 '.rekorBundle = $bundle2[0].rekorBundle' bundle1 > invalidBundle Now, the falsified bundle can be used to verify blob1: $ cosign verify-blob blob1 --bundle invalidBundle tlog entry verified offline Verified OK
Patches
Users should update to the latest version of Cosign, 1.12.0.
Workaround
If you extract the signature and certificate from the bundle, you may use it for verification as follows and avoid using an invalid bundle: $ cosign verify-blob blob1 --signature $(jq -r '.base64Signature' bundle1) --certificate $(jq -r '.cert' bundle1)
Note that this will make a network call to Rekor to fetch the Rekor entry. However, you may then be subject to Vulnerability 4.
Vulnerability 2: Certificate Identities are not checked in some cases
Summary
When providing identity flags, the email and issuer of a certificate is not checked when verifying a Rekor bundle, and the GitHub Actions identity is never checked.
Details
Users who provide an offline Rekor bundle (--bundle) when verifying a blob using cosign verify-blob and include flags that check identity such as --certificate-email and --certificate-oidc-issuer are impacted. Additionally, users who provide the GitHub Actions verification flags such as --certificate-github-workflow-name when running cosign verify-blob without a bundle, key reference, or certificate are impacted.
When providing these flags, Cosign ignored their values. If a certificate's identity did not match the provided flags, Cosign would still successfully verify the blob.
Patches
Users should update to the latest version of Cosign, 1.12.0.
Workarounds
There are no workarounds, users should update.
Vulnerability 3: Invalid Rekor bundle without the experimental flag will result in successful verification
Summary
Providing an invalid Rekor bundle without the experimental flag results in a successful verification.
Details
Users who provide an offline Rekor bundle (--bundle) that was invalid (invalid signed entry timestamp, expired certificate, or malformed) when verifying a blob with cosign verify-blob and do not set the COSIGNEXPERIMENTAL=1 flag are impacted.
When an invalid bundle was provided, Cosign would fallback to checking Rekor log inclusion by requesting proof of inclusion from the log. However, without the COSIGNEXPERIMENTAL flag, Cosign would exit early and successfully verify the blob.
Patches
Users should update to the latest version of Cosign, 1.12.0.
Workarounds
There are no workarounds, users should update.
Vulnerability 4: Invalid transparency log entry will result in successful verification
Summary
An invalid transparency log entry will result in immediate success for verification.
Details
Users who provide a signature and certificate to verify-blob will fetch the associated Rekor entry for verification. If the returned entry was invalid (invalid signed entry timestamp, invalid inclusion proof, malformed entry with missing verification), then cosign exits early and succeeds unconditionally.
Patches
Users should update to the latest version of Cosign, 1.12.0.
Workarounds
There are no workarounds, users should update.
For more information If you have any questions or comments about this advisory: Open an issue in cosign Send us a message on Slack.
Description
cosign verify-blob-attestation may erroneously report a "Verified OK" result for attestations with malformed payloads or mismatched predicate types. For old-format bundles and detached signatures, this was due to a logic flaw in the error handling of the predicate type validation. For new-format bundles, the predicate type validation was bypassed completely.
Impact
When cosign verify-blob-attestation is used without --check-claims set to true, an attestation that has a valid signature but a malformed or unparsable payload would be incorrectly validated. Additionally, systems relying on --type <predicate type> to reject attestations with mismatched types would be lead to trust the unexpected attestation type.
Patches
v3.0.6, v2.6.3
Workarounds
Always set --check-claims=true for attestation verification.
Summary
When verifying artifact signatures using a certificate, Cosign first verifies the certificate chain using the leaf certificate's "not before" timestamp and later checks expiry of the leaf certificate using either a signed timestamp provided by the Rekor transparency log or from a timestamp authority, or using the current time. The root and all issuing certificates are assumed to be valid during the leaf certificate's validity. An issuing certificate with a validity that expires before the leaf certificate will be considered valid during verification even if the provided timestamp would mean the issuing certificate should be considered expired.
Impact
No impact to users of the public Sigstore infrastructure. This may affect private deployments with customized PKIs. In practice, this is unlikely to occur as CAs should not be issuing certificates that outlive the validity of the CA and its parents.
Workarounds
Upgrade to the latest release, or verify the certificate chain out of band.
Example to Reproduce
Root CA certificate is valid from 12pm-2pm Intermediate CA certificate is valid from 12:30pm-1:30pm Leaf certificate is valid from 1pm-3pm - Note that this is unlikely to happen in practice, as a CA shouldn't issue a certificate that would be valid after the issuing CA certificate expires Signature generated at 2:30pm with a signed timestamp During verification, the leaf certificate's not before time (1pm) is used to verify the chain - 1pm is in the validity windows for the root and intermediate CA certificates The timestamp's time is checked to be in the validity window of only the leaf certificate - 2:30pm is in the validity window for the leaf Even though the root and intermediate would be expired at 2:30pm, verification succeeds