Skip to content
Tutorials Center
My learning

Topics

Lesson 52 of 80 ยท Malware and Endpoint Security

Endpoint Protection and System Hardening

Learn how to harden laptops, servers and phones: patching, EDR and antivirus, application allow-listing, CIS benchmarks, disk encryption and a Python auditor.

An endpoint is any device that connects to your network and runs software: laptops, desktops, servers, phones, virtual machines, even printers and cameras. Endpoints are where people work and where attackers land, so they are the most common place for a breach to start and the place where defenders have the best chance to stop it.

Hardening means reducing what an attacker can use on a machine: remove what is not needed, lock down what remains, keep it updated, and watch it. Protection tools such as antivirus and EDR are one layer; a well-hardened system makes their job easier. In this lesson you'll learn the main hardening measures, what the protection tools do, how benchmarks keep configuration consistent, and how to audit a machine against a checklist in Python. It follows Malware Types and How They Spread and Phishing and Social Engineering.

The idea: shrink the attack surface

Every installed program, open port, running service, enabled account and permission is something an attacker might abuse. Hardening applies a few principles you already know from The CIA Triad and Core Principles: least privilege, defense in depth and secure defaults.

flowchart TD
    A["Reduce<br/>(remove unneeded software,<br/>services, accounts)"] --> B["Configure<br/>(secure settings,<br/>baselines)"]
    B --> C["Protect<br/>(updates, encryption,<br/>EDR, allow-listing)"]
    C --> D["Monitor<br/>(logs, alerts, drift checks)"]
    D --> A

Hardening is a loop, not a one-time project: new software and new threats keep changing the picture.

The core measures

Patching

Most successful attacks use flaws that already have a fix. Turn on automatic updates for the operating system, browsers and common applications, and set a deadline for everything else: for example critical fixes within days, others within a month. Do not forget the things people never think of: firmware, VPN appliances, hypervisors, and libraries inside your own applications. Unsupported software that no longer gets fixes (an end-of-life operating system) must be replaced, isolated or retired. Prioritizing is covered in Vulnerability Management and Patching.

Accounts and privilege

  • Give people standard accounts for daily work. Administrator rights are for administrative tasks, ideally by a separate account.
  • Disable or remove default and unused accounts, and change default passwords at once.
  • Require multi-factor authentication for remote access and for all privileged accounts.
  • On Windows, use a tool such as a local-administrator password manager so each machine has a different admin password. On Linux, use sudo with logging instead of shared root logins.

Software control

Malware that cannot run cannot do harm. Application allow-listing (for example AppLocker or Windows Defender Application Control on Windows, or similar controls on Linux and macOS) permits only approved programs, publishers or hashes to run. It is the most effective single control against unknown malware, but it needs care: start in audit mode, build the list from real usage, and plan an update process. A weaker version blocks execution from user-writable places like Downloads or temporary folders. Also remove software nobody uses, and disable risky features you do not need, such as Office macros from the internet.

Network exposure

Turn on the host firewall with a default of denying inbound connections. Disable services and ports that serve no purpose, such as file sharing on a laptop or Telnet anywhere. Remote desktop and SSH should never be exposed directly to the internet without strong authentication and access restrictions. See VPNs, Wi-Fi and Remote Access Security.

Encryption

Full-disk encryption (BitLocker, FileVault, LUKS) means a lost or stolen laptop is a hardware loss, not a data breach. It needs good key handling: store recovery keys centrally, protect the boot with a TPM, and require a PIN or sign-in. Encrypt phones and removable media too.

Secure boot and firmware

Secure Boot and a TPM check that the boot chain has not been tampered with. Set a firmware password and disable booting from untrusted USB devices on sensitive machines.

Antivirus, EDR and friends

Antivirus (AV) checks files against known signatures and heuristics and blocks known malware. Modern AV also uses reputation and machine learning, but it is still mostly about what a file is.

EDR (endpoint detection and response) watches what a machine does: which processes start, which files change, which network connections open, what is written to the registry or scheduled tasks. It records this telemetry, flags suspicious behavior, and lets analysts investigate and isolate a host remotely. XDR extends the idea across email, identity, cloud and network sources. MDR is a managed service where an outside team watches the alerts for you.

A host-based intrusion prevention system, a host firewall, and mobile device management (MDM), which enforces settings, encryption and remote wipe on phones and laptops, complete the endpoint toolkit.

