Security advisory for crates.io
users.rust-lang.org
users.rust-lang.org
2017-09-13 @ 19:19 - Justin sends mail to security@rust-lang.org about this
2017-09-13 @ 19:28 - response sent to Justin acknowledging the vulnerability
2017-09-13 @ 21:14 - a patch to crates.io was finished, all current tarballs verified not-malicious
If you follow the link to the security announcement list, you can see the one other advisory we've had since 1.0 as well.
Unix chroot provides precisely the behavior desired here; unfortunately it requires root privileges.
Capsicum introduced the O_BENEATH flag to the openat(2) system call. openat(somedirfd, path, O_BENEATH) will fail if the path references a file above somedirfd. Unfortunately I don't think it has yet made it into Linux or FreeBSD, no doubt because the semantics are trickier than you'd think (there are very good reasons why chroot is limited to root, so you can't simply reuse the chroot infrastructure). See https://lwn.net/Articles/619146/ and https://reviews.freebsd.org/D2808 and http://capsicum-linux.org/
Safety is a spectrum. Consider a file system API that didn't let you obtain access to a parent directory, and didn't let you ambiently designate any path you like via an unchecked string and turn said string into a real handle to whatever lies at that path. Your program starts with a handle to what it's allowed to reference.
Any subroutine you passed a directory handle then couldn't obtain anything outside of that path (effectively a jail), and any subroutine that wasn't passed any handles can't read or modify the file system at all.
before the precaution fix this was a legal archive:
$crate_name-$crate_version/outside -> ../
$crate_name-$crate_version/outside/$other_crate-$other-version/blah/blah
then you have this code:https://github.com/rust-lang/cargo/pull/4493/files#diff-ce3a...
tar.unpack(dst.parent().unwrap())?;
so while Archive#unpack protects you against following symlinks outside of `dst` (which is a really good default!) it doesn't protect you from following symlinks inside of `dst` so presumably you can use the symlink trick to overwrite other packages.i haven't tested this so this could be wrong :/ like maybe archive by default doesn't create symlinks or reorders the extraction so symlinks are always created last.
(With Javascript disabled, that page still renders, so I'm not sure why it doesn't show for you.)
The difference is probably that selective blockers like uBlock/uMatrix don't show <noscript> elements, while globaly disabling Javascript does, and discourse might be relying on the noscript element (on mobile right now, so I can't check to be sure).