CVE-2026-33056: tar-rs: unpack_in can chmod arbitrary directories by following symlinks

Published Mar 20, 2026
·
Updated

Summary

When unpacking a tar archive, the tar crate's unpackdir function uses fs::metadata() to check whether a path that already exists is a directory. Because fs::metadata() follows symbolic links, a crafted tarball containing a symlink entry followed by a directory entry with the same name causes the crate to treat the symlink target as a valid existing directory — and subsequently apply chmod to it. This allows an attacker to modify the permissions of arbitrary directories outside the extraction root.

Reproducer

A malicious tarball contains two entries: (1) a symlink foo pointing to an arbitrary external directory, and (2) a directory entry foo/. (or just foo). When unpacked, createdir("foo") fails with EEXIST because the symlink is already on disk. The fs::metadata() check then follows the symlink, sees a directory at the target, and allows processing to continue. The directory entry's mode bits are then applied via chmod, which also follows the symlink — modifying the permissions of the external target directory.

Fix

The fix is very simple, we now use fs::symlinkmetadata() in unpackdir, so symlinks are detected and rejected rather than followed.

Credit

This issue was reported by @xokdvium - thank you!

Other sources

tar-rs is a tar archive reading/writing library for Rust. In versions 0.4.44 and below, when unpacking a tar archive, the tar crate's unpackdir function uses fs::metadata() to check whether a path that already exists is a directory. Because fs::metadata() follows symbolic links, a crafted tarball containing a symlink entry followed by a directory entry with the same name causes the crate to treat the symlink target as a valid existing directory — and subsequently apply chmod to it. This allows an attacker to modify the permissions of arbitrary directories outside the extraction root. This issue has been fixed in version 0.4.45.

MITRE

tar-rs: unpackin can chmod arbitrary directories by following symlinks

Microsoft

Affected Software

12 affected componentsFixes available
crates/tar<=0.4.44
rust/tar<=0.4.44
0.4.45
Tar Project Tar Rust<0.4.45
Microsoft azl3 trident 0.21.0-1
Microsoft azl3 rust 1.75.0-27
Microsoft azl3 rust 1.90.0-6
Microsoft cbl2 rust 1.72.0-15
Microsoft cbl2 rpm-ostree 2022.1-8
Microsoft azl3 clamav 1.5.2-1
Microsoft azl3 rpm-ostree 2024.4-8
Microsoft azl3 clamav 1.5.2-2
Microsoft azl3 rpm-ostree 2024.4-10

Event History

Mar 20, 2026
CVE Published
via MITRE·07:11 AM
Data Sourced
via MITRE·07:11 AM
DescriptionWeakness
Data Sourced
via NVD·08:16 AM
RemedyDescriptionSeverityWeaknessAffected Software
Advisory Published
via GitHub·05:25 PM
Data Sourced
via GitHub·05:25 PM
DescriptionWeaknessAffected Software
Data Sourced
via GitHub·05:25 PM
Severity
Mar 25, 2026
Data Sourced
via Microsoft·08:01 AM
DescriptionSeverityWeaknessAffected Software
Updated
via Microsoft·08:01 AM
DescriptionSeverity
Updated
via Microsoft·08:01 AM
Affected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-33056?

CVE-2026-33056 has a critical severity rating due to its potential to allow arbitrary directory permissions changes.

2

How do I fix CVE-2026-33056?

To fix CVE-2026-33056, upgrade the tar-rs library to version 0.4.45 or later.

3

What versions of tar-rs are affected by CVE-2026-33056?

CVE-2026-33056 affects all versions of tar-rs up to and including 0.4.44.

4

What is the impact of CVE-2026-33056?

The impact of CVE-2026-33056 is that it can allow an attacker to modify permissions of arbitrary directories when unpacking a tar archive.

5

Is it safe to use tar-rs version 0.4.44 for sensitive applications?

Using tar-rs version 0.4.44 for sensitive applications is not safe due to the vulnerabilities outlined in CVE-2026-33056.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203