Guide

Check a ZIP before extracting: paths, extensions and ZIP bombs

Before extracting, check the names and file types inside a ZIP and whether its structure is consistent. An ordinary-looking tree does not establish the safety of the contained files.

Responsible operator: Tom Silas Helmke, operator of ScanBeforeOpen. Content revised: .

Open the matching checker

File names provide the first clue

An invoice named invoice.pdf.exe technically ends in .exe. Double extensions, Unicode controls and very long paths can obscure that extension. The scanner flags known patterns without launching entries.

Structural inspection and detailed name findings have different limits: entries are structurally read within the 1,000-entry budget, but detailed path, extension and filename findings are generated only for the first 300 entries. The tree preview shows at most 500 entries. None of these limits implies malware inspection of all contents.

What a ZIP check sees before extracting
ZIP fileentries, central directory at the endRead central directorynames, sizes, methodsCheck names../ paths, .exe, double extensionsCheck sizespacked against unpacked, countNothing is extractedno entry is executed

The sequence in words

  1. A ZIP holds the files one after another and, at the end, a central directory that lists name and size of every entry.
  2. ScanBeforeOpen reads this directory first and compares it with the local headers. Contradictory or ambiguous structures are rejected.
  3. Names with ../ could end up outside the target folder when extracting. Active extensions such as .exe and double extensions such as invoice.pdf.exe also stand out.
  4. A tiny archive that unpacks to a huge size can exhaust memory. The scanner checks count, sizes and ratio and deliberately stops when limits are exceeded.
  5. No entry is extracted or started. An unremarkable file tree still does not prove that the content is harmless.

Path traversal and conflicting headers

../, absolute paths and drive names can place extracted files outside their intended directory. Such paths, symbolic links and active extensions are unsuitable for selective repack.

The scanner compares central directory entries with local headers. Truncated, ambiguous or unsupported structures are rejected. ZIP64 and ambiguous legacy filename encodings are deliberately excluded.

ZIP bomb detection requires resource limits

A small archive with a very large declared output can exhaust memory and processing. Innocent repetitive data can also produce extreme compression, while still presenting a resource risk.

Processing limits are 1,000 entries, 25 MiB per entry, 32 MiB declared overall output and ratio 100. Actual decompression is bounded too. These controls are not proof against every possible ZIP bomb.

What selective ZIP export contains

When offered, export creates a selection of supported entries. Suspicious paths, active extensions and nested archives are omitted. Actual length and CRC32 are checked; a manifest lists retained and omitted entries.

CRC32 checks data integrity, not trustworthiness. Repack is neither a complete archive copy nor malware clearance for retained contents. Known structural errors, encryption or budget violations block the offer.

Reproducible synthetic example

invoice.pdf.exe contains only harmless text in this example. Its name still triggers zip.active and name.extensions. ZIP inspection does not execute the file or analyze its contents as a program.

The findings come from an actual local scan of this test file. Download it and choose it in the scanner. No real personal data or malware.

Download test file: paths-demo.zip

Example inspection coverage: partial.

Practical checklist

  • Choose the ZIP in the local checker before extracting
  • Read technical extensions and full paths
  • Do not infer safety from encrypted or structurally invalid archives
  • Review the export manifest and omitted entries
  • Keep suspicious originals closed and confirm their source

Clear limits

Selective repack and structural inspection are bounded aids. Nested archives and retained files have not been classified as harmless or malicious.

FAQ

Does ScanBeforeOpen inspect every file inside a ZIP?

No. It checks archive structure, names and selected properties. It does not recursively analyze all contents for malware.

Does a ZIP bomb warning always mean an attack?

No. Innocent repetitive data can also compress extremely well. Exceeded budgets still justify blocking processing.

Can I inspect RAR or 7z in the same way?

No. RAR, 7z and ZIP64 do not have supported complete archive inspection. An unknown format receives no content clearance.

Related reading

Technical sources