Labs / Security Basics / Threats and weaknesses

Lab 1 of 5 · Threats and weaknesses

Threat actors: who is behind an attack, and why

Read the logs of three incidents at one small studio and sort them by attacker: an automated scan, an insider, a patient outsider.

Start this lab 5 steps

The idea

Anneke takes the orders at Emberline Ceramics, a ten-person tile studio, and looks after its three machines on the side. October brought three security incidents, and Bettina, who owns the studio, wants to know whether somebody is out to get them. Read the logs each incident left and work out who was behind each one, and why.

The logs give a kind, not a name
The logs give a kind, not a name
One list, every address
One list, every address
Same login, different night
Same login, different night
The names came from the shop's own page
The names came from the shop's own page
Three actors, three shapes in one month
Three actors, three shapes in one month

Steps

  1. Three incidents, one question

    Bettina asks one question, "who attacked us?", and it has a different answer for each incident.

    Security people call whoever is behind an attack a threat actor. The evidence almost never gives you a threat actor's name. What it gives you is the kind: where they stood (inside the studio or outside it), what they wanted (their motivation) and how much skill, time and money they brought (their capability).

    Anneke keeps a note of every incident on files, the studio's file server. The lab has put October's logs back on all three machines, as the machines wrote them. Start with her notes.

    files:~# cat /srv/office/it/incidents-october.txt
  2. Case 1: the burst that was never about Emberline

    At 03:12 on Tuesday 6 October the studio's log watcher mailed Anneke: a burst of errors on the web shop. An attack in the middle of the night feels personal.

    A web server writes one line per request to its access log: the address that asked, the time, the page and a status number. 200 means the page was served, 404 means the server has no such page. The last part of each line is the name the visiting program gives for itself.

    Emberline's shop has five pages: /, /tiles, /studio, /news and /contact. Pull every 404 from the log and read what was asked for.

    shop:~# grep ' 404 ' /var/log/nginx/access.log
  3. Case 2: the login that broke nothing

    On Saturday 17 October, Dario's account logged in to files at 23:41. Two days earlier Dario, who packs the orders, had handed in his notice.

    Staff open the office folders on files over SSH. The server writes a line to /var/log/auth.log for each login and for each file a login opens: Accepted password is a login that worked, and open names a file it read. Anneke turned that file record on; it is off by default. The lab trimmed these logs to the lines that matter; a real month runs to thousands.

    To judge a login, learn what normal looks like first. Read an ordinary Friday, then the Saturday night.

    files:~# grep 'Oct 16' /var/log/auth.log
    files:~# grep 'Oct 17' /var/log/auth.log
  4. Case 3: slow, quiet, and it knew the names

    On Wednesday 21 October, Bettina's account logged in to remote, the one machine staff may reach from home. The login came from 203.0.113.77, an address outside the studio, while Bettina was loading the kiln.

    remote faces the internet, so its log also holds failed logins from scanners like the one in case 1: eight guesses in a quarter of a minute at names such as root and admin. A login that works after noise like that could be a scanner that got lucky.

    Pull everything this one address did on remote. Then ask shop whether the same address ever visited the website, and fetch the page it read.

    remote:~# grep '203.0.113.77' /var/log/auth.log
    shop:~# grep '203.0.113.77' /var/log/nginx/access.log
    remote:~# curl -s http://10.0.4.10/studio
  5. A valid login is not always an insider

    Cases 2 and 3 end with the same words: Accepted password. If a valid login meant an insider, Bettina robbed her own studio.

    Staff who log in to remote from home go on from it to files, and the outsider did the same. So files recorded the visitor's address as remote's own, 10.0.4.30. Bettina's own desk is 10.0.4.40. Read what her account did on files on 21 October, then on 22 October. In these lines opendir means a folder was listed.

    files:~# grep 'Oct 21' /var/log/auth.log
    files:~# grep 'Oct 22' /var/log/auth.log

Run these steps on real machines

Keep reading

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab