GHSA-pqhf-p39g-3x64: uv allows ZIP payload obfuscation through parsing differentials
N/A
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| uv | pip | <= 0.9.5 | 0.9.6 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability lies in how uv processes ZIP archives, which is a core part of its functionality for installing Python packages. The analysis of the patch da659fee4898a73dbc75070f3e82d49f745e4628 reveals two main points of failure that were fixed.
First, the async_zip dependency was updated. The commit for the new revision in the forked repository astral-sh/rs-async-zip has a message indicating it fixes handling of ZIP entry comments. This directly corresponds to the first issue described in the advisory, where uv would misinterpret comment fields in the ZIP's central directory. This part of the vulnerability is within the async_zip dependency.
Second, uv's own code was changed to add validation for filenames within the archive. A new function, validate_archive_member_name, was introduced in crates/uv-extract/src/lib.rs to check for empty filenames and control characters (like null bytes). This addresses the second issue from the advisory, where uv handled filenames with null bytes differently from other tools like Python's zipfile module.
The vulnerable functions are the ones that orchestrate the ZIP extraction process, as they were the entry points for the vulnerable logic. These are uv_extract::stream::unzip (for async extraction) and uv_extract::sync::unzip (for sync extraction). Both functions were modified to call the new validate_archive_member_name function. Before the patch, these functions would extract files from ZIP archives without proper validation, making them vulnerable to the described parsing differentials. An attacker could exploit this by crafting a malicious wheel or source distribution in a ZIP format, which, when installed with uv pip install, could lead to unexpected behavior and potentially arbitrary code execution.
Vulnerable functions
uv_extract::stream::unzipcrates/uv-extract/src/stream.rs
uv_extract::sync::unzipcrates/uv-extract/src/sync.rs