Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSecurity model / TUF #75
Comments
This comment has been minimized.
This comment has been minimized.
vladimir-v-diaz
commented
Dec 4, 2014
|
Hi Rust community, I am one of the developers working on the The Update Framework (TUF). If any In addition to the documentation provided by Tony Arcieri (@tarcieri), you may find our integration proposal for the Python Package Index (PyPI) interesting. The PEP 458: http://legacy.python.org/dev/peps/pep-0458/ |
This comment has been minimized.
This comment has been minimized.
|
Thanks for the offer @vladimir-v-diaz! I'll be sure to reach out to you if we need help :) For now I'm going to be focusing a large amount of effort towards Rust's standard library, so this may be postponed for awhile, but I'd love to see something like this implemented! |
This comment has been minimized.
This comment has been minimized.
l0kod
commented
Feb 8, 2015
|
Some proposals in rust-lang/cargo#1281. Is there any news for this issue? It would be good to have a trusted crates.io-index for Rust 1.0. |
This comment has been minimized.
This comment has been minimized.
richo
commented
Feb 9, 2015
|
I've had this tab open for months. If someone else spearheads I can work on On Sunday, February 8, 2015, Mickaël Salaün notifications@github.com
|
This comment has been minimized.
This comment has been minimized.
|
@l0kod I have done no work on this but would be interested in collaborating. I helped write a partial implementation of TUF for RubyGems, but we never managed to carry it over the finish line. |
l0kod
referenced this issue
Feb 11, 2015
Closed
rustup.sh and underlying binaries authentication #16442
vladimir-lu
referenced this issue
Feb 16, 2015
Closed
Downloads of source code and nightly builds not verified #83
This comment has been minimized.
This comment has been minimized.
kamalmarhubi
commented
May 2, 2015
|
Is this being worked on? I've recently been interested in verifiable provenance of software artefacts, and would be much more comfortable if Rust and Crates.io had a better story here. I'd be willing to help with drafting an RFC drawing on PEP 458 and PEP 480 mentioned above. This is not an area of expertise for me, so I'll need to consult others, but it sounds like some with more experience are interested in helping. |
This comment has been minimized.
This comment has been minimized.
|
@kamalmarhubi to my knowledge this is not actively being worked on unfortunately |
This comment has been minimized.
This comment has been minimized.
|
@kamalmarhubi if you're interested in working on this, the creators of TUF are at least pretty responsive on their mailing list: |
This comment has been minimized.
This comment has been minimized.
vladimir-v-diaz
commented
May 3, 2015
|
@kamalmarhubi We'd be happy to collaborate with you on an RFC draft for the Rust community. Did we meet at PyCon 2015? As @tarcieri suggested, our mailing list would be a good place to start a discussion. @JustinCappos @Dachshund and I are available to work with you on this draft. Note: The Python proposal was recently updated and is available here |
This comment has been minimized.
This comment has been minimized.
kamalmarhubi
commented
May 4, 2015
|
@tarcieri thanks for the link! @vladimir-v-diaz I was definitely at PyCon, but I'm terrible at names and faces. To help narrow things down: I was session chair for a couple of sessions, and spent a lot of time in the green room. I am sad I missed the poster on this topic though! What's the best venue to get in touch about this topic? This bug? TUF mailing list? Somewhere else? |
This comment has been minimized.
This comment has been minimized.
|
@kamalmarhubi I'd recommend the TUF mailing list as a starting place. This is something I'm interested in working on, but I'd also like to help finish up applying TUF to RubyGems before I'd have time to start working on a TUF implementation for Rust. I'm familiar with both TUF and Rust though, as well as Cargo, and just generally am way too overinterested in cryptography and infosec so at the very least I can help consult / review code if you'd like to do the implementation work! |
This comment has been minimized.
This comment has been minimized.
kamalmarhubi
commented
May 5, 2015
|
@tarcieri sounds good. I'll send an intro email there soon enough. :-) |
edunham
added
the
infrastructure
label
May 29, 2015
edunham
self-assigned this
Jun 29, 2015
steveklabnik
referenced this issue
Dec 11, 2015
Closed
Cargo should not download, compile and install unsigned code #2206
This comment has been minimized.
This comment has been minimized.
genodeftest
commented
Dec 12, 2015
|
Any progress on this? I suggest some immediate changes:
As long as these (or equivalent) measures aren't taken, every developer and user of rust-based software out there is at high risk. |
This comment has been minimized.
This comment has been minimized.
|
@genodeftest perhaps we need to back up and look at the actual threats:
So your problem is that All that said, as far as I know, beyond that But I think you're slightly overstating the severity of the issue, and making a bunch of recommendations that are half-measures that wouldn't significantly improve the security of the system but would certainly harm the cargo user experience. To go through these:
TUF implements what is effectively a non-X.509 PKI specifically designed for the purposes of authorizing developers to sign certain packages in the system, and without the added undue complexity needed to handle non-codesigning use cases. In a TUF PKI, someone like Mozilla would run a developer CA. Developers would provide some form of authentication along with a public key to be signed. The operators of the CA can then sign the developer keys offline (using e.g. an HSM, Yubikey, etc) and publish the signed keys via crates.io.
I find that #1 is impractical and doesn't typically end up working out the way people would like it to. #3 doesn't add much effective security, and has a poor user experience, constantly prompting the user whenever there's any breakage in key continuity, and providing no additional context as to what happened. So, my vote is for a centrally managed PKI, and more specifically for TUF. As one last note: TUF is a hybrid system which allows "unclaimed" packages to be centrally signed by the packaging system, and "claimed" packages to be signed by one or more developers. This means under TUF, all packages are signed in some form. Even packages published before the addition of the signing system can be retroactively signed. I think unless you find some way to solve this problem, a package signing system has little value. @genodeftest I sense some urgency on your part, but this is a problem I'd really rather see done right as opposed to rushed out the door just to have "something". Unless it solves the problem of signing every crate, and doing so in a way that does not require every developer to get a cryptographic key to publish crates (impossible already as crates have already been published without associated cryptographic keys), and it does not require the user make lots of decisions about which keys to trust or how to bootstrap the system trust model, I don't think it's helpful. So those are my two requirements for a good package signing system:
|
This comment has been minimized.
This comment has been minimized.
genodeftest
commented
Dec 13, 2015
I forgot one point: even if a git repo is fetched via HTTPS, how can we be sure that nobody put other commits into a git repo? Seems like TUF has some solution to that too. But it isn't implemented yet.
You could sign those git commits afterwards. That's how many people do releases: Put a git tag up, create an archive and sign the archive. If the crates index could do the signing, it must make sure that only the intended author can submit this archive/checksum/whatever. Sorry, I was kinda overreacting, possibly because I didn't get the features yet implemented. I think this issue is urgent though.
+1
But do some authentication against the author to do that. |
This comment has been minimized.
This comment has been minimized.
I think this can be mitigated by blocking or warning on plaintext git repos. Perhaps they can be blocked by default, with an option to allow crazy people to use plaintext git. Anyway, I think that should be handled as a separate issue than this one.
I think in general handling signatures with git repos will be difficult. A commit hash for a dependency can be included in the signed metadata for a given crate, but that only helps the case where a signed crate references another crate over git. For the case of If "TUF for Rust" used GPG to implement signatures and had a keyring of anyone who's ever published a crate to crates.io, you could validate signed commits or tags against that GPG keyring, but without knowing specifically which key to trust the best thing you can do is tell the user you found some key in the keyring, and then ask the user to make a decision about whether it's the correct one. I think these systems which rely on user choice for security don't really add a lot of value.
Exactly how much identity verification will happen is really up to whoever runs the developer CA (just gonna say Mozilla from here on out). I expect they will want the CA to be completely automated. From what I can tell, OAuth2 with GitHub is the only source of authentication / authorization that crates.io presently uses. It'd be nice if authorizing a given public key for a particular crates.io account had some degree of authentication beyond that. crates.io seems to pull in email addresses from GitHub after you first link an account, so it could at least be a combination of being authorized with OAuth2 and clicking a particular link in your email. I expect Mozilla lacks the time and resources to do any sort of non-automated identity verification beyond that. |
This comment has been minimized.
This comment has been minimized.
|
Crates on crates.io referencing other crates in git repos shouldn't be a problem anyway as crates.io requires that all dependencies of a crate must be on crates.io as well. If there was a way for me to assign a key to my crates.io account and sign all my crates with my key when publishing them, I'd definitely be in favor of that. |
This comment has been minimized.
This comment has been minimized.
|
@retep998 I haven't actually tried this, but can you publish a crate that has a git dependency? |
This comment has been minimized.
This comment has been minimized.
|
@tarcieri Nope, it will reject it. |
This comment has been minimized.
This comment has been minimized.
|
@retep998 if that's the case, it simplifies the security model to static files only, which is a great property |
This comment has been minimized.
This comment has been minimized.
ticki
commented
Jan 17, 2016
|
Another (very conservative) approach would be to deprecate version wildcards. This would also improve stability. |
This comment has been minimized.
This comment has been minimized.
|
@ticki We're already deprecating version wildcards on crates.io! |
This comment has been minimized.
This comment has been minimized.
vks
commented
Jan 18, 2017
As far as I know, no one started working on this. (I have a very early port of the TUF reference implementation to Rust somewhere, but I'm currently not working on it actively.) |
This comment has been minimized.
This comment has been minimized.
zmanian
commented
Jan 19, 2017
•
|
Any thoughts on how to add signing the build processes in rust-lang/rust/issues/38531 |
This comment has been minimized.
This comment has been minimized.
goldenMetteyya
commented
Feb 26, 2017
|
Is this being worked on? |
This comment has been minimized.
This comment has been minimized.
|
Yes, I believe @Manishearth is going to start working on it |
This comment has been minimized.
This comment has been minimized.
|
(Not 100% sure if I will, but yes, working on getting through the spec and finding other folks wanting to collaborate) |
This comment has been minimized.
This comment has been minimized.
heartsucker
commented
Apr 11, 2017
|
Anyone who is interested, my company is implementing this in Rust at the moment, and I'm pulling the bits I can out into a standalone lib. If anyone wants to contribute, I'd love the help. https://github.com/heartsucker/rust-tuf Also, oh hey @JustinCappos. No surprise seeing you here. |
This comment has been minimized.
This comment has been minimized.
kamalmarhubi
commented
Apr 11, 2017
|
@heartsucker this is fantastic! As @JustinCappos and others here know, I wanted to work on this but have been failing at it for about two years now. I actually ran |
This comment has been minimized.
This comment has been minimized.
|
I'm really busy this month so I'm probably not going to be able to help out too much. Still, willing to do some reviews and stuff. |
This comment has been minimized.
This comment has been minimized.
JustinCappos
commented
Apr 12, 2017
|
Good to see you here as well. We're looking forward to help out!
Just let us know if you have any questions or issues.
…On Tue, Apr 11, 2017 at 2:18 PM, heartsucker ***@***.***> wrote:
Anyone who is interested, my company is implementing this in Rust at the
moment, and I'm pulling the bits I can out into a standalone lib. If anyone
wants to contribute, I'd love the help.
https://github.com/heartsucker/rust-tuf
Also, oh hey @JustinCappos <https://github.com/JustinCappos>. No surprise
seeing you here.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#75 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA0XD9k75tdzaWcaEgnK07idez4-2xUZks5ru8QMgaJpZM4C_rBb>
.
|
This comment has been minimized.
This comment has been minimized.
est31
commented
Jul 31, 2017
|
There is also binary transparency, which is pretty cool... I think crates.io should adopt it as well as TUF. According to a conversation on IRC with @ckerschb the client part in Firefox will be implemented in C++ and JS, but maybe the server part (python) can be shared. |
This comment has been minimized.
This comment has been minimized.
demurgos
commented
Aug 2, 2017
|
There was a recent HN discussion about a malicious package on npm using typo-squatting. Would the security model proposed in this issue help to mitigate this sort of attack against crates.io? |
This comment has been minimized.
This comment has been minimized.
heartsucker
commented
Aug 2, 2017
•
|
No. TUF would not be able to help with that. TUF only says "package
In the way TUF would most likely be deployed to crates.io, there would need to be a manual key revocation and package removal of an evil crate. However, TUF could prevent the case of a single rouge maintainer from pushing a package by requiring a threshold of signatures from some TUF protects against repository compromise, not intentionally malicious packages. |
carols10cents
added
the
C-feature-request
label
Aug 2, 2017
edunham
removed their assignment
Sep 7, 2017
burdges
referenced this issue
Dec 22, 2017
Open
AnarchKey: Experimental PKI for Securing Software Updates #5
ebkalderon
referenced this issue
Jun 14, 2018
Open
End-to-end integrity of crates in registries #4768
This comment has been minimized.
This comment has been minimized.
|
I created a PR to @withoutboats's signing registry index commits PR which uses TUF roles and formats: |
This comment has been minimized.
This comment has been minimized.
Yoric
commented
Dec 12, 2018
|
Probably related: I just posted a fairly simple idea to mitigate risks from malicious crates. |
This was referenced Jan 6, 2019
This comment has been minimized.
This comment has been minimized.
|
For anyone interested in crate security, there's cargo-crev project working on verifying crate security, and creating a web of trust for crate authors. |
This comment has been minimized.
This comment has been minimized.
JustinCappos
commented
Jan 10, 2019
|
I've taken a look and the web-of-code-review aspect is quite neat. I'm
slightly skeptical about how this scales (due to lessons from Debian, etc.
trying somewhat similar things), but I like how it is more informational
and on the code review side. That different flavor may make this work in
ways that others have failed.
Do you have interest in adding more resilience to an attacker manipulating
proofs or messing with CrevIDs? It would be good to have some sort of
protection from old proofs being replayed, key revocation in case someone
compromises an account, etc.
|
This comment has been minimized.
This comment has been minimized.
|
I think an incentivized code review system makes a great deal of sense and would really like to see some successes in that area, and crev looks quite promising, however I think it's somewhat orthogonal to the issues I originally raised in this thread, which are generally "Is the code authentic code created by the purported authors" versus "Is the code good/safe/secure?" |
This comment has been minimized.
This comment has been minimized.
jchesterpivotal
commented
Jan 10, 2019
•
Agreed. TUF defends against a different threat model: can an attacker replace or modify packages? Can the attacker mislead you into rolling back your packages, or into not upgrading at all? Can an attacker force you to install inconsistent combinations of packages? Crev addresses different questions: do I trust the author of the package? Do I trust a particular version of the package? Of the two I consider TUF's problems to be more pressing. Being able to flush out a bad package version quickly and safely will be required in order to take full advantage of trustworthiness assertions about particular package versions. |
tarcieri commentedNov 24, 2014
The fun thing about packaging systems with central package directories is the central package directories have this annoying tendency to be compromised. There have been a few such notable compromises in recent history, such as RubyGems and npm. Fortunately no serious problems resulted in either of these attacks they were both detected early, but a more sinister attack could go undetected, poisoning the package repository and spreading malware.
One way to stop this is to move the source of authority for the integrity of packages from the package repository to the developers of packages. However, managing keys is hard, and many people simply won't want to do this. Furthermore, you have to worry about how to retrofit the existing packages into this model if your packaging system didn't launch with developer-managed keys from day one (which Cargo didn't)
There's a system that solves all these problems called The Update Framework (TUF), collaboratively developed by both Tor developers and academics:
http://theupdateframework.com/
The Update Framework allows developers to opt-in to managing their own keys. High profile packages can be signed by developers: specifically, TUF supports "threshold signatures" so k / n developers are needed to countersign a package in order for it to count as released. However, not everyone is forced to manage their own keys: people who don't want to can have their packages signed by the package repository instead.
TUF secures developer keys by having developers who own "unclaimed" packages request to associate some signing keys with them. A system administrator then periodically (once a week or other tolerable time interval) signs these developer keys with an offline key (or keys, TUF uses threshold signatures everywhere). At this point, these packages move from "unclaimed" to "claimed", and become what TUF calls a "delegated target": the developers, not the packaging system, become the source of truth for that particular package.
For more information, I suggest you read their paper "Survivable Key Compromise In Software Update Systems":
http://freehaven.net/~arma/tuf-ccs2010.pdf
I think a system like TUF can easily be retrofitted to Cargo as it exists today. There are a few changes I might recommend before you try to add TUF, but I think you're off to a good start.
However, if you did want to use something like TUF, it does figure into the overall AuthZ model of the system. There are a number of outstanding AuthZ issues / suggestions like #48 and #58. If you do want to integrate a system like TUF where developers manage their own keys, it will definitely influence whatever AuthZ model you adopt, because TUF moves things like authorization and integrity partly to the client.
I worked on adding TUF to RubyGems at one point and liked it, although we never finished. The people behind it worked on adding it to PyPI, and were very helpful with our efforts to add it to RubyGems.