Test files › Archives › modest-zip-bomb.zip

Safe zip bomb test file

A ~1 MB archive that expands to roughly 1 GB: ten entries of 100 MB of zeroes each. Deliberately modest - this is not a 42 KB / 4.5 PB bomb.

↓ Download modest-zip-bomb.zip
Filenamemodest-zip-bomb.zip
FormatZIP
Size996 KB (1,020,252 bytes)
MIME typeapplication/zip
SHA-256bdf118f346d0f790e0a707d49b0c15a3ca048463c69f3621949b821e87a1915a
What this file catchesExtraction with no output-size cap or compression-ratio check. Your extractor should abort once the decompressed total crosses a threshold, rather than filling the disk. Expansion ratio ~1000:1.

Handle it in code

Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.

Python

Limit what extraction may produce, not the size of the upload. Headers can lie, so the loop counts the bytes actually decompressed as well as the declared sizes.

import zipfile

MAX_TOTAL = 100 * 1024 * 1024   # refuse to produce more than 100 MB
MAX_RATIO = 100                 # or any entry that expands more than 100x

with zipfile.ZipFile("modest-zip-bomb.zip") as z:
    declared = sum(i.file_size for i in z.infolist())
    if declared > MAX_TOTAL:
        raise SystemExit(f"refused: declares {declared:,} bytes of content")
    written = 0
    for info in z.infolist():
        if info.compress_size and info.file_size / info.compress_size > MAX_RATIO:
            raise SystemExit(f"refused: {info.filename} expands {info.file_size // info.compress_size}x")
        with z.open(info) as src:
            while chunk := src.read(65536):
                written += len(chunk)
                if written > MAX_TOTAL:
                    raise SystemExit("refused: output passed the limit")
    print("ok to extract")

Run against this file, it prints: refused: declares 1,048,576,000 bytes of content

Related guides and tools

Sample ZIP fileUpload validation checklistFile signaturesCheck a file's real typeVerify its SHA-256

Download & verify

curl -fsSL -o "modest-zip-bomb.zip" "https://files.hexaqa.com/archive/modest-zip-bomb.zip"
curl -fsSL "https://files.hexaqa.com/archive/modest-zip-bomb.zip" | sha256sum # expect: bdf118f346d0f790e0a707d49b0c15a3ca048463c69f3621949b821e87a1915a

More archives test files

absolute-path.zipcorrupt-central-directory.zipempty.zipmixed-content-50mb.zipnested-10-deep.zipsingle-file.gzstored.7zunicode-entry-names.zip

← All Archives files