Test files › Archives › corrupt-central-directory.zip

Corrupt ZIP (broken central directory)

Valid local file headers, but the central directory signature is overwritten with garbage.

↓ Download corrupt-central-directory.zip
Filenamecorrupt-central-directory.zip
FormatZIP
Size219 bytes (219 bytes)
MIME typeapplication/zip
SHA-256d1194edeac6e322b76436927038138a9dc8325a93fc5daed8e399df8b68ed7d5
What this file catchesReaders that trust the central directory blindly and crash, versus tolerant ones that can recover entries by scanning local headers.

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

Open it inside a try block and report the failure to the user, instead of letting a background job die on it later.

import zipfile

try:
    with zipfile.ZipFile("corrupt-central-directory.zip") as z:
        bad = z.testzip()   # reads every entry and checks its CRC
        print(f"corrupt entry: {bad}" if bad else "ok")
except zipfile.BadZipFile as e:
    print("rejected:", e)

Run against this file, it prints: rejected: Bad magic number for central directory

Related guides and tools

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

Download & verify

curl -fsSL -o "corrupt-central-directory.zip" "https://files.hexaqa.com/archive/corrupt-central-directory.zip"
curl -fsSL "https://files.hexaqa.com/archive/corrupt-central-directory.zip" | sha256sum # expect: d1194edeac6e322b76436927038138a9dc8325a93fc5daed8e399df8b68ed7d5

More archives test files

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

← All Archives files