Lion Cipher Lab

Exploit and fix an insecure file upload (in your own lab)

Why it matters

Unrestricted file upload is one of the highest-impact web bugs because the payoff can be direct code execution on the server: if an app lets a user upload a file and stores it somewhere the web server will EXECUTE (a .php, .jsp, .aspx in a served directory), the attacker uploads a script and then requests it to run their code as the app. Even when execution is not possible, a trusted-name upload enables path traversal (choosing where the file is written, overwriting other files), stored cross-site scripting via an uploaded HTML or SVG, and content-type confusion. The root cause is trusting…

What you'll learn

Steps in this lab

  1. What insecure file upload is — the vocabulary and the ground rules
  2. Set up: confirm Python, make a folder, install Flask and Pillow
  3. Build the VULNERABLE app (it trusts the client's filename)
  4. Prove the two failures (a traversal filename, and forged type/extension)
  5. Why blocklisting extensions (and trusting magic bytes alone) is the wrong fix
  6. Fix it: rename, validate real bytes, store outside the web root, cap size
  7. What you did — and the reflex to keep

Open the full interactive lab →