Lion Cipher Lab

Exploit and fix Local File Inclusion (LFI) — path traversal to code execution (in your own lab)

Why it matters

Local File Inclusion is a flagship injection-family web bug: the app builds a FILE PATH out of user input and then opens or include()s it, so the attacker chooses which file the server reads. In PHP the include() family makes the impact brutal because an included file is not just read, it is EXECUTED — which is why LFI so often becomes Remote Code Execution. The bug hides in ordinary features: page routers (?page=about), template loaders, language selectors (?lang=en), and file-download/view endpoints. In this lab you build exactly that mistake on your own machine — a page router that does…

What you'll learn

Steps in this lab

  1. What LFI and path traversal are — the vocabulary and the ground rules
  2. Set up: build the VULNERABLE app and run it in one container
  3. Confirm normal use, then exploit path traversal to read /etc/passwd
  4. Read the app's own source code with a PHP wrapper (php://filter)
  5. Escalate LFI to code execution — benign, local LOG POISONING
  6. Why blocklisting `../` is the wrong fix (and LFI vs RFI vs traversal)
  7. Fix it: map an opaque id through a strict allowlist
  8. What you did — and the reflex to keep

Open the full interactive lab →