GHSA-QH76-45CR-8XRC
Vulnerability from github – Published: 2026-11-20 23:33 – Updated: 2026-11-20 23:33Summary
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):
let dest_path = dest.join(entry.name());
extract_fn(entry, reader, &dest_path)
default_entry_extract_fn (line 154) then acts on that path:
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
- Build a
.7zwhoseFilesInfocontains an entry named../../../../tmp/pwned(or, on Windows, an absolute path such asC:\Windows\Temp\pwned). - Call
sevenz_rust2::decompress_file("evil.7z", "./out"). - 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": [
{
"package": {
"ecosystem": "crates.io",
"name": "sevenz-rust2"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.21.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-61725"
],
"database_specific": {
"cwe_ids": [
"CWE-22",
"CWE-23"
],
"github_reviewed": true,
"github_reviewed_at": "2026-11-20T23:33:14Z",
"nvd_published_at": "2026-10-30T23:17:11Z",
"severity": "MODERATE"
},
"details": "### Summary\n\nExtracting an attacker-supplied 7z archive can write files outside the destination directory. The 7z header stores each entry\u0027s 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, \u0026dest_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 \u2014 config, cron, autostart, or build artifacts \u2014 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 (\u22488.6).",
"id": "GHSA-qh76-45cr-8xrc",
"modified": "2026-11-20T23:33:15Z",
"published": "2026-11-20T23:33:14Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/hasenbanck/sevenz-rust2/security/advisories/GHSA-qh76-45cr-8xrc"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-61725"
},
{
"type": "WEB",
"url": "https://github.com/hasenbanck/sevenz-rust2/commit/ef760b61f3535ac8b93006212aef41bfebc237eb"
},
{
"type": "PACKAGE",
"url": "https://github.com/hasenbanck/sevenz-rust2"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L",
"type": "CVSS_V3"
}
],
"summary": "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)"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.