{"id":"CVE-2026-33056","aliases":["CVE-2026-33056","GHSA-j4xf-2g29-59ph","RUSTSEC-2026-0067"],"related":[],"kind":"vulnerability","state":"published","title":"tar-rs: unpack_in can chmod arbitrary directories by following symlinks","summary":"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 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. This issue has been fixed in version 0.4.45.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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 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. This issue has been fixed in version 0.4.45.","source":"cvelist"},{"lang":"en","text":"## 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!","format":"markdown","source":"ghsa"},{"lang":"en","text":"In versions 0.4.44 and below of tar-rs, when unpacking a tar archive, the tar\ncrate's `unpack_dir` function uses [`fs::metadata()`][fs-metadata] to check\nwhether a path that already exists is a directory. Because `fs::metadata()`\nfollows symbolic links, a crafted tarball containing a symlink entry followed\nby a directory entry with the same name causes the crate to treat the symlink\ntarget as a valid existing directory — and subsequently apply chmod to it. This\nallows an attacker to modify the permissions of arbitrary directories outside\nthe extraction root.\n\nThis issue has been fixed in version 0.4.45.\n\n[fs-metadata]: https://doc.rust-lang.org/std/fs/fn.metadata.html","format":"markdown","source":"rustsec"},{"lang":"es","text":"tar-rs es una biblioteca de lectura/escritura de archivos tar para Rust. En las versiones 0.4.44 e inferiores, al desempaquetar un archivo tar, la función `unpack_dir` del crate `tar` utiliza `fs::metadata()` para verificar si una ruta que ya existe es un directorio. Debido a que `fs::metadata()` sigue los enlaces simbólicos, un tarball manipulado que contiene una entrada de enlace simbólico seguida de una entrada de directorio con el mismo nombre hace que el crate trate el destino del enlace simbólico como un directorio existente válido y, posteriormente, le aplique `chmod`. Esto permite a un atacante modificar los permisos de directorios arbitrarios fuera de la raíz de extracción. Este problema ha sido solucionado en la versión 0.4.45.","source":"nvd"}],"published":"2026-03-19T12:00:00.000Z","modified":"2026-09-10T03:50:39.751Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","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":5.1,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","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":5.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","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","rating":"MEDIUM"},{"scorer":"RustSec Advisory Database","scheme":"CVSS:4.0","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"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-61"],"affected":[{"ranges":[{"version":"< 0.4.45","status":"affected"}],"vendor":"alexcrichton","product":"tar-rs","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.4.45"}],"ecosystem":"crates.io","package":"tar","purl":"pkg:cargo/tar","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.4.45"}],"ecosystem":"crates.io","package":"tar","purl":"pkg:cargo/tar","source":"rustsec"},{"ranges":[{"status":"affected","fixed":"0.4.45"}],"vendor":"tar_project","product":"tar","cpe":"cpe:2.3:a:tar_project:tar:*:*:*:*:*:rust:*:*","source":"nvd"}],"references":[{"url":"https://github.com/alexcrichton/tar-rs/security/advisories/GHSA-j4xf-2g29-59ph","tags":["exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/alexcrichton/tar-rs/commit/17b1fd84e632071cb8eef9d3709bf347bd266446","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-33056","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/alexcrichton/tar-rs","tags":["package"],"sources":["ghsa"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0067.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/tar","tags":["package"],"sources":["rustsec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-03-20T12:59:15.595Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-33056","url":"https://www.cve.org/CVERecord?id=CVE-2026-33056","licence":"CVE Terms of Use","modified":"2026-03-20T12:59:30.468Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-j4xf-2g29-59ph","url":"https://github.com/advisories/GHSA-j4xf-2g29-59ph","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:39.751Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0067","url":"https://rustsec.org/advisories/RUSTSEC-2026-0067.html","licence":"CC0-1.0","modified":"2026-03-23T09:45:06.946Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-33056","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-33056","licence":"Public domain","modified":"2026-06-17T10:36:52.550Z"}],"updatedAt":"2026-11-25T22:59:16.292Z","epss":{"score":0.00392,"percentile":0.35524,"date":"2026-12-01T12:00:22.000Z"}}