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

Shall standard library vulnerabilities also be in scope of cargo-audit? #46

Closed
vi opened this issue Sep 25, 2018 · 10 comments
Closed

Shall standard library vulnerabilities also be in scope of cargo-audit? #46

vi opened this issue Sep 25, 2018 · 10 comments

Comments

@vi
Copy link

vi commented Sep 25, 2018

Example: https://www.reddit.com/r/rust/comments/9hssab/security_announcement_for_strrepeat/

@tarcieri
Copy link
Member

We had a discussion about this on the Security WG kickoff call a few days ago. Some tentative takeaways were that:

  1. RustSec should be folded into the Security WG
  2. RustSec should track these types of vulnerabilities

@tarcieri
Copy link
Member

tarcieri commented Oct 14, 2018

There's a tentative plan to do this. I can propose a rough outline of what I'd have in mind for it:

  1. Make a std/ directory in the toplevel of the repo which sits side-by-side with crates/
  2. Use the same advisory format, but with std as the package name and the Rust version (i.e. the rustc version) as the version = ...
  3. All std vulns must be identified by CVE-* (i.e. RUSTSEC-* is only for crate-level vulns). This is easy to implement as the rustsec crate already uses an enum for all vuln IDs which can handle several kinds of identifiers

After that, we'd need to find (or create) an authoritative list of all previous vulnerabilities in std, and potentially file retroactive CVEs for any of them which never received one.

@alex
Copy link
Member

alex commented Oct 15, 2018

Quick skim of previously identified security issues in rust-core; only two of them are in std

@tarcieri
Copy link
Member

tarcieri commented Oct 15, 2018

Okay so that's:

Not sure what to do about Rust 1.13 regarding a canonical identifier... I guess we could list all of the relevant vulns for those curl and openssl versions?

@alex
Copy link
Member

alex commented Oct 15, 2018

CVE-2018-1000622 for the rustdoc one. I don't believe there's one for the cargo change (it's also not really notable IMO).

@Shnatsel
Copy link
Member

I've thought about this for a while, and here's a bunch of things we could do about std or compiler vulnerabilities:

  1. Alert people if their local compiler is vulnerable
  2. Alert people if something installed via cargo was built with a vulnerable compiler version
  3. Alert people if their crate uses a function that is known to be vulnerable in some compiler versions

I see (1) as more of a job for rustup than for cargo-audit. We can't just say that all versions before 1.29.1 are vulnerable, because e.g. Linux distributions backport security fixes. rustup is probably the only distribution method where vulnerable versions can be detected reliably, and it already syncs with a remote database and alerts you about updates, so that's probably where vulnerability notifications should go. This can also handle (2) by spitting out a command to rebuild all packages installed via cargo after installing a security update.

I'm not sure whether (3) is useful in any way. There's not much the crate maintainer can do about that. Well, he can add a minimum required version to the crate, but it's a waste of time to do that manually and may refuse to build for no reason on compilers with backported security fixes.

@tarcieri
Copy link
Member

tarcieri commented Oct 15, 2018

For a start, I'd like to get them catalogued somewhere, and write APIs to access them from the rustsec crate.

The itch I'd ultimately like to scratch for myself is being able to identify historical builds (e.g. container images) containing artifacts built with vulnerable versions of the compiler/std.

That said, I think it's fine for cargo-audit to do (1) at least for now. I think it'd be great to get it into rustup as well, and perhaps we can do that via the rustsec crate.

@Shnatsel
Copy link
Member

I'm now even more interested in cataloguing these because it turns out that rustc already encodes its version in all executables it compiles.

Try strings /path/to/executable | grep 'rustc version'. But don't run strings on untrusted files.

@DevQps
Copy link

DevQps commented Mar 16, 2019

Just to bump to the original question!: Personally I think std should be in the scope of cargo audit as well. Since 'std' is a reserved crate name I wonder what would be against us putting it along side other crates as well? Maybe we could change RUSTSEC- to CVE-, but I don't think using RUSTSEC-* for std would be bad as well, since it is basically just like any other crate aside some special compiler integration maybe. Not differentiating too much from other crates will probably make future APIs easier to use.

But I might be wrong about all this though! However if we feel like they are not in the scope of cargo-audit we should probably close this issue.

tarcieri added a commit to rustsec/advisory-db that referenced this issue Sep 2, 2019
Files vulnerabilities in the standard library originally reported at:

https://groups.google.com/forum/#!forum/rustlang-security-announcements

Or otherwise collected at:

rustsec/rustsec#46

The `rustsec` crate doesn't presently consume these, but I'd like to add
support ASAP.
tarcieri added a commit to rustsec/advisory-db that referenced this issue Sep 2, 2019
Files vulnerabilities in the standard library originally reported at:

https://groups.google.com/forum/#!forum/rustlang-security-announcements

Or otherwise collected at:

rustsec/rustsec#46

The `rustsec` crate doesn't presently consume these, but I'd like to add
support ASAP.
tarcieri added a commit to rustsec/advisory-db that referenced this issue Sep 2, 2019
@tarcieri
Copy link
Member

tarcieri commented Sep 8, 2019

The known std vulns have been added to the Advisory DB: rustsec/advisory-db#146

tarcieri added a commit that referenced this issue May 7, 2021
README.md: Move "Documentation" link up
tarcieri added a commit that referenced this issue May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants