# 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)

- **Severity:** MEDIUM 6.1
- **CVSS:** 6.1 (v3.1, GitHub) `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: None; User interaction: Required; Scope: Unchanged; Confidentiality impact: None; Integrity impact: High; Availability impact: Low
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.19% (percentile 5, 2026-11-28)
- **CWE:** CWE-22, CWE-23
- **Aliases:** GHSA-qh76-45cr-8xrc
- **Published:** 2026-11-20T23:33:14.000Z
- **Modified:** 2026-11-20T23:33:15.000Z

## Who should check

- Projects that depend on crates.io package sevenz-rust2 (\< 0.21.1)

## 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).

## Affected and fixed versions

- crates.io `sevenz-rust2`: affected \< 0.21.1; fixed 0.21.1 (ghsa)

## Technologies

Rust crates

## Mitigation

- Upgrade sevenz-rust2 to 0.21.1 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-61725. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-61725.md
Affected: sevenz-rust2 < 0.21.1
Fixed in: 0.21.1

Steps:
1. Search this machine and project for sevenz-rust2 (crates.io): dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-61725 being exploited?

There is no confirmed exploitation: CVE-2026-61725 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.19% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2026-61725?

Medium: CVSS 6.1 (v3.1, scored by GitHub). Not remotely exploitable (local or adjacent access needed). A user has to take an action, such as opening a link, for the attack to work.

### Which versions are affected by CVE-2026-61725?

sevenz-rust2 \< 0.21.1.

### Is there a fix for CVE-2026-61725?

Yes. Fixed in 0.21.1. Upgrade sevenz-rust2 to 0.21.1 or later.

### How do I check if I'm affected by CVE-2026-61725?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/hasenbanck/sevenz-rust2/security/advisories/GHSA-qh76-45cr-8xrc>
- patch: <https://github.com/hasenbanck/sevenz-rust2/commit/ef760b61f3535ac8b93006212aef41bfebc237eb>
- other: <https://nvd.nist.gov/vuln/detail/CVE-2026-61725>
- other: <https://github.com/advisories/GHSA-qh76-45cr-8xrc>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- GitHub Advisory Database: CC-BY 4.0 <https://github.com/advisories/GHSA-qh76-45cr-8xrc> (license: <https://creativecommons.org/licenses/by/4.0/>)
- FIRST EPSS: EPSS scores by FIRST <https://www.first.org/epss/>

HTML: <https://flawdb.com/CVE-2026-61725> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-61725>
