CVE-2026-115905 in zip2
Summary
by MITRE • 10/26/2026
zip is a zip library for Rust that supports reading and writing simple ZIP files. Through 9.0.4, ZipArchive treats Central Directory File Header filenames as authoritative while ZipStreamReader extracts using Local File Header filenames without reconciling the duplicate metadata in src/read/stream.rs. A crafted archive can therefore appear benign to a component that inspects the central directory but cause a streaming extractor to write a different attacker-selected path and content, potentially overwriting files used by a downstream service. This issue is fixed in version 9.0.5.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 10/26/2026
The vulnerability identified in the Rust zip library prior to version 9.0.5 stems from an inconsistency in how archive metadata is processed during different extraction operations. Specifically, the ZipArchive component treats filenames found in the Central Directory File Header as authoritative for determining file paths and properties within the archive structure. In contrast, the ZipStreamReader, which handles streaming extraction of individual files, relies on filenames located in the Local File Header without performing any reconciliation or validation against the corresponding entries in the central directory. This architectural divergence creates a critical security gap where two valid components of the same library can interpret the exact same maliciously crafted ZIP archive differently based solely on which header section they prioritize for path resolution.
This discrepancy allows an attacker to craft a ZIP file that appears benign when inspected via standard archival tools or applications using ZipArchive, as these tools will display and process files according to the central directory entries. However, if this same archive is processed by a streaming extractor utilizing ZipStreamReader, the system may extract files based on the Local File Header paths. An attacker can manipulate the local headers to specify arbitrary file paths that differ from those in the central directory. This technique effectively bypasses security controls or sandboxing mechanisms that rely on static analysis of the central directory structure, as the actual extraction behavior diverges significantly from the perceived content metadata.
The operational impact of this vulnerability is severe, particularly in environments where ZIP archives are ingested by downstream services for processing, such as automated document scanners, deployment pipelines, or file upload handlers. By exploiting the mismatch between header sources, an attacker can cause the streaming extractor to write files outside of intended directories or overwrite critical system and application files with malicious content. This path traversal-like behavior enables unauthorized access to sensitive data, potential remote code execution if executable payloads are written to accessible locations, and integrity violations where legitimate service configurations or binaries are replaced by attacker-controlled artifacts without triggering standard validation checks that only examine the central directory.
To mitigate this risk, organizations utilizing versions of the zip library prior to 9.0.5 should immediately upgrade to version 9.0.5 or later, which resolves the inconsistency by ensuring both extraction methods reconcile metadata from local and central headers consistently. For systems where upgrading is not immediately feasible, defensive programming practices should be implemented within application logic that consumes ZIP archives. This includes explicitly validating extracted file paths against a whitelist of allowed directories to prevent directory traversal attacks regardless of header discrepancies. Additionally, implementing strict input validation on the content being written can help mitigate the impact if an attacker successfully exploits this path manipulation flaw.
From a classification perspective, this vulnerability aligns with CWE-20 Improper Input Validation and CWE-754 Improper Check for Unusual or Exceptional Conditions, as the library fails to validate that local header metadata matches central directory expectations before proceeding with extraction operations. In terms of offensive security frameworks, this technique is relevant to MITRE ATT&CK tactic T1608 Link Exploitation via File Type Association and potentially T1564 Hide Artifacts if used to conceal malicious files in unexpected locations within a file system structure by exploiting the discrepancy between how different tools view the archive contents. The core issue represents a classic case of inconsistent interpretation of structured data formats, highlighting the necessity for rigorous normalization of metadata across all processing pathways within security-critical libraries.