← Security lab: audit a Pi with Kali

Challenge: audit, fix and prove it

A real audit is a cycle: scan to find, fix, then scan again to prove the fix worked, and write down what you did. Your report is the before and after scans, each finding with its fix, and an honest note on what a scan cannot see.

You say the target is safer now. How do you prove it?

This is the whole course in one job. You scan from Kali and save the result, log in to the target as admin to fix it, log out, and scan again. The two saved scans are your evidence. A scan only sees open doors and versions, so your report also says what it cannot see (weak passwords, bad permissions, what is inside the files).

How this lesson works: Predict, Try, Investigate, Modify, Practise, Make
PredictRead the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.

Prove it

You have fixed the target. How do you know the fixes worked?

TryTry it on the board and compare the result with your prediction.

Try: the before scan

Was your prediction right?

Try it yourselfYour edits are saved in this browser.

Scan the target with versions and save it as before.txt.

Use the board. This ticks when you get there.

InvestigateWork out why it happens, one step at a time.

Worked example: The audit cycle

Worked exampleBefore each step, say what you think comes next.
  1. nmap -sV target > before.txt\text{nmap -sV target > before.txt}evidence of the problem.

Now try it yourself.

Which of these is NOT something a port scan can show you?

Sam hands in a report. Click the line where it first goes wrong.

Your after-scan shows nothing wrong. What should the report still say?

ModifyChange the problem on purpose and see what happens.

Vary: change one thing

Try it yourselfYour edits are saved in this browser.

Run the 'before' scan with versions and save it as before.txt.

Use the board. This ticks when you get there.

Log in to the target as admin and close the two risky services: stop telnet and vsftpd.

Use the board. This ticks when you get there.

The risky services are already stopped. Scan again and save the result as after.txt.

Use the board. This ticks when you get there.

PractiseA few on your own, to check you have it.

Practise

Why keep both scans, before and after?

What does a clean after-scan prove?

Review: the log shows 14 failed root logins. Which fix goes in the report?

MakeMake your own problem using what you have learned. Expect a few tries; that is normal.

Audit, fix and prove it

Then write your report: each finding, its fix, what the fix does not protect, and what the scan cannot see. That is the project brief.

Try it yourselfYour edits are saved in this browser.
Need a hint?

Before a hint: what kind of stuck is this? Try a strategy first

Before, fix, after: three stages.

Another hint

nmap -sV target > before.txt. Then ssh admin@target and apply the four fixes. Then exit.

Another hint

nmap -sV target > after.txt.

Audit the target: save a before scan, fix every finding on the target (risky services, old versions, ssh password and root login), then save an after scan.

Use the board. This ticks when you get there.

Now you can
Finished the course?Go over it: Security lab: audit a Pi with Kali recapEvery idea in one place, to check you've got it.You reached the endBack to Security lab: audit a Pi with Kali
For teachers

A real audit is a cycle: scan to find, fix, then scan again to prove the fix worked, and write down what you did. Your report is the before and after scans, each finding with its fix, and an honest note on what a scan cannot see. About 40 minutes.

Open the teacher guide: answers, solutions, slides and a worksheet.

Students will be able to

Before class

Try the board yourself; it is the longest Make in the course.

The gate (read first). This course teaches security as audit and defence: you scan, read and fix a lab computer your class owns. The pretend Kali and target in the lessons are safe anywhere. The real-lab version is different, so it needs your sign-off before anyone starts: school policy and IT's agreement, a written lab agreement every student signs (lab-rules.txt on the board is a model), and a lab that is cut off from every other network: a Pi running Kali and a second Pi or a virtual machine as the target, joined by one switch or one ethernet cable, with no router and no internet. Download the Kali image and any tools once, at home or at IT's request. Scan only the target named on the lab sheet. This course does not teach breaking into anything: it stops at find, understand and fix. It relaxes the 'defensive only' rule of the other courses only in that the real lab uses real scanning tools on a computer the class owns.

The one idea: security work is a cycle with evidence, and an honest report names what it did not check. Simplifications: the pretend target has four findings. A real target would also have weak passwords, loose file permissions and web problems that need different tools: say so, and do not go there in this course.

Real lab, if you run one: Kali Linux has a Raspberry Pi image (Pi 4 or Pi 5; the Pi 5 wants its 27 W supply); flash it with Raspberry Pi Imager or the Kali image instructions and boot it with a screen and keyboard, or ssh in. The target can be a second Pi (an older Raspberry Pi OS with a few extra services) or a purpose-made practice target your IT team approves. Start from the same state every time: re-flash, or snapshot a virtual machine. nmap is already on Kali. Give each pair a printed lab sheet naming the target's address, the one account they may use and what they are allowed to change.

Assessment: the project brief (audit-report) turns the cycle into a hand-in; check that the 'does not protect against' column is honest and that the before and after scans really differ.

Beyond this course: if a student wants to go further (exploitation, web testing), treat it as a separate, closely supervised extension with its own sign-off, a contained lab and your school's agreement. A good next step that stays defensive is to set up the target themselves in System admin on a Raspberry Pi, then audit it here.

Running the lesson

  1. Predict: wrong answers trust the commands.
  2. Try: ask what the before scan is for.
  3. Worked example: stop at Sam and ask what a reboot would have done.
  4. Vary: ask who could check the evidence.
  5. Make: ask what is not tested.

The hard part (on purpose)

Wanting to say 'secure'. The report says 'these findings are fixed; these things were not tested'.

When students get stuck

Stretch and support

Stretch: Add one fix that a scan cannot check, such as turning on automatic updates, and say how you would test it.

Support: A checklist: before scan, four fixes, restart, after scan.

Where it leads

Links: Security and privacy (finale); Cyber safety and privacy (threat models); System admin on a Raspberry Pi.

Beyond this course, legal hosted practice: picoCTF (Carnegie Mellon, free for school students) and PECAN+ (pecanplus.org, run by Edith Cowan University for Australian students in Years 10 to 12; free, with practice challenges at practice.pecanplus.org and a yearly event, the 2026 one already held). Check each one's account and age requirements, and your school's policy, before recommending it.

What each step is for