Vulnerability HighRUSTSEC-2018-0002 · tar
RUSTSEC-2018-0002: Links in archives can overwrite any existing file
Short answerA security vulnerability in the tar crate: Links in archives can overwrite any existing file. High severity (CVSS 7.5). Fixed in 0.4.16: update to a fixed version.
| Crate | tar |
|---|---|
| Type | Vulnerability |
| Affected versions | Before 0.4.16. |
| Fixed in | 0.4.16 |
| Severity | High, CVSS 7.5 CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
| Published | 2018-06-29 |
| Last changed | 2023-11-08 |
| Also known as | CVE-2018-20990, GHSA-2367-c296-3mp2 |
What to do
- See which version you have:
cargo tree -i tar(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p tar. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for exampletar = "0.4.16") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
When unpacking a tarball with the unpack_in-family of functions it's intended that only files within the specified directory are able to be written. Tarballs with hard links or symlinks, however, can be used to overwrite any file on the filesystem.
Tarballs can contain multiple entries for the same file. A tarball which first contains an entry for a hard link or symlink pointing to any file on the filesystem will have the link created, and then afterwards if the same file is listed in the tarball the hard link will be rewritten and any file can be rewritten on the filesystem.
This has been fixed in https://github.com/alexcrichton/tar-rs/pull/156 and is published as tar 0.4.16. Thanks to Max Justicz for discovering this and emailing about the issue!
References
- Package: crates.io/crates/tar
- Advisory: rustsec.org/advisories/RUSTSEC-2018-0002.html
- Web: github.com/alexcrichton/tar-rs/pull/156
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Other advisories for tar
- Vulnerability HighRUSTSEC-2021-0080 · 2021-07-19Links in archive can create arbitrary directories
- VulnerabilityRUSTSEC-2026-0067 · 2026-03-19`unpack_in` can chmod arbitrary directories by following symlinks
- VulnerabilityRUSTSEC-2026-0068 · 2026-03-19tar-rs incorrectly ignores PAX size headers if header size is nonzero
- VulnerabilityGHSA-3pv8-6f4r-ffg2 · 2026-05-29tar has a PAX header desynchronization issue
Up next
Same cratetar: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →Did this answer your question?