{"id":"GHSA-j4xf-2g29-59ph","revision":"7b5e3e663d564e12a5dcbc7eab179485","records":[{"revision":"7b5e3e663d564e12a5dcbc7eab179485","observedAt":"2026-10-24T13:19:54.901+00:00","statement":{"source":"osv","id":"GHSA-j4xf-2g29-59ph","aliases":["CVE-2026-33056","RUSTSEC-2026-0067"],"title":"tar-rs `unpack_in` can chmod arbitrary directories by following symlinks","description":"## 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!","state":0,"publishedAt":"2026-03-20T17:25:09+00:00","modifiedAt":"2026-09-10T03:50:39.7514716+00:00","affected":[{"ecosystem":"crates.io","name":"tar","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"0.4.45"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V3","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","score":null,"severity":null},{"system":"CVSS_V4","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"MODERATE"}],"references":["https://github.com/alexcrichton/tar-rs/security/advisories/GHSA-j4xf-2g29-59ph","https://nvd.nist.gov/vuln/detail/CVE-2026-33056","https://github.com/alexcrichton/tar-rs/commit/17b1fd84e632071cb8eef9d3709bf347bd266446","https://github.com/alexcrichton/tar-rs","https://rustsec.org/advisories/RUSTSEC-2026-0067.html"],"sourceUrl":"https://github.com/advisories/GHSA-j4xf-2g29-59ph","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-j4xf-2g29-59ph","identifiers":["GHSA-j4xf-2g29-59ph","CVE-2026-33056","RUSTSEC-2026-0067"]},"retained":false,"historicalAffected":[]}],"coverage":[]}