One account too many
A routine check makes you suspect that someone created an account on a production server. Read the list of accounts, recognize the normal ones and track down the one that should not be there.
Lab 11 of 13 in the Linux Fundamentals path. If you get stuck you have 3 hints, from the vaguest to the most precise: they cost 0, 50 and 150 XP.
What you learn
Objectives complete themselves while you work in the terminal; each one is worth experience points:
- Read the list of accounts (60 XP)
- Isolate the accounts with a login shell using grep (120 XP)
- Extract name and UID with cut (150 XP)
Topics: linux, utenti, passwd.
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.grep: finds the lines that contain a word, even across whole folders with -r. It is the main tool for analysing text and logs.cut: extracts one column from each line using a chosen separator, to isolate a specific field of a log.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:
Every account is a line of /etc/passwd and UID 0 is root, the one who can do everything: a second account with UID 0 is a hidden administrator, one of the favorite tricks of someone who wants to stay inside a system. With cut, grep and sort you spot it in seconds. Defense: check /etc/passwd and /etc/shadow regularly (also automatically, with tools such as AIDE or auditd that warn you when they change), make sure only root has UID 0, give service accounts the nologin shell, remove accounts that are no longer needed and work with personal accesses and least privilege (sudo) instead of shared accounts.
Before and after this lab
To unlock it you must have solved:
- Pipes and filters (Linux Fundamentals, medium)
After this lab you can move on to:
- What runs at night? (Linux Fundamentals, medium)
The Linux Fundamentals path
Linux Fundamentals is the starting point. Almost every server, network device and security tool runs on Linux, and anyone who defends a system (or tests it with permission) spends much of their time in a terminal. Here you learn to move around the filesystem, find hidden files, read huge logs piece by piece, search for words with grep, chain commands with pipes and understand permissions, environment variables and history: the basics you will use in every other path.