Archive Extraction Safety

Prevent zip-slip, zip bombs, and parser abuse in archive handling pipelines.

archive security

Threats to Control

Archive processing is high risk because extraction can explode disk usage and create dangerous filesystem paths. Without safeguards, attackers can overwrite files or trigger resource exhaustion.

  • Path traversal (zip-slip): ../ segments or absolute paths.
  • Decompression bombs: tiny archive, huge expanded output.
  • Nested archive recursion and parser crashes.

Hardened Extraction Policy

  • Normalize and validate target paths before write.
  • Set per-file and total expanded-size limits.
  • Set recursion depth and file-count limits.
  • Use isolated temp directories and drop privileges.

Regression Inputs for Archives

Maintain explicit malicious fixture archives in private security test suites. Ensure every hardening control has a dedicated positive and negative test so future refactors cannot silently remove defenses.

Recommended Tools

MIME Inspector

Compare extension and signature hints to detect type mismatches.

Open Tool

Batch MIME Classifier

Classify many files at once and highlight mismatch risks.

Open Tool

Checksum Generator & Verifier

Compute SHA256 and verify file integrity against expected hashes.

Open Tool