Live lesson · progress saved to your account

System Security & Hardening

Shrink the attack surface, run patch management with CVSS and CISA KEV, apply CIS-style baselines, compare antivirus with EDR and design ransomware-proof backups. Then harden a real-feeling Linux server until the audit passes.

intermediate100 minwalkthrough

Anyone can read this lesson. To submit answers and earn XP, create a free account.

TASK 01Mission briefing: the failed audit

AUDIT REPORT · DeS/IT/2026/44 The Directorate of e-Services (a fictional state department that runs certificate and pension portals) failed its annual security audit. 40 of 52 servers are out of compliance: Telnet still running, root logins over SSH, months-old patches, a shared guest account and backups on a USB drive plugged into the file server. You have two weeks to fix it.

None of these are exotic. Most breaches use known, fixable weaknesses: missing patches, default or weak settings and services nobody remembers running. Hardening is the routine work of closing them before an attacker finds them.

In this room you'll:

  1. shrink a server's attack surface,
  2. decide which patches go first,
  3. apply a secure configuration baseline,
  4. understand antivirus vs EDR,
  5. design backups that survive ransomware, and
  6. harden gov-app-07 in a terminal until the audit tool says it's clean.

Answer the questions

+10 XP

+10 XP

TASK 02Attack surface reduction

A system's attack surface is the sum of every way in: open ports, running services, installed software, user accounts, admin interfaces, even USB ports. Fewer things = fewer chances.

Switch on controls and watch the surface shrink:

Shrink the attack surface CIS-style score 0%

0%

attack surface 100%

listening ports: 2223631803306

Every service, port, package and account is something an attacker can try. Hardening = remove what you don't need, lock down what you keep, and keep it patched.

The principle is least functionality: a server runs only what its job needs.

  • Services and ports: list what's listening (ss -tlnp on Linux, netstat -ano or Get-NetTCPConnection on Windows) and disable anything unexplained. Telnet (23) and FTP (21) send passwords in cleartext; replace them with SSH and SFTP.
  • Software: uninstall what's unused (old runtimes, demo apps, browser toolbars on servers).
  • Accounts: remove or lock default, shared and leftover accounts; rename or disable built-in admin accounts where possible.
  • Interfaces: admin panels, databases and RDP should never face the internet directly; put them behind a VPN.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 03Patch management

When a vulnerability is published it gets a CVE ID (Room 07). The moment a patch comes out, attackers compare old and new versions to find the bug and build exploits. It's a race:

The race: exploit vs patch 23 days exposed
day 0: disclosed + patchexploitation starts (day 7)patched day 30-100102030405060

Disclosure and a patch on day 0. Researchers publish a proof-of-concept a few days later; criminals scan the whole internet soon after.

Exposed to active exploitation for 23 days.

The patch process

  1. Inventory: you can't patch what you don't know you have (asset list, software versions).
  2. Prioritise: not everything at once (see below).
  3. Test: apply to a test group first; patches occasionally break things.
  4. Deploy: WSUS / Intune / Configuration Manager on Windows; apt, dnf, Ansible on Linux; auto-update where safe.
  5. Verify: re-scan to prove it worked, and track exceptions.

If you can't patch yet, mitigate: disable the vulnerable feature, block it at the firewall or WAF, or isolate the system.

What goes first?

  • CVSS (0.0–10.0) rates how severe a bug is in theory: 9.0+ critical, 7.0–8.9 high, 4.0–6.9 medium.
  • CISA KEV (Known Exploited Vulnerabilities) lists bugs actually being exploited in the wild. Exploitation beats severity.
  • EPSS estimates the probability of exploitation in the next 30 days.
  • Exposure and asset value: an internet-facing VPN matters more than a test box.

In India, CERT-In publishes advisories and has mandated incident reporting since 2022.

Lab · Prioritise 12 vulnerabilities 0/12 correct

Policy: in CISA KEV, or CVSS ≥ 9.0 and internet-facing → Now. Otherwise CVSS ≥ 7.0 → This month. Everything else → Next cycle.

V-01VPN gateway: auth bypass · remote access9.8KEVinternet
V-02Mail server: remote code execution · email9.1—internet
V-03HR laptop PDF reader: code execution · HR laptops7.8KEVinternal
V-04Internal wiki: remote code execution · intranet9.8—internal
V-05Web server: information disclosure · citizen portal5.3—internet
V-06Windows: privilege escalation · all PCs7.0KEVinternal
V-07Database: denial of service · records DB7.5—internal
V-08Firewall admin page: command injection · perimeter9.6—internet
V-09Print server: info leak · printers4.3—internal
V-10Browser: sandbox escape · all PCs8.8—internal
V-11Old Java on a test box: XSS · test server6.1—internal
V-12Citizen portal CMS plugin: SQL injection · citizen portal6.5KEVinternet

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 04Secure configuration baselines

Default settings are made for convenience, not security. A baseline is an agreed secure configuration that every system of a type must meet, and that you can audit automatically.

The most widely used are the CIS Benchmarks from the Center for Internet Security: free, consensus-built guides for Windows, Ubuntu, RHEL, Docker, Kubernetes, AWS, browsers and more. Level 1 is the practical baseline for most systems; Level 2 is stricter, for high-security environments. Governments and regulators often map their requirements onto them.

