Penetration testing lab: from scope to retest

This lab gives each student a made-up college's small network to test the way a professional does: a public site, a staff portal and a session cache in the written scope, and an outside supplier's payroll gateway that is not. Students scan, record, prove each weakness with the least intrusive check, write the report and retest the fixes.

Every image is pinned by digest and nothing outside the copy can reach it. The college, its accounts and its weaknesses are made up for the exercises. The gateway logs every connection it receives, so a test that strays out of scope shows.

What students learn

A scope written as a file and read by Nmap, so only the hosts in it are touched. A connect scan, because the scanner runs without root, and a full scan of every port that finds the cache a default scan misses. Versions read as claims: the site says Apache 2.4.49 and is really Python.

Each finding proved once and no further: a 404 page, one file from a listed folder, one sign-in with a known default, the cache's own information. Then the fixes are released and retested: one fixed, one partly fixed, and one lost when the cache restarts.

Run it in your browser

The lab starts five services: scanner, www, intranet, cache and hr. The terminal beside the lab runs Nmap with docker exec and reaches the sites with curl. Open in the browser shows the college's site on port 8080.

  1. Open the Container page. Open Build on the bar and choose Run a container. Anybody may open it, and the Git lab and the SQL lab start with no account. Every other lab needs a free account: create one, sign in, then press Start.
  2. Find the lab. The Sample labs card lists every sample. Find Penetration testing: from scope to retest.
  3. Press Start. Start runs it as it is, in one press. Edit the file first opens the compose file so you can change it before you start. The lab is ready in under a minute.
  4. Open it. On the lab's page, press Open terminal and scan the hosts in scope, for example: docker exec scanner nmap -sT -Pn -p- --open www intranet cache

What to ask students to hand in

A short report: the scope and what was left alone, each finding with its severity, evidence, fix and how a defender would detect it, and what the retest showed. Nothing is marked automatically: the judgement in the report is the work.

A basic lesson on this lab

Penetration Testing Basics is a small lesson worked in this lab. In it a student reads the supplier's log, scans every port on the three hosts in scope, reads the site's banner and finds the scan in the site's own log.

Free personal accounts have it in the Basics module, which is on Home, and every college can copy it from the Library's Basics folder. It is deliberately small: the module Penetration testing methodology goes further, from the written agreement to the retest.

The code on GitHub

The compose file has no Dockerfile of its own: it runs the public images of Nmap, Valkey and Python, unmodified and not distributed by us. The site, the portal and the gateway are written by the file when the lab starts. The site's and portal's fixes are kept when the lab stops.

Set it as work

Say in the task what to hand in.

  1. Make the lab. In your module add a task and choose the Container lab card, then In a GitHub repository. Give https://github.com/mitsurutech/lab-pentest-lab with the branch main. The compose file is the default, compose.yaml. Fork the repository first if you want to change it, for example to add a weakness of your own.
  2. Publish and try it. Publish pins the commit you were shown, so a later change in the repository does not alter a lab you have already set. Start your own copy first.
  3. Hand it out. Assign it like any task, with a due date if you want one, and say in the task what to do and what to hand in.
  4. Mark what is handed in. Open a student’s copy and the work they handed in, mark it, and send it back with a reason if it needs more.

Try this lab, and what it costs

A free personal account can work through the basic lessons in this lab, with enough free credit each month to follow most lessons and no card. For a class, a school or college has its first 365 days free for up to 50 students, then pays per student a year, with every lab included and staff free.

Questions people ask

Why does the scanner refuse a SYN scan?
It runs as an unprivileged account, and a SYN scan builds its own packets, which needs root. A connect scan, -sT, does the same job by completing each connection, and the lessons use it.
Is anything here exploited?
No. Each weakness is proved with the least intrusive check and the test stops there: the false Apache banner is shown false by a 404 page, never attacked, and no key is read from the cache.
What is the hr host for?
It is the out-of-scope system every real network has: a supplier's gateway the college cannot authorise a test of. It logs every connection, so docker logs hr shows whether a test strayed.
Are the passwords in it real?
No. The portal's accounts and the cache's keys are planted fixtures, made up for the exercises. Nothing in the lab is a real credential.
Does it cost anything or use credits for AI?
No AI is used, so nothing is charged for it. The lab runs like any other container lab.