Lion Cipher Lab

Defeat Zip Slip: stop path traversal in archive extraction (from scratch, offline)

Why it matters

Almost every non-trivial service unzips something a user gave it: CI systems unpack build artifacts, plugin and theme installers unpack uploads, avatar and 'import my data' features unpack archives, container builders unpack layers. The moment code takes a file NAME out of an untrusted archive and joins it to a destination directory, it inherits a thirty-year-old bug that Snyk repackaged and named 'Zip Slip' in 2018: an archive entry called ../../../../etc/cron.d/pwned does not extract into your upload directory, it extracts OVER a file somewhere else on disk, because…

What you'll learn

Steps in this lab

  1. The vulnerability in one sentence, and why it still ships in 2026
  2. Set up: one folder, one file, and the safety promise
  3. Build the malicious ZIP from scratch, and the cross-platform backslash gotcha
  4. Build the malicious TAR: the symlink and hardlink escalation ZIP cannot do
  5. The safe extractor from scratch: realpath + commonpath containment
  6. The naive extractor: why os.path.join(dest, name) is the entire bug
  7. Does the standard library save you? zipfile vs tarfile, and the decade-long gap
  8. Run it: measure the escape, then watch containment block every variant
  9. The judgment layer: when this bites, and how to do extraction better
  10. When the standard library protects you, when it still does not, and the limits of this engine

Open the full interactive lab →