How baselines are applied:

  • Windows: Group Policy (GPO) in Active Directory, or Intune for cloud-managed PCs, pushes settings to thousands of machines.
  • Linux: configuration management (Ansible, Puppet) or hardened images.
  • Auditing: Lynis (Linux), CIS-CAT, Microsoft Security Compliance Toolkit, OpenSCAP.

SSH hardening (/etc/ssh/sshd_config)

SettingHardened valueWhy
PermitRootLoginnoLog in as a normal user, then sudo (audited)
PasswordAuthenticationnoKeys can't be guessed or phished like passwords
MaxAuthTries4 or lessSlows brute force
X11ForwardingnoUnneeded feature = attack surface

Password policy, the modern way

NIST guidance: favour long passphrases, check new passwords against breached-password lists, use MFA, and don't force periodic changes or "one symbol, one capital" rules, which just produce Password@1, Password@2…

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 05Endpoint protection

Laptops and servers (endpoints) are where attacks land. Watch the same attack against two kinds of protection:

Antivirus vs EDR Signature scanning
  1. 1invoice.docm opened from emailNew variant: no known signature yet.not seen
  2. 2WINWORD.EXE spawns powershell.exe -enc …
  3. 3PowerShell loads a payload straight into memory
  4. 4Process opens LSASS memory (credential dump)
  5. 5Beacon to C2 every 60 s
  6. 6Ransomware encrypts shares

Antivirus compares files against known-bad signatures. Good against old malware, blind to new variants, fileless attacks and legitimate tools used badly.

Antivirus (AV)EDR
Looks atFiles, against known-bad signaturesBehaviour: process trees, memory, network, registry
CatchesKnown malwareNew variants, fileless attacks, misuse of legit tools (PowerShell, PsExec)
RespondsQuarantine a fileKill process trees, isolate the host, roll back, full timeline for investigation

XDR extends the same idea across email, identity, cloud and network. A SOC watches the EDR alerts 24×7 (Room 17).

More endpoint controls

  • Application allow-listing: only approved programs can run (AppLocker / WDAC on Windows, fapolicyd on Linux). Very effective on kiosks and servers.
  • Disk encryption: BitLocker (Windows), FileVault (macOS), LUKS (Linux). A stolen laptop is then just hardware.
  • Least privilege: daily work without admin rights stops most malware from installing itself.
  • Device control: block unknown USB storage (Room 08's BadUSB).

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 06Backups and recovery

When everything else fails, backups decide whether ransomware is a bad week or the end of the organisation. Try each strategy against an attack:

Ransomware vs your backups Pick a strategy, then attack
file server
(no copies)

3-2-1: 3 copies of your data, on 2 different media, 1 off-site. Modern guidance adds 1 immutable or offline copy and 0 errors in restore tests (3-2-1-1-0).

The 3-2-1 rule: 3 copies of your data, on 2 different types of media, with 1 copy off-site. Ransomware gangs now hunt for backups first (they log into the backup console with stolen admin passwords and delete everything), so add:

  • 1 immutable or offline copy: object-lock storage, write-once tape or a disconnected disk that can't be changed for a set period, even by an admin.
  • 0 errors: test restores regularly. A backup you've never restored is a hope, not a plan.

Also decide in advance:

  • RPO (Recovery Point Objective): how much data you can afford to lose (e.g. 24 hours → daily backups).
  • RTO (Recovery Time Objective): how fast you must be running again.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 07Final mission: harden gov-app-07

gov-app-07 is one of the failed servers. Bring it to the baseline. Start with an audit to see where you stand:

Lab · Harden gov-app-07 to the baseline Run sudo lynis audit system
admin@gov-app-07: ~
gov-app-07 (Ubuntu 24.04 LTS) · logged in as admin · type 'help'
admin@gov-app-07:~$

Baseline (0/12 live)

Telnet server removed

CUPS printing service disabled

SSH: root login disabled

SSH: password authentication disabled

SSH: MaxAuthTries 4 or less

SSH: X11 forwarding disabled

Firewall enabled

Firewall default deny incoming

Firewall allows SSH (don't lock yourself out)

Automatic security updates installed

/etc/shadow not world-readable

No unlocked account with an empty password

Edits to sshd_config apply only after sudo systemctl restart ssh.

Hints

  • sudo lynis audit system shows what fails.
  • Remove Telnet with sudo apt purge telnetd. Stop and disable CUPS with sudo systemctl disable --now cups.
  • Edit SSH settings with sudo sed -i 's/^PermitRootLogin .*/PermitRootLogin no/' /etc/ssh/sshd_config, and do the same for the other three settings. Then restart SSH or nothing changes.
  • Firewall: allow SSH first, then set the default to deny and enable it. Otherwise you lock yourself out.
  • sudo apt install unattended-upgrades, sudo chmod 640 /etc/shadow, sudo passwd -l guest.

Then re-run the audit. In real life you'd now capture these steps in an Ansible playbook and apply them to the other 39 servers in minutes.

Complete the mission for the Hardened badge and the room's XP.

Answer the questions

+10 XP

+30 XP

+10 XP

+10 XP

+10 XP

+10 XP