---
id: "CVE-2026-61725"
kind: "vulnerability"
aliases: ["CVE-2026-61725"]
title: "sevenz-rust2: crafted 7z archive writes files outside extraction directory"
severity: "medium"
cvss: 6.1
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["cargo", "file-upload", "package", "rust", "sevenz-rust2"]
not_affected_if: ["archives-trusted-only", "no-7z-extraction", "version-0.21.1-or-later"]
published_at: "2026-10-30T23:17:11+00:00"
first_seen_at: "2026-10-30T23:26:12+00:00"
updated_at: "2026-10-30T23:28:10+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-61725", "first_seen_at": "2026-10-30T23:26:12+00:00"}]
---

# sevenz-rust2: crafted 7z archive writes files outside extraction directory

sevenz-rust2 is a Rust library for reading and writing 7z archives. A crafted archive with parent-directory or absolute entry names can write or overwrite files anywhere the extracting process can reach, which can lead to code execution through config, startup, cron or build files.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check the locked version of `sevenz-rust2` in `Cargo.lock` (for example `grep -A1 'name = "sevenz-rust2"' Cargo.lock`).
- Search the codebase for calls to `decompress`, `decompress_file`, `decompress_with_password` or `decompress_file_with_password` from `sevenz-rust2`, especially on uploaded or untrusted archives.

## Fix

- `sevenz-rust2` `0.21.1` or later.

## Timeline

- 2026-10-30T23:26:12+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-61725

## From the sources

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.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
