← Security lab: audit a Pi with Kali

Old versions and plain text

A scan can also ask each service for its version. Old versions have known problems that have since been fixed, so an old version is a finding. Some services are risky however new they are: telnet sends everything, including passwords, as readable text.

Two web servers both show port 80 open. Which one should worry you?

Programs get fixed as people find problems in them. The version number tells you which fixes a service has. The lab's advisory sheet (an offline copy your teacher made) lists which versions are old, because the lab has no internet to look them up. Some services are a problem whatever their version, because of how they work.

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.

Which is riskier

One server says Apache 2.4.18 and another says Apache 2.4.62, both on port 80. Which is more likely to have known problems?

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

Try: scan for versions

Was your prediction right?

Try it yourselfYour edits are saved in this browser.

Scan the target for versions with nmap -sV target.

Use the board. This ticks when you get there.

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

Worked example: Reading versions against the sheet

Worked exampleBefore each step, say what you think comes next.
  1. nmap -sV target\text{nmap -sV target}scan and ask each service for its version.

Now try it yourself.

The lab has no internet. Where do you check whether OpenSSH 7.2p2 is old?

Sam reads a version. Click the line where it first goes wrong.

Telnet's version is new. Why is it still a finding?

ModifyChange the problem on purpose and see what happens.

Vary: change one thing

Try it yourselfYour edits are saved in this browser.

Read the advisory sheet: cat advisories.txt.

Use the board. This ticks when you get there.

Scan only ssh's version: nmap -sV -p 22 target.

Use the board. This ticks when you get there.

Save a version scan in a file called scan2.txt.

Use the board. This ticks when you get there.

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

Practise

The advisory sheet says 'below 3.0: old' for vsftpd. The scan shows vsftpd 2.0.8. What is it?

Why can't you fix an insecure protocol like telnet just by updating it?

Review: a port shows 'filtered'. What does that mean?

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

Write the findings

Then: cat findings.txt to check it. Next: what an attack on the login looks like in the log.

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

One line per finding in a file called findings.txt.

Another hint

echo "OpenSSH 7.2p2 is old" > findings.txt, then use >> for more lines.

Another hint

Four findings: OpenSSH, vsftpd, Apache and telnet.

Write your findings in findings.txt: one line each for OpenSSH, vsftpd, Apache and telnet, saying what is wrong.

Use the board. This ticks when you get there.

Now you can
Next lesson4. What guessing looks like in the logA computer records every login attempt. A long run of failures for one account from one address in a short time is someone guessing passwords. Reading the log is the defender's view of an attack, and the fix is to make guessing harder, not to hope it fails.
For teachers

A scan can also ask each service for its version. Old versions have known problems that have since been fixed, so an old version is a finding. Some services are risky however new they are: telnet sends everything, including passwords, as readable text. About 40 minutes.

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

Students will be able to

Before class

Try the boards yourselves.

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.

Simplifications: the versions and the advisory sheet are made up for the lab (they describe real kinds of old, not real exploits). A real audit looks versions up in a vulnerability database, with the internet, and checks whether a fix has been 'backported' (distributions often patch an old number). The board does not teach how to use any weakness, and this course does not either.

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.

Other options: searchsploit and online databases catalogue known problems: for the report, read them to understand the risk, and do not run what they list.

Running the lesson

  1. Predict: wrong answers treat the version as a label.
  2. Try: ask which services the class thinks are old.
  3. Worked example: stop at Sam and ask what a fixed problem is.
  4. Vary: ask why the sheet is offline.
  5. Make: ask what a reader needs from each finding line.

The hard part (on purpose)

Treating versions as trivia. Ask: what fixes does this one not have?

When students get stuck

Stretch and support

Stretch: Find out what a CVE is and why vulnerability databases give each problem a number.

Support: The advisory sheet next to the scan.

Where it leads

Links: Security and privacy; Secret messages (what encryption is for); next: What guessing looks like.

What each step is for