CVE-2021-38511
Links in archive can create arbitrary directories
An issue was discovered in the tar crate before 0.4.36 for Rust. When symlinks are present in a TAR archive, extraction can create arbitrary directories via .. traversal.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- None
- Integrity
- High
- Availability
- None
Exploit likelihood
What each source reports
NVD Score used
7.5
An issue was discovered in the tar crate before 0.4.36 for Rust. When symlinks are present in a TAR archive, extraction can create arbitrary directories via .. traversal.
- Record
CVE-2021-38511- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - CVSS 2.0
- 5.0 Medium
AV:N/AC:L/Au:N/C:N/I:P/A:N - Weakness
- CWE-59
- Updated
- 2026-11-02
CVE List No score
An issue was discovered in the tar crate before 0.4.36 for Rust. When symlinks are present in a TAR archive, extraction can create arbitrary directories via .. traversal.
- Record
CVE-2021-38511- Updated
- 2026-11-02
EUVDEUVD-2021-1587 No score
An issue was discovered in the tar crate before 0.4.36 for Rust. When symlinks are present in a TAR archive, extraction can create arbitrary directories via .. traversal.
- Record
EUVD-2021-1587- Updated
- 2026-11-03
GitHub AdvisoriesGHSA-62jx-8vmh-4mcw
7.5
Links in archive can create arbitrary directories
When unpacking a tarball that contains a symlink the tar crate may create directories outside of the directory it's supposed to unpack into. The function errors when it's trying to create a file, but the folders are already created at this point.
- Record
GHSA-62jx-8vmh-4mcw- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Weakness
- CWE-22
- Updated
- 2026-11-02
OSV
7.5
An issue was discovered in the tar crate before 0.4.36 for Rust. When symlinks are present in a TAR archive, extraction can create arbitrary directories via .. traversal.
- Record
CVE-2021-38511- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Updated
- 2026-11-02
OSVDEBIAN-CVE-2021-38511
7.5
An issue was discovered in the tar crate before 0.4.36 for Rust. When symlinks are present in a TAR archive, extraction can create arbitrary directories via .. traversal.
- Record
DEBIAN-CVE-2021-38511- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Updated
- 2026-11-02
OSVGHSA-62jx-8vmh-4mcw
7.5
Links in archive can create arbitrary directories
When unpacking a tarball that contains a symlink the tar crate may create directories outside of the directory it's supposed to unpack into. The function errors when it's trying to create a file, but the folders are already created at this point.
- Record
GHSA-62jx-8vmh-4mcw- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Weakness
- CWE-22
- Updated
- 2026-11-02
OSVRUSTSEC-2021-0080
7.5
Links in archive can create arbitrary directories
When unpacking a tarball that contains a symlink the tar crate may create
directories outside of the directory it's supposed to unpack into.
The function errors when it's trying to create a file, but the folders are already created at this point.
use std::{io, io::Result};
use tar::{Archive, Builder, EntryType, Header};
fn main() -> Result<()> {
let mut buf = Vec::new();
{
let mut builder = Builder::new(&mut buf);
// symlink: parent -> ..
let mut header = Header::new_gnu();
header.set_path("symlink")?;
header.set_link_name("..")?;
header.set_entry_type(EntryType::Symlink);
header.set_size(0);
header.set_cksum();
builder.append(&header, io::empty())?;
// file: symlink/exploit/foo/bar
let mut header = Header::new_gnu();
header.set_path("symlink/exploit/foo/bar")?;
header.set_size(0);
header.set_cksum();
builder.append(&header, io::empty())?;
builder.finish()?;
};
Archive::new(&*buf).unpack("demo")
}
This has been fixed in https://github.com/alexcrichton/tar-rs/pull/259 and is
published as tar 0.4.36. Thanks to Martin Michaelis (@mgjm) for
discovering and reporting this, and Nikhil Benesch (@benesch) for
the fix!
- Record
RUSTSEC-2021-0080- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Updated
- 2026-11-02
OSVUBUNTU-CVE-2021-38511
7.5
An issue was discovered in the tar crate before 0.4.36 for Rust. When symlinks are present in a TAR archive, extraction can create arbitrary directories via .. traversal.
- Record
UBUNTU-CVE-2021-38511- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
tarcrates.io |
before 0.4.36 | 0.4.36 |
rust-tarDebian:12 |
before 0.4.37-1 | 0.4.37-1 |
rust-tarDebian:13 |
before 0.4.37-1 | 0.4.37-1 |
rust-tarDebian:14 |
before 0.4.37-1 | 0.4.37-1 |
tarcrates.io |
0.0.0-0 up to 0.4.36 | 0.4.36 |
rust-tarUbuntu:Pro:20.04:LTS |
All versions, plus listed versions 0.4.26-10.4.26-1ubuntu0.1 |
None known |
rust-tarUbuntu:Pro:22.04:LTS |
All versions, plus listed versions 0.4.26-10.4.37-10.4.37-30.4.37-3ubuntu0.1~esm10.4.37-3ubuntu0.10.4.37-3ubuntu0.1+esm1 |
None known |
rust-tarUbuntu:24.04:LTS |
All versions, plus listed versions 0.4.38-20.4.40-10.4.40-1ubuntu0.1 |
None known |
rust-tarUbuntu:25.10 |
All versions, plus listed versions 0.4.43-40.4.43-4ubuntu0.1 |
None known |
rust-tarUbuntu:26.10 |
All versions, plus listed versions 0.4.45-10.4.45-2 |
None known |
rust-tarUbuntu:26.04:LTS |
All versions, plus listed versions 0.4.43-40.4.44-10.4.45-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-38511 is a high vulnerability (CVSS 7.5) in Tar Project Tar, published July 19, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.39%, the 72nd percentile. Fixed in tar 0.4.36.