open atlas
↑ Back to track
Defensive Security BLUE · 03 · 03

CIS benchmarks and baselines

CIS Benchmarks give you a vetted hardening baseline so you do not invent one. The senior work is the loop after: capture that baseline as code, then detect and close configuration drift before an attacker finds the gap.

BLUE Middle ◷ 15 min
Level
FoundationsJuniorMiddleSenior

The post-mortem is three pages long and the root cause is one line: PermitRootLogin yes. Six months ago someone debugged a stuck deploy by SSHing in as root, flipped that flag, and never reverted it. The hardened image you shipped had it set to no. The running host did not. No CVE, no exploit chain — just a setting that drifted away from the baseline you thought you had, on a box nobody re-checked. The attacker did not break in. They logged in. This is why hardening is not a one-time task: a baseline you set and never measure against is a baseline you have already lost.

By the end of this lesson you’ll know why CIS Benchmarks are the baseline you should start from, how to encode that baseline so it survives contact with production, and how to detect the drift that quietly reopens the holes you closed.

What a CIS Benchmark actually is

You do not want to invent “what does a hardened Ubuntu host look like?” from scratch — that is months of research per platform, and you will miss things. A CIS Benchmark is the answer someone already built: a consensus-developed, prescriptive configuration guide for a specific platform — a Linux distro, Windows Server, Kubernetes, PostgreSQL, nginx, an AWS account, a Docker daemon. There are over 100 of them, each maintained by a community of practitioners and revised against new platform versions and new attack techniques. Where a generic guide like NIST SP 800-123 tells you the principles of server hardening (minimize the attack surface, run least privilege, patch, log), a CIS Benchmark gives you the exact settings that implement those principles on the box in front of you, down to the file, line, and expected value.

Two structural features matter for how you use it. First, recommendations are split into Level 1 (practical hardening that should not break normal function — the sane default for most fleets) and Level 2 (defense-in-depth for high-security environments, accepting that some functionality or convenience is sacrificed). Second, each recommendation is tagged Automated or Manual: Automated items have a machine-checkable audit and remediation procedure, Manual items require human judgment. That split is the single most important thing a senior reads off the benchmark, because it tells you exactly which controls you can enforce continuously and which need a process instead.

Benchmark conceptWhat it meansSenior reading
Level 1Practical hardening, shouldn’t break normal functionBaseline for the whole fleet; enforce by default
Level 2Defense-in-depth, may sacrifice function/convenienceReserve for high-value hosts; test for breakage first
AutomatedMachine-checkable audit + remediationEncode as code; check on every host, every day
ManualNeeds human judgment to assessOwns a process/review, not a scanner rule
ProfileThe set of recommendations you commit toYour baseline = benchmark minus documented exceptions

From benchmark to your baseline

A benchmark is not a baseline. The benchmark is the menu; your configuration baseline is the meal you actually commit to — the specific set of recommendations, at the level you chose, minus the exceptions your environment legitimately needs, each exception written down with a reason and an owner. This distinction is where most hardening programs quietly fail. A team that treats “100% CIS compliant” as the goal hits a recommendation that breaks their app — say, disabling a kernel module their monitoring agent needs — and instead of recording a justified exception, they either ship a broken host or silently turn the whole check off. Now the baseline lies.

The senior move is to derive the baseline once, deliberately. Start from the appropriate level (Level 1 for the fleet), walk the recommendations, and for each one make an explicit decision: apply, or except-with-reason. The output is a baseline document — ideally machine-readable — where a deviation is never a surprise. The reason this matters for drift detection is causal: if you cannot say what “correct” is, you cannot detect “incorrect.” A clean, exception-annotated baseline is the reference that every running host is measured against. No reference, no drift detection — just hope.

Why this works

Why not just aim for a 100% score? Because a compliance percentage is an average, and averages hide the controls that matter. A host can score 96% while the missing 4% is “SSH root login enabled” and “audit logging disabled” — the two settings an attacker most wants. CIS scoring weights every Automated check roughly equally, so the number rewards closing many trivial gaps over the one critical one. Use the score as a coarse trend, never as the goal. The goal is this specific set of controls is enforced, and every deviation is a recorded decision — which a single percentage can never express.

Drift: how a hardened host un-hardens itself

