๐ฃ Zip Bomb Trap Demo
This project demonstrates a way to defend against malicious bots and crawlers by serving a compressed file (zip bomb) that decompresses into a massive payload, overwhelming memory-limited or poorly coded bots.
Read this blog post for more details.
โ๏ธ What It Does
- Runs a Express server (written in TypeScript).
- Serves a regular homepage at
/. - Serves a maliciously crafted gzip file at
/trap.- Appears small (e.g., 10MB).
- Decompresses into a massive file (e.g., 10GB).
- Can break naive crawlers, scrapers, or vulnerability scanners.
Includes a simulated bot client that:
- Sends
Accept-Encoding: gzipheader. - Downloads and attempts to decompress the trap.
- Simulates a crash if memory exceeds a threshold (e.g., 500MB).
๐งฑ Project Structure
zip-bomb-demo/
โโโ public/
โ โโโ 10GB.gz # The zip bomb file
โโโ server.ts # Express server
โโโ bot.js # Crawler simulator (Node.js)
โโโ package.json
โโโ tsconfig.json
โโโ README.md
๐ Setup Instructions
git clone <your-repo-url>
cd zip-bomb-demo
bun install # or npm install
mkdir -p public
dd if=/dev/zero bs=1G count=10 | gzip -c > public/10GB.gz # ->> Create a 10GB gzip file
bun run server.ts
bun run bot.ts