Labs / Threat Frameworks / Name, place and map: the analyst's frameworks

Lab 3 of 3 · Name, place and map: the analyst's frameworks

Control baselines: audit one host, map every gap

Audit one host against a written baseline, then map every pass and fail to its CIS safeguard and NIST CSF subcategory.

Start this lab 5 steps

The idea

Wren keeps the servers running at Tidewater College, and an external review is a month away. Rather than guess what the reviewers will flag, Wren measures the course-registration host against the college's own written baseline: run each check, decide pass or fail, and tag every result with the control it belongs to. The point is a scorecard the reviewers and the college's management can both read. The fixing comes later.

The check gives the verdict, the catalogue gives the label
The check gives the verdict, the catalogue gives the label
The number is root, not the name
The number is root, not the name
One finding, three layers
One finding, three layers
No rule, no record
No rule, no record
Two catalogues slice the same findings differently
Two catalogues slice the same findings differently

Steps

  1. A baseline is a yardstick

    A baseline is a written statement of what a correctly configured host should look like: specific, checkable requirements, not impressions. An audit measures a real host against that baseline: run each check, compare, and record pass or fail. (Wren is measuring her own host before the external review, so this is a self-assessment; the outside reviewers will re-run every check themselves.)

    What turns a pile of findings into something a reviewer can use is the mapping: tagging each result with a label from a shared catalogue, so the finding means the same thing on every host. Two catalogues are in play, and they are separate documents.

    The Center for Internet Security (CIS) publishes the CIS Controls: 18 numbered Controls, each split into numbered Safeguards (for example 8.2, Collect Audit Logs). The National Institute of Standards and Technology (NIST) publishes the Cybersecurity Framework (CSF): six Functions (Govern, Identify, Protect, Detect, Respond, Recover), each split into Categories and Subcategories (for example PR.PS-04).

    A finding is labelled at the safeguard and subcategory level; the Control and Function are the headings they sit under. A crosswalk lines the two catalogues up, because neither replaces the other. Read the baseline and the catalogue, then check the first requirement yourself.

    portal:~# cat /root/audit/baseline.txt
    portal:~# cat /root/audit/inventory-export.yaml
  2. The keys to root: UID 0 accounts

    On Linux, power comes from UID 0 (a user id of zero), not from the name "root". Any account whose user id is 0 is root: the same total control, under a different login name. So requirement 2 is blunt: only root may have UID 0.

    The check reads /etc/passwd and prints the login name of every line whose third field (the UID) is 0. The baseline expects exactly one name back. More than one means someone created a second, hidden superuser (an account with root's full control).

    Run the check and map the result: which catalogue entries does a second UID-0 account fail against?

    portal:~# awk -F: '$3 == 0 { print $1 }' /etc/passwd
  3. What the config really says: SSH root login

    Requirement 3 is about configuration, not accounts: SSH should refuse a direct login as root. Letting root log in over the network hands an attacker a single, well-known username to aim every password guess at, and loses the per-person attribution that logging in as yourself and then using sudo leaves: the auth log would show only root.

    The setting lives in sshd_config as PermitRootLogin. The baseline wants no. The check pulls that line out of the file, so you read what the file says rather than assuming it.

    Run the check, then map it, and watch which catalogue the setting lands in.

    portal:~# grep -i '^PermitRootLogin' /etc/ssh/sshd_config
  4. Is anything recorded: audit logging

    The last requirement is about keeping a record. If something goes wrong on portal, could anyone reconstruct which commands ran and which files changed?

    On Linux that detailed record is the job of the audit system (auditd), and what it records is set by rules: a -w rule watches a file, a -a rule records a kind of system call. Requirement 4 wants at least one such rule.

    Where does generating that record sit in the frameworks? It is tempting to file logging under Detect, but NIST CSF 2.0 puts generating audit logs under Protect, subcategory PR.PS-04. Detecting an intruder is what you do with the logs afterward.

    Read the audit rules file and decide: is anything being recorded?

    portal:~# cat /etc/audit/rules.d/audit.rules
  5. The scorecard, and what the map is for

    Four checks, four results: one pass and three fails. On its own that is a to-do list. Tagged with safeguards and subcategories, it becomes a scorecard that speaks the reviewers' language.

    The scorecard template ships with the format worked once (row 1) and the rest blank: filling the verdict and the two labels for each row is the audit, your own judgement, not a handout. You have gathered every observation and mapped every finding in the last three steps, so read the template now and assemble the result.

    Read the scorecard template, then compare it to the finished mapping below.

    portal:~# cat /root/audit/mapping.txt

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