BIT-libpython-2024-8088: Infinite loop when iterating over zip archive entry names from zipfile.Path
There is a HIGH severity vulnerability affecting the CPython "zipfile" module affecting "zipfile.Path". Note that the more common API "zipfile.ZipFile" class is unaffected.
When iterating over names of entries in a zip archive (for example, methods of "zipfile.Path" like "namelist()", "iterdir()", etc) the process can be put into an infinite loop with a maliciously crafted zip archive. This defect applies when reading only metadata or extracting the contents of the zip archive. Programs that are not handling user-controlled zip archives are not affected.
Affected Software
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications that use zipfile.Path to iterate entry names in ZIP archives supplied by users are affected. Code using the more common zipfile.ZipFile API is not affected, and applications that do not handle user-controlled ZIP archives are not affected.
What must an attacker provide to trigger the problem?
An attacker needs to provide a maliciously crafted ZIP archive that the application processes through zipfile.Path entry-name iteration, such as namelist() or iterdir(). No authentication or user interaction is required according to the supplied severity vector.
Can the issue occur without extracting archive contents?
Yes. The infinite loop can occur while reading ZIP metadata, as well as while extracting archive contents, if the application iterates archive entry names through zipfile.Path.