Nothing here is a replacement for the rest. AV misses new malware, EDR needs people to respond, and allow-listing needs upkeep. Layered together, each catches what another misses. Detection concepts are explored further in Detecting Malicious Behavior.

Baselines and CIS Benchmarks

Writing your own list of hundreds of settings is slow and error-prone. The CIS Benchmarks, published by the Center for Internet Security, are consensus configuration guides for operating systems, browsers, cloud platforms and many applications. Each recommendation says what to set, why, and how to check. Many come in two profiles: Level 1, practical settings that rarely hurt usability, and Level 2, stricter ones for high-security systems. Other well-known baselines include the DISA STIGs and vendor security baselines.

The workflow:

  1. Choose a benchmark for your platform and profile.
  2. Document your approved deviations (every environment has some).
  3. Build the result into an image or configuration management so every new machine starts hardened.
  4. Scan regularly for drift: machines that have moved away from the baseline.

Do not apply hundreds of settings blindly to production. Test them on a pilot group first, because hardening can break software.

A hardening auditor

An audit compares what a system has against what the baseline requires. The script below checks a small invented inventory of machines against a baseline expressed as data. Each rule has a name, a weight, and a test. The output ranks machines by what is missing, which is a realistic start for a remediation list. No real system is queried; the machine data is made up.

Python Audit machines against a baseline

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The weights say which failures to fix first: an exposed remote desktop on an unsupported server is far more urgent than a long screen-lock timeout. The same data-driven design works for real tools, and it is how compliance scanners report: a list of rules, a result for each, and a score.

Controlling what runs

Allow-listing decisions are usually based on a publisher (a trusted code-signing certificate), a path (a protected folder only administrators can write to), or a hash (an exact file). Each has trade-offs: publisher rules survive updates but trust everything that publisher signs; path rules are broken by writable folders; hash rules are exact but break at every update. The sketch below evaluates a few launch attempts against these three rule types. It decides in a fixed order and denies anything not matched, which is the default-deny idea at the center of the approach.

Python A default-deny allow-list decision

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Look at updater.exe: it claims an approved publisher but its signature is invalid, so the publisher rule does not fire, and the path is not protected. The result is a deny. Also notice that the block list is checked first, so a planted file in a trusted folder is still stopped.

Operating it

  • Inventory first. You cannot harden devices you do not know about. Keep an asset list and enroll every device in management.
  • Automate. Configuration management, images and policy engines beat manual changes.
  • Plan for exceptions. Document each approved deviation and when it expires.
  • Protect the protectors. Restrict who can disable EDR, and alert when an agent stops reporting.
  • Test recovery. A hardened machine you cannot rebuild quickly is still a risk; see Backups, Resilience and Business Continuity.
  • Handle BYOD and mobile with MDM and a minimum standard: screen lock, encryption, current OS, remote wipe.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What does EDR do that traditional signature-based antivirus mostly does not?

    EDR collects telemetry about processes, connections and file changes, flags suspicious behavior and supports response actions. Antivirus mostly judges files against known patterns.
  2. 2. Why is application allow-listing hard to bypass with a brand-new malware sample?

    Allow-listing is default deny: a program that nobody has approved does not run, whether or not any scanner recognizes it.
  3. 3. What is the main benefit of full-disk encryption on a laptop?

    Without the key, the contents of the disk are unreadable. It protects data at rest, not a running logged-in system.
  4. 4. Why test a CIS Benchmark on a pilot group before rolling it out everywhere?

    Benchmarks are consensus recommendations, not guarantees for your applications. A pilot finds breakage before it affects everyone.
  5. 5. Which finding should be fixed first on a compliance report?

    An unsupported system that no longer gets fixes and exposes a remote service is an easy, high-impact target. Weighting findings by impact guides the order of work.

Summary

  • Hardening shrinks the attack surface: remove what you do not need, configure the rest securely, keep it updated, and monitor it.
  • Core measures are patching, least privilege and MFA, application control, a host firewall, disk encryption and secure boot.
  • Antivirus judges files, EDR watches behavior, MDM manages mobile devices; none of them replaces the others.
  • CIS Benchmarks and other baselines give consistent settings, but must be tested and monitored for drift.
  • Audit against a baseline with weighted rules to decide what to fix first, and prefer default-deny controls such as allow-listing.

Next: Detecting Malicious Behavior, where you'll learn how defenders recognize an intrusion that gets past prevention.