Описание
Improper Certificate Validation in Cosign
Impact
Cosign can be manipulated to claim that an entry for a signature exists in the Rekor transparency log even if it doesn't. This requires the attacker to have pull and push permissions for the signature in OCI. This can happen with both standard signing with a keypair and "keyless signing" with Fulcio.
Signing with a keypair
To reproduce this vulnerability, create a keypair and sign an image. Don't store the signature in Rekor:
If an attacker has access to the signature in OCI, they can manipulate cosign into believing the entry was stored in Rekor even though it wasn't. To accomplish this, the attacker needs to:
- Pull the signature image
- Annotate the signature image with any valid Rekor bundle under the
dev.sigstore.cosign/bundleannotation - Push the signature image back to OCI
Verification then prints out the following:
The claim that Existence of the claims in the transparency log was verified offline is inaccurate since an entry for this image doesn't exist in the log.
The claim that Any certificates were verified against the Fulcio roots. is technically correct but since there were no certificates that should be explicitly called out.
"Keyless signing" with an OIDC flow
To reproduce this vulnerability, sign the image with a Fulcio identity. Don't store the signature in Rekor:
Then, create a keypair and sign the image again. Store an entry for the signature in Rekor:
If an attacker has access to the signature in OCI, they can manipulate cosign into believing the entry was stored in Rekor even though it wasn't. To accomplish this, the attacker needs to:
- Pull the signature image
- Copy the rekor bundle from the second signature into the first signature under the
dev.sigstore.cosign/bundleannotation - Push the signature image back to OCI
Note: For this to work, both signatures must occur during the valid lifespan of the certificate (~20 minutes).
Verification then prints out the following:
The claim that Existence of the claims in the transparency log was verified offline is inaccurate since an entry for this image doesn't exist in the log.
The claim that Any certificates were verified against the Fulcio roots. is technically correct but since there were no certificates that should be explicitly called out.
Patches
The vulnerability has been patched in v1.5.2 of cosign.
The signature in the signedEntryTimestamp provided by Rekor is now compared to the signature that is being verified. If these don't match, then an error is returned. If a valid bundle is copied to a different signature, verification should fail.
Cosign output now only informs the user that certificates were verified if a certificate was in fact verified.
Workarounds
The only workaround is upgrading.
For more information
If you have any questions or comments about this advisory:
Thank you
Thank you to @mtrmac for finding and reporting this vulnerability.
Thank you to everyone who worked on fixing this:
- @nsmith5
- @znewman01
- @dlorenc
- @mattmoor
- @priyawadhwa
Пакеты
github.com/sigstore/cosign
< 1.5.2
1.5.2
Связанные уязвимости
Cosign provides container signing, verification, and storage in an OCI registry for the sigstore project. Prior to version 1.5.2, Cosign can be manipulated to claim that an entry for a signature exists in the Rekor transparency log even if it doesn't. This requires the attacker to have pull and push permissions for the signature in OCI. This can happen with both standard signing with a keypair and "keyless signing" with Fulcio. If an attacker has access to the signature in OCI, they can manipulate cosign into believing the entry was stored in Rekor even though it wasn't. The vulnerability has been patched in v1.5.2 of Cosign. The `signature` in the `signedEntryTimestamp` provided by Rekor is now compared to the `signature` that is being verified. If these don't match, then an error is returned. If a valid bundle is copied to a different signature, verification should fail. Cosign output now only informs the user that certificates were verified if a certificate was in fact verified. The
Cosign provides container signing, verification, and storage in an OCI ...