Ziphaven is an intentionally vulnerable application built for security education. It is a small release & download hub with a deliberate path traversal (CWE-22) flaw — hidden behind a filter that inspects the filename before decoding it — so you can practice finding and exploiting it in a safe and controlled environment.
| 🛡️ Vulnerability | 🎯 Difficulty | 🛠️ Stack | 🚩 Entry point |
|---|---|---|---|
| Path Traversal (CWE-22) | ⭐⭐⭐⭐ Level 5 (Filter before decode) | PHP · Apache | GET /download.php?file=<name> |
Note
The guided, spoiler-free path is GUIDE.md; the full answer waits in SOLUTION.md whenever you want it.
The repository is organised so the vulnerable code is easy to find and reason
about. Three areas, clearly separated: the application (PHP) with its public
front controllers in public/ and its logic in src/, the served data in
downloads/ (the directory the app is meant to expose), and the tooling
around it (Docker image with Apache + mod_php, CI/CD, linters). The challenge
flag is deliberately kept out of both the repo and the served directory — see
the note under the tree.
ziphaven/
├── public/ # web root (DocumentRoot, served by Apache)
│ ├── index.php # downloads list (home)
│ ├── download.php # the VULNERABLE download endpoint
│ ├── error.php # styled 404 (Apache ErrorDocument)
│ ├── style.css # download-hub UI styles
│ └── favicon.svg
├── src/ # application logic (PSR-4 Ziphaven\)
│ ├── Download.php # the filter-before-decode bug (lives here)
│ ├── Config.php # paths resolved from DATA_ROOT
│ ├── Files.php # demo release catalogue
│ └── View.php # layout / rendering helpers
├── downloads/ # served release files (the "allowed" directory)
├── tests/ # PHPUnit tests (assert the traversal)
├── tools/ # build-time asset generator + traefik config
│ ├── generate_downloads.py # builds real tar.gz/zip decoy artefacts
│ └── traefik/ # reverse-proxy config (static + dynamic routing)
├── SOLUTION.md # exploit writeup + the fix (spoilers)
├── SECURITY.md # security policy (it's a lab — read before reporting)
├── .github/workflows/ # integration · delivery · security · release
├── Dockerfile # single image: php:8.3-apache (mod_php)
├── docker-compose.yml # ziphaven + traefik stack
├── composer.json # autoload + dev tools (phpunit, php-cs-fixer, phpstan)
├── phpstan.neon · .php-cs-fixer.php · phpunit.xml
└── .env.example # Traefik ACME credentials template (copy to .env)
The PHP code lives in public/ + src/ and reads its files from
downloads/, just like a real release hub would. The target flag.txt is
not in the repo: the Docker image writes it to /app/flag.txt at build
time — outside the served downloads/ dir — so traversal can reach it while
the flag stays out of version control.
Ziphaven runs as a Docker Compose stack:
ziphaven— the download manager: a singlephp:8.3-apacheimage where Apache serves static files and executes the PHP directly. Published on8100.traefik— a reverse proxy that serves the app over HTTPS on a real hostname. Optional: only needed for the domain-based access.
Because the stack attaches to an external Docker network (iv0ks-dev),
create it once before the first run:
docker network create iv0ks-devStart only the ziphaven service (Compose skips traefik when you name a
service explicitly):
docker compose up -d --build ziphavenThe download hub is now reachable directly at:
That is all you need to start playing with Burp Suite.
Bring up everything to also expose the app through Traefik with TLS:
docker compose up -d --buildNow the same app is reachable two ways at once:
- http://localhost:8100 — direct, no TLS (handy for quick testing).
- https://ziphaven.iv0ks.dev — proxied by Traefik with a real certificate.
Traefik routing is defined in tools/traefik/. TLS uses the ACME DNS-01
challenge via Namecheap, so Traefik needs those API credentials — copy
.env.example to .env and fill them in (the .env file is gitignored).
Caution
The ziphaven.iv0ks.dev hostname must resolve to the host running the stack.
For purely local experiments, Option A (localhost) is simpler and needs no
DNS or certificates.
For quick frontend iteration you can use PHP's built-in server (the flag is seeded locally and gitignored):
printf 'FLAG{ZIPHAVEN_UNZIPPED}\n' > flag.txt
DATA_ROOT="$PWD" php -S 127.0.0.1:8100 -t publicZiphaven is a release & download hub: it serves build artefacts from a
downloads/ folder. This developer knows about traversal and rejects any
filename containing ../ — but runs that check before an extra decode step.
You're going to prove that validating before you decode is the same as not
validating at all.
Read a file that lives outside the downloads directory — specifically, capture the flag in flag.txt.
Note
The flag has the format FLAG{...}.
Everything happens over HTTP against the running app — no need to
read the source to win (though you can). The flag is not in the repo: it's
baked into the container, outside downloads/, so you have to actually reach
it.
Tip
For the full method, the Learning Guide walks you through it.