{"id":"CVE-2026-61725","aliases":["CVE-2026-61725","GHSA-qh76-45cr-8xrc","RUSTSEC-2026-0624"],"related":[],"kind":"vulnerability","state":"published","title":"sevenz-rust2: unchecked 7z entry paths permit traversal and absolute-path file overwrites","summary":"sevenz-rust2 is a Rust-native 7z compressor and `decompress`or. Prior to 0.21.1, extracting an attacker-supplied 7z archive can write or overwrite files outside the destination directory. In `src/util/decompress.rs`, `decompress_impl` computes each destination with `dest.join(entry.name())` without normalizing the archive's UTF-16 entry name or verifying containment, and `default_entry_extract_fn` writes to it with `File::create`. Parent-directory components escape the extraction root, and an absolute entry path makes the join discard the destination entirely. The convenience entry points `decompress`, `decompress_file`, `decompress_with_password`, and `decompress_file_with_password` all use this default path. Overwriting writable configuration, startup, cron, or build files can lead to code execution or persistence. The archive bytes are the attacker-controlled trust boundary, including for applications that automatically unpack uploaded or otherwise untrusted archives. This issue is fixed in version 0.21.1.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"sevenz-rust2 is a Rust-native 7z compressor and `decompress`or. Prior to 0.21.1, extracting an attacker-supplied 7z archive can write or overwrite files outside the destination directory. In `src/util/decompress.rs`, `decompress_impl` computes each destination with `dest.join(entry.name())` without normalizing the archive's UTF-16 entry name or verifying containment, and `default_entry_extract_fn` writes to it with `File::create`. Parent-directory components escape the extraction root, and an absolute entry path makes the join discard the destination entirely. The convenience entry points `decompress`, `decompress_file`, `decompress_with_password`, and `decompress_file_with_password` all use this default path. Overwriting writable configuration, startup, cron, or build files can lead to code execution or persistence. The archive bytes are the attacker-controlled trust boundary, including for applications that automatically unpack uploaded or otherwise untrusted archives. This issue is fixed in version 0.21.1.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nExtracting an attacker-supplied 7z archive can write files outside the destination directory. The 7z header stores each entry's path as a UTF-16 name with nothing constraining it to a relative, in-tree path. The extractor joins that name onto the destination and writes to the result without normalizing it or checking that it stays under the destination root, so an entry named `../../etc/cron.d/x` or an absolute path escapes the target.\n\n### Details\n\nIn `src/util/decompress.rs`, `decompress_impl` computes the per-entry destination directly (line 140):\n\n```rust\nlet dest_path = dest.join(entry.name());\nextract_fn(entry, reader, &dest_path)\n```\n\n`default_entry_extract_fn` (line 154) then acts on that path:\n\n```rust\nlet file = File::create(path)\n    .map_err(|e| Error::file_open(e, path.to_string_lossy().to_string()))?;\n```\n\nThere is no normalization, no `dest_path.starts_with(dest)` check, and no symlink-entry handling. `Path::join` discards the base when the joined component is absolute, and `..` components are not collapsed against the base. The convenience entry points (`decompress`, `decompress_file`, `decompress_with_password`, `decompress_file_with_password`) all route through `decompress_impl` with `default_entry_extract_fn`, so the default API is affected.\n\nThe trust boundary is the archive bytes. Any caller that extracts an untrusted `.7z` reaches the sink.\n\n### PoC\n\n1. Build a `.7z` whose `FilesInfo` contains an entry named `../../../../tmp/pwned` (or, on Windows, an absolute path such as `C:\\Windows\\Temp\\pwned`).\n2. Call `sevenz_rust2::decompress_file(\"evil.7z\", \"./out\")`.\n3. The file is created at the traversed location outside `./out`. Targeting a startup/cron path or a config file turns the write into code execution or persistence.\n\n### Impact\n\nArbitrary file write outside the intended directory (CWE-22 / CWE-23, the Zip-Slip class). On extraction of an attacker-controlled archive, an entry overwrites files outside the destination — config, cron, autostart, or build artifacts — which can escalate to code execution. Reachable by upload-handling backends, malware-analysis sandboxes, mod/game installers, and CI steps that unpack user-supplied 7z files.\n\n### Suggested remediation\n\nReject any entry whose name contains a `ParentDir`, `RootDir`, or `Prefix` component, or canonicalize the joined path and verify `starts_with(dest)` before creating it. Apply the guard inside `default_entry_extract_fn` (and `decompress_impl`) so the hardening is the default rather than left to each caller. Reject or explicitly opt-in symlink entries.\n\n## Maintainer response\n\nThis issue was patched with ef760b61f3535ac8b93006212aef41bfebc237eb and released as `v0.21.1` to crates.io\n\nConsumers that extract attacker-supplied archives received over a network without user interaction should re-score as AV:N/UI:N (≈8.6).","format":"markdown","source":"ghsa"},{"lang":"en","text":"Applications that extracted untrusted 7z archives with the built-in extraction functions\ncould create or overwrite files outside the directory selected by the caller. Version\n0.21.1 adds validation of archive entry paths during extraction.","format":"markdown","source":"rustsec"}],"published":"2026-06-30T12:00:00.000Z","modified":"2026-12-01T09:40:51.197Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L","score":6.1,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L","score":6.1,"rating":"MEDIUM"},{"scorer":"RustSec Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L","score":6.1,"rating":"MEDIUM"}],"cwes":["CWE-22","CWE-23"],"affected":[{"ranges":[{"version":"< 0.21.1","status":"affected"}],"vendor":"hasenbanck","product":"sevenz-rust2","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.21.1"}],"ecosystem":"crates.io","package":"sevenz-rust2","purl":"pkg:cargo/sevenz-rust2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.21.1"}],"ecosystem":"crates.io","package":"sevenz-rust2","purl":"pkg:cargo/sevenz-rust2","source":"rustsec"}],"references":[{"url":"https://github.com/hasenbanck/sevenz-rust2/security/advisories/GHSA-qh76-45cr-8xrc","tags":["advisory","exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://github.com/hasenbanck/sevenz-rust2/commit/ef760b61f3535ac8b93006212aef41bfebc237eb","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-61725","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/hasenbanck/sevenz-rust2","tags":["package"],"sources":["ghsa"]},{"url":"https://crates.io/crates/sevenz-rust2","tags":["package"],"sources":["rustsec"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0624.html","tags":["advisory"],"sources":["rustsec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-11-02T14:45:51.198Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-61725","url":"https://www.cve.org/CVERecord?id=CVE-2026-61725","licence":"CVE Terms of Use","modified":"2026-11-02T14:46:18.025Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-qh76-45cr-8xrc","url":"https://github.com/advisories/GHSA-qh76-45cr-8xrc","licence":"CC-BY-4.0","modified":"2026-12-01T09:40:51.197Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0624","url":"https://rustsec.org/advisories/RUSTSEC-2026-0624.html","licence":"CC0-1.0","modified":"2026-12-01T09:30:02.683Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-61725","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-61725","licence":"Public domain","modified":"2026-11-02T19:35:33.347Z"}],"updatedAt":"2026-12-01T10:07:25.049Z","epss":{"score":0.00236,"percentile":0.15643,"date":"2026-12-01T12:00:22.000Z"}}