{"id":"CVE-2026-33056","aliases":["GHSA-j4xf-2g29-59ph","RUSTSEC-2026-0067"],"url":"https://o3.security/vulnerability/CVE-2026-33056","summary":"tar-rs: unpack_in can chmod arbitrary directories by following symlinks","details":"## Summary\n\nWhen unpacking a tar archive, the `tar` crate's `unpack_dir` 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.\n\n## Reproducer\n\nA 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, `create_dir(\"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.\n\n## Fix \n\nThe fix is very simple, we now use `fs::symlink_metadata()` in `unpack_dir`, so symlinks are detected and rejected rather than followed.\n\n## Credit\n\nThis issue was reported by @xokdvium - thank you!","published":"2026-03-20T07:11:10.448Z","modified":"2026-08-27T03:57:07.559393891Z","cvss":null,"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"crates.io","name":"tar","fixedVersion":"0.4.45"}],"fix":{"url":"https://github.com/alexcrichton/tar-rs/commit/17b1fd84e632071cb8eef9d3709bf347bd266446","label":"alexcrichton/tar-rs@17b1fd8"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/33xxx/CVE-2026-33056.json"},{"type":"ADVISORY","url":"https://github.com/alexcrichton/tar-rs/security/advisories/GHSA-j4xf-2g29-59ph"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-33056"},{"type":"FIX","url":"https://github.com/alexcrichton/tar-rs/commit/17b1fd84e632071cb8eef9d3709bf347bd266446"},{"type":"PACKAGE","url":"https://github.com/alexcrichton/tar-rs"},{"type":"WEB","url":"https://rustsec.org/advisories/RUSTSEC-2026-0067.html"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-27T03:57:07.559393891Z"}}