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

Forbid tarballs with hard links being uploaded #1448

Merged
merged 1 commit into from
Jun 29, 2018

Conversation

alexcrichton
Copy link
Member

It was discovered recently that tarballs with hard links aren't properly handled
in the tar crate and can in malicious situations cause any file on the
filesystem to get overwritten during the extraction process. This commit is a
patch for crates.io to simply reject all tarballs which have hard links inside
of them. This is a big hammer of a solution and is step 1 of a fix for this bug.

I've verified that all existing tarballs on crates.io do not contain hard links
and Cargo itself doesn't produce tarballs with hard links inside them. That
means that no legitimate tarball should be rejected as a result of this patch.
After this has been deployed I'll be updating the tar crate as well as Cargo
itself, in addition to posting an announcement.

It was discovered recently that tarballs with hard links aren't properly handled
in the `tar` crate and can in malicious situations cause any file on the
filesystem to get overwritten during the extraction process. This commit is a
patch for crates.io to simply reject all tarballs which have hard links inside
of them. This is a big hammer of a solution and is step 1 of a fix for this bug.

I've verified that all existing tarballs on crates.io do not contain hard links
and Cargo itself doesn't produce tarballs with hard links inside them. That
means that no legitimate tarball should be rejected as a result of this patch.
After this has been deployed I'll be updating the `tar` crate as well as Cargo
itself, in addition to posting an announcement.
Copy link
Member

@ashleygwilliams ashleygwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. waiting for CI and then will merge and deploy

@ashleygwilliams ashleygwilliams merged commit b532fa8 into rust-lang:master Jun 29, 2018
@alexcrichton alexcrichton deleted the no-hard-links branch June 29, 2018 17:13
alexcrichton added a commit to alexcrichton/crates.io that referenced this pull request Jun 29, 2018
alexcrichton added a commit to alexcrichton/crates.io that referenced this pull request Jun 29, 2018
This is the same as rust-lang#1448 except that it applies to symlinks as well as hard
links. It's been discovered after-the-fact that `tar` exhibits the same bug for
symlinks as it did for hard links.
bors-voyager bot added a commit that referenced this pull request Jun 30, 2018
1449: Add a test that hard links are rejected r=carols10cents

Follow-up with a test for #1448
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

Successfully merging this pull request may close these issues.

2 participants