-
Notifications
You must be signed in to change notification settings - Fork 894
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
SHA1 PGP signatures aren't supported anymore #3185
Comments
Working on a fix. |
Thanks for investigating this! I opened a PR that should suppress the warning, hopefully we'll be able to release a new Rustup version with that today. #3186 |
Thanks for being so on top of this, @pietroalbini! |
Do we need to do more work here (e.g. switch to a stronger hash in the infra channels, and resign older releases?) |
As I understand it SHA1 is used as part of signing subkeys of the root signing key. It isn't used as part of signing the actual release tarballs. |
It would be good to update the signing certificate so that it is valid without SHA-1. This can be done with e.g. Ideally, rustup would also opportunistically download the certificate in order to get updates, e.g., from |
Be careful when refreshing update keys out of band, this should only update existing keys but reject any new subkeys to not break future update transparency efforts. |
Why should new subkeys be rejected? |
The rust release key
Or in gpg output:
This means the following keys can issue signatures for updates and need to be monitored (I guess the encryption-only key can be ignored):
This is currently hard-coded into the rustup binary, as long as I can ensure the user has a legitimate copy of rustup I can be sure it's going to attempt to enforce this policy. Now if we allow subkey updates (essentially "if we allow delegation of trust"), somebody with access to
But because you don't know about this secret subkey you're still monitoring the transparency log for these two keys:
This means I could safely submit my malicious update (signed by |
Thanks for your write up. What transparency log are you talking about? I wasn't aware that rustup was using that. |
(This went slightly off-topic, feel free to skip to the next section): rustup itself isn't using any transparency log, there are two projects attempting to do this for pgp-in-general though:
Searching for the public rekor log currently yields one entry for the rust release key (
Inspecting the entry shows it's a signature over the sha256 hash
We don't know what this data was though, the rust project would need to keep a public archive of all data they've signed to allow auditing. If I recall correctly this would be an archive of all release-stable.toml, these then contain a sha256sum of the other artifacts, so if you have a complete view of all release-stable.toml you also have a complete view of all compilers that have been distributed. Anyway regarding the original issue and since I looked into the keys anyway, this is the output of
Basically the primary key
To fix this with sequoia, use:
gpg is going to ask for as password to protect the secret key, but sq-keyring-linter is going to immediately ask for the password again to issue new sha2 signatures for the uid paket and both subkeys, so it doesn't really matter what you set there. I've tried to find instructions on how to fix the key with gpg natively but it seems very involved (https://old.nixaid.com/gpg-migration-sha1-to-sha2/). It also doesn't explain how to get rid of the subkey signatures and suggests to revoke them and generate new ones (?!). Cross-referecing the release scripts, this should work: (
for x in "op://tnuk54f56audltg5e7if776ieq/67bxwduvibdkpio7psx53preka/56b6j26lmvelpn6jeecsr5fsxi" "op://tnuk54f56audltg5e7if776ieq/q6ztr2lrorg3fa3mzg6kx26bnm/m6tnrye775cefbekajhawec3ja" "op://tnuk54f56audltg5e7if776ieq/fnzoe3nw7rck7ezqhwpkj7j2xe/kjzmpsermnc4bovkwslhjd34se"; do
op read "$x"
done
) | sq-keyring-linter --fix -p "$(op read op://tnuk54f56audltg5e7if776ieq/pks4bn2wf4r7plue24cdqsw4ga/password)" | gpg --import
# in rustup codebase
gpg --armor --export rust-key@rust-lang.org > src/rust-key.pgp.ascii If you just want to go with a new key and you want to go with gpg again, put this in your
Sorry this reply got so long, if anything is unclear please just let me know. |
I had assumed we'd update the embedde certificate in rustup via new rustup release rather than sideloading keys. We need to do that in some form of expand-contract so that rustup's self-update continues to work across the transition. |
I reverse engineered the rustup self-update recently and the pgp signatures aren't fully in use yet. rustup fetches this url:
If this version is less recent than rustup's own version (say 1.25.1) it's going to fetch and execute the elf file from this url next: Security is provided by https and pgp signatures aren't mandatory yet, so rolling out the update shouldn't cause issues. I have unit-tests for rustup here: https://github.com/kpcyrd/sh4d0wup/blob/main/contrib/plot-rustup.yaml |
Let's not bikeshed a key rotation mechanism in this thread, but let's focus on removing the SHA1 signatures from the existing key. Key rotation (and in general enforcing signatures) would require a larger design effort, and I know it's one of the priorities of the foundation security engineer. |
Problem
As described here: https://www.reddit.com/r/rust/comments/10qlf1q/nightly_dc1d9d50f_20230131_signature_verification/
rustup update and rustup check report that https://static.rust-lang.org/dist/channel-rust-nightly.toml / https://static.rust-lang.org/dist/channel-rust-nightly.toml.asc aren't valid anymore.
Steps
Manually
sqv is from
cargo install sequoia-sqv
.Possible Solution(s)
This should be fixed outside rustup, but I don't know where to file a report on the release process. Please switch away from using SHA1 in keys or signatures.
Notes
No response
Rustup version
Installed toolchains
nightly-x86_64-unknown-linux-gnu
The text was updated successfully, but these errors were encountered: