Asymmetric Resource Consumption (Zip Bomb) The advisory has been revoked - it doesn't affect any version of package python/cpython  (opens in a new tab)


Threat Intelligence

EPSS
0.05% (19th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-UNMANAGED-PYTHONCPYTHON-6468186
  • published20 Mar 2024
  • disclosed19 Mar 2024
  • creditdyingc

Introduced: 19 Mar 2024

CVE-2024-0450  (opens in a new tab)
CWE-405  (opens in a new tab)

How to fix?

Upgrade python/cpython to version 3.8.19, 3.9.19, 3.10.14, 3.11.9, 3.12.3 or higher.

Amendment

This was deemed not a vulnerability.

Overview

Affected versions of this package are vulnerable to Asymmetric Resource Consumption (Zip Bomb) in the zipfile module. An attacker can create a zip-bomb with a high compression ratio that exploits the zip format to overlap entries in the archive.

Workaround

Thee following check can be used before extracting a ZIP file.

# zipf is an open ZipFile
end_offset = zipf.start_dir
for zinfo in sorted(zipf.filelist,
                    key=lambda zinfo: zinfo.header_offset,
                    reverse=True):
    if zinfo.header_offset + zinfo.compress_size > end_offset:
        raise zipfile.BadZipFile('Overlapped entries')
    end_offset = zinfo.header_offset

Note:

This is a duplicate of https://security.snyk.io/vuln/SNYK-UNMANAGED-PYTHON-7924823