MEDIUM · CVSS 3.1 6.1 EPSS 0.2% · 15th percentile CWE-22CWE-23

CVE-2026-61725: sevenz-rust2: decompress builds each output path as dest.join(entry.name()) with no traversal guard, allowing a crafted .7z to write files outside the destination (Zip-Slip)

Published 2026-11-20 · Updated 2026-11-20 · Also known as GHSA-qh76-45cr-8xrc

Summary

The sevenz-rust2 library is vulnerable to a Zip-Slip flaw where malicious archive entries can write files outside the target extraction directory. Users of the library who extract untrusted .7z archives must update to version 0.21.1 or later to mitigate the risk of arbitrary file write.

Who is affected

Affected deployments include any application that processes untrusted .7z archives, such as upload handlers, CI pipelines, or malware analysis tools. An attacker can craft an archive with paths containing '..' or absolute paths to overwrite critical system configuration files, cron jobs, or autostart entries, potentially leading to remote code execution.

Exploitability

The vulnerability is rated as medium severity with a base score of 6.1, requiring local access and user interaction according to the provided CVSS vector. While the base CVSS assumes local access, the maintainers note that network-based extraction of untrusted archives could escalate the risk to a higher severity score. The current EPSS score is 0.001 and there is no evidence of active exploitation via CISA KEV.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-21. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
crates.io sevenz-rust2 >= 0, < 0.21.1 0.21.1 cargo update -p sevenz-rust2 --precise 0.21.1

CVSS 3.1 vector

CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L

Attack vectorLocal
Attack complexityLow
Privileges requiredNone
User interactionRequired
ScopeUnchanged
ConfidentialityNone
IntegrityHigh
AvailabilityLow

FAQ

What is a Zip-Slip vulnerability?

A Zip-Slip vulnerability is a form of directory traversal where an archive contains file paths designed to escape the intended destination folder during extraction, potentially overwriting arbitrary files on the system.

Is this vulnerability limited to local extraction?

While the CVSS 3.1 vector identifies the attack vector as local (AV:L), the maintainers note that if an application processes untrusted archives received over a network, the risk profile significantly increases to network-accessible (AV:N).

Does this flaw affect all extraction methods in the crate?

Yes, all primary convenience entry points, including decompress, decompress_file, decompress_with_password, and decompress_file_with_password, are affected as they all route through the vulnerable decompress_impl function.

Original advisory description
### Summary Extracting 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. ### Details In `src/util/decompress.rs`, `decompress_impl` computes the per-entry destination directly (line 140): ```rust let dest_path = dest.join(entry.name()); extract_fn(entry, reader, &dest_path) ``` `default_entry_extract_fn` (line 154) then acts on that path: ```rust let file = File::create(path) .map_err(|e| Error::file_open(e, path.to_string_lossy().to_string()))?; ``` There 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. The trust boundary is the archive bytes. Any caller that extracts an untrusted `.7z` reaches the sink. ### PoC 1. Build a `.7z` whose `FilesInfo` contains an entry named `../../../../tmp/pwned` (or, on Windows, an absolute path such as `C:\Windows\Temp\pwned`). 2. Call `sevenz_rust2::decompress_file("evil.7z", "./out")`. 3. 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. ### Impact Arbitrary 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. ### Suggested remediation Reject 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. ## Maintainer response This issue was patched with ef760b61f3535ac8b93006212aef41bfebc237eb and released as `v0.21.1` to crates.io Consumers that extract attacker-supplied archives received over a network without user interaction should re-score as AV:N/UI:N (≈8.6).

References

Source records: GHSA-qh76-45cr-8xrc (OSV.dev) · EPSS by FIRST, 2026-11-22.