Skip to content
PURPLEDUEL

Who is taking the data?

Blue Team / Defense · medium level · 4 objectives · 500 XP in total

Forno Buongiorno sells bread online and this morning the site traffic is unusual. Knowing who makes the most requests is not enough: you must work out who took data away. Count the requests per address, then look at what they really obtained (status and amount of bytes) and decode the right file.

Lab 8 of 10 in the Blue Team / Defense path. If you get stuck you have 3 hints, from the vaguest to the most precise: they cost 0, 40 and 100 XP.

What you learn

Objectives complete themselves while you work in the terminal; each one is worth experience points:

  • Count the requests per address with sort and uniq (100 XP)
  • Look for the requests to the customers API (100 XP)
  • Decode the file of the address that took the data (100 XP)

Topics: defense, log, web, correlazione.

Commands you will use

The terminal is simulated and understands about forty Linux commands. In this lab you will mostly need these:

  • cat: prints the contents of a file: the most direct way to read configurations, notes and logs.
  • cut: extracts one column from each line using a chosen separator, to isolate a specific field of a log.
  • sort: sorts lines, numerically (-n) or in reverse (-r) too.
  • uniq: removes repeated adjacent lines and counts them with -c: together with sort it builds rankings, such as the most insistent addresses.
  • head: shows only the first lines of a file, handy for understanding a log format without reading all of it.
  • grep: finds the lines that contain a word, even across whole folders with -r. It is the main tool for analysing text and logs.
  • base64: encodes and decodes Base64, the format that turns bytes into text. It protects nothing: it can be undone without a key.
  • |: the vertical bar | chains commands: the output of the first becomes the input of the next, so small tools form a complete analysis.

The simulated environment

You work in a simulated Linux shell, in the home folder of the user runner: invented files and folders, no network target.

Besides the home folder there is a complete simulated system, with configuration files, logs, users and permissions to examine.

The defensive lesson

Once the lab is solved, the write-up explains what went wrong and how to protect yourself:

The number of requests does not measure the damage: whoever knocks on closed doors (a run of 404s) makes noise but gets nothing, a legitimate search engine makes many small requests, while whoever repeatedly downloads huge pages of a restricted API takes data away with few requests. Who, what, with which outcome and how many bytes must be read together. Defense: authentication and rate limits on APIs, maximum page sizes, alerts on outgoing byte volume per address, and logs sent to a system that correlates them.

Before and after this lab

To unlock it you must have solved:

After this lab you can move on to:

The Blue Team / Defense path

Blue Team / Defense is the path of those who protect. You read access logs, count failed attempts to find out who is forcing a login, rebuild the timeline of an incident, compare an SSH configuration with the recommended one, shut down unnecessary services and handle incident response in four steps: detect, contain, clean up, document. The commands are the same as in the other paths, but used through the eyes of someone who must understand what happened and stop it from happening again.

All labs in the Blue Team / Defense path

Learn more with the guides

All guides