You harden the golden image, you ship it, you move on. Then entropy arrives. Configuration drift is the gap that opens over time between the baseline a host was provisioned with and its actual running state. It is not usually malice — it is operations: an engineer disables a control to debug an incident at 2 a.m. and forgets to re-enable it; a package update resets a config file to its vendor default; a manual hotfix patches one box but not the other forty; two teams own overlapping config and each “corrects” the other. Each change is individually reasonable. The aggregate is a fleet where no two hosts are quite the same and the security posture you designed exists only in the image, not in production.

Drift is dangerous precisely because it is invisible by default. The host still runs. The app still serves traffic. Nothing alerts. The drifted setting only announces itself when an attacker — or an auditor — finds it. So the defender’s job is to make drift visible: continuously re-audit every running host against the baseline and surface every deviation, so a control that flipped from no to yes raises a finding the next day instead of in the post-mortem.

Compliance as code: closing the loop

Detecting drift by hand does not scale past a handful of hosts. The durable pattern is compliance as code: express the baseline as machine-readable, version-controlled rules, and run them automatically against every host on a schedule and in the deploy pipeline. CIS ships its baselines in a structured format and provides tooling (CIS-CAT), and the open ecosystem encodes benchmarks as OpenSCAP/SCAP content or as policy in tools like Chef InSpec, Ansible, or OPA. The shape is the same regardless of tool: a control is a rule with an audit (how to read the current value) and often a remediation (how to set the correct value), checked into a repo and run by CI.

Encoding the baseline as code buys you four things at once. The baseline is now reviewable (a change to a control goes through a pull request, not a 2 a.m. SSH session), versioned (you can prove what “correct” was on any date — which auditors love and incidents require), enforced uniformly (the same rules run on host 1 and host 41, so drift between hosts is caught), and fast to detect (a scheduled scan turns a six-month-old silent regression into a next-morning finding). The remaining senior decision is what to do on a deviation: alert-only for controls where auto-fixing could break a workload (let a human reconcile), versus auto-remediate for controls where the correct value is unambiguous and safe to enforce — converging the host back to the reference without waiting for a ticket.

Pick the best fit

A scheduled compliance-as-code scan reports that `PermitRootLogin` drifted from `no` to `yes` on 1 of 40 production hosts. What's the right response design?

Quiz

What is the difference between a CIS Benchmark and your configuration baseline?

Quiz

A host scores 96% on a CIS scan. Why might a senior still treat it as a serious problem?

Order the steps

Order the hardening-and-drift lifecycle from start to steady state:

  1. 1 Pick the CIS Benchmark + level for the platform
  2. 2 Derive your baseline: apply or except-with-reason per control
  3. 3 Encode the baseline as version-controlled compliance-as-code
  4. 4 Continuously audit every running host against the baseline
  5. 5 Remediate (or alert + record) on each detected deviation
Recall before you leave
  1. 01
    Explain the difference between a CIS Benchmark, a configuration baseline, and configuration drift — and why all three are needed to actually stay hardened.
  2. 02
    What is 'compliance as code,' and how do you decide between alerting and auto-remediation when a scan detects drift?
Recap

CIS Benchmarks are consensus, prescriptive hardening guides — over 100 of them, one per platform — that give you the exact settings to start from instead of inventing “hardened” yourself, where NIST SP 800-123 only gives the principles. Read two things off every benchmark: Level 1 vs Level 2 (fleet default vs high-security defense-in-depth) and Automated vs Manual (what you can enforce continuously vs what needs a process). But a benchmark is not a baseline: your configuration baseline is the specific set you commit to, minus exceptions recorded with a reason and owner, and that exception-annotated reference is the only thing you can measure drift against — no reference, no drift detection. Configuration drift is the silent, ordinary gap that opens between that baseline and a host’s running state, and it’s invisible until an attacker or auditor finds it. The fix is a loop, not a one-time hardening pass: encode the baseline as compliance-as-code (reviewable, versioned, uniform, fast), continuously audit every running host, and on each deviation either auto-remediate the unambiguous controls or alert a human for the ones that could break a workload. Now when you see a hardened image ship, your next question is: what re-checks the running host tomorrow — or did we just harden the image and call it done?

Practice

Start at the top. Tasks go easiest → hardest: recall a fact, apply it to a case, then a senior-level stretch. Open one, attempt it, then reveal.

recallapplystretch0 of 6 done
Connected lessons

Something unclear?

Ask a question about this lesson. Questions are anonymous and go straight to the author to make the lesson better.

shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources2
expand
  1. 01
  2. 02

Trademarks belong to their respective owners. Editorial reference only.