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.
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.
.7z whose FilesInfo contains an entry named ../../../../tmp/pwned (or, on Windows, an absolute path such as C:\Windows\Temp\pwned).sevenz_rust2::decompress_file("evil.7z", "./out")../out. Targeting a startup/cron path or a config file turns the write into code execution or persistence.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,...
0.21.1Exploitability
AV:LAC:LPR:NUI:RScope
S:UImpact
C:NI:HA:L6.1/CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:LInput Validation