Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Procedure for verification of release files lacks verification of public key #2876

Closed
3 tasks done
cardil opened this issue Feb 4, 2022 · 7 comments
Closed
3 tasks done
Assignees
Labels
bug Something isn't working

Comments

@cardil
Copy link

cardil commented Feb 4, 2022

What happened?

The procedure for verification of release files lacks verification of public key:

1. Verify the signature:
```sh
cosign verify-blob \
--cert checksums.txt.pem \
--signature checksums.txt.sig \
checksums.txt
```

The attacker could easily replace all files, including the public key. Without checking the public key is valid, users can't be sure the downloads are valid. Public key needs to be verified, before being trusted.

Proper procedure should include something like:

  1. Verify the public key fingerprint by running command:
$ base64 -d checksums.txt.pem | openssl x509 -noout -fingerprint
SHA1 Fingerprint=63:44:7F:5F:EE:A7:D9:14:20:B3:22:9F:40:25:BB:94:5D:8B:03:67

How can we reproduce this?

Go to: https://goreleaser.com/install/?h=verify#verifying-the-artifacts

goreleaser version

Do not apply

GoReleaser Check

  • goreleaser check shows no errors

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

@cardil cardil added bug Something isn't working triage Issue pending triage by one of the maintainers labels Feb 4, 2022
@caarlos0 caarlos0 removed the triage Issue pending triage by one of the maintainers label Feb 4, 2022
@caarlos0
Copy link
Member

caarlos0 commented Feb 4, 2022

Thanks @cardil

will investigate

@cardil
Copy link
Author

cardil commented Feb 8, 2022

The question would be: How users can make sure the public key they are downloading is valid? If attacker can replace release files, surly he can also craft a public key, or make changes to the website.

Cosign keyless mode solves this issue by utilizing rektor log.

Gpg public keys can be stored on keys.opengpg.org and search by email, and that gives quite strong signal the key is valid.

@caarlos0
Copy link
Member

caarlos0 commented Feb 8, 2022

Cosign keyless mode solves this issue by utilizing rektor log.

I know, this is what we're using, but for some reason it isn't allowing verify-blob without the public key

you can verify it with rekor-cli if you know the uuid:

rekor-cli get --uuid 190dbbf9ffc81cc77508cbdf3026a9acac00a879a70da8e67642d91e5221c063 --format=json |
  jq -r .Body.HashedRekordObj.signature.publicKey.content |
  base64 -d | 
  openssl x509 -text -noout

# or 

cat checksums.txt.pem | 
  base64 -d | 
  openssl x509 -text -noout

see sigstore/cosign#1406 for more info

@cardil
Copy link
Author

cardil commented Feb 8, 2022

Your problem might be the same, as I had. It turns out there are 2 types of signatures (keyless, and keyful) and the proper one needs to be used for keyless mode.

See: sigstore/cosign#1390.

@caarlos0
Copy link
Member

hey, I'm using keyless only...

@caarlos0
Copy link
Member

this is being fixed in upstream cosign sigstore/cosign#2058

cosign will still be needed to verify the signatures though.

that said, closing

@caarlos0 caarlos0 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants