Lion Cipher Lab

Detect a port scan from firewall logs and tune the threshold

Why it matters

A port scan is almost always the first thing an attacker does once they can reach your network: before they can break in, they have to find out what is listening. They sweep one port across many of your hosts to find every box running a vulnerable service (a HORIZONTAL scan), or they hammer many ports on one interesting host to map everything it exposes (a VERTICAL scan). Catching that reconnaissance early -- while the attacker is still knocking on doors rather than walking through one -- is one of the cheapest, highest-leverage detections a SOC can own, and the raw material is a log you…

What you'll learn

Steps in this lab

  1. What a port scan looks like in a log, and the two shapes it takes
  2. Generate a self-contained firewall log (nothing is scanned)
  3. Build the detector (part 1): a sliding window that measures fan-out per source
  4. Build the detector (part 2): flag, then grade yourself with precision and recall
  5. The naive round: why raw connection count flags the backup server
  6. Tune the threshold: watch precision climb from 0.67 to 1.00
  7. The honest negative: the low-and-slow scan that no threshold catches
  8. The judgment: when fan-out wins, and how pros ship it

Open the full interactive lab →