These are the notes for Cybersecurity Fundamentals (defensive), episode 69. We have secured clouds, containers and clusters. But a huge share of attacks still begin on the devices people touch every day: a laptop opening one email attachment. This episode builds endpoint security step by step: catching malicious programs, letting only approved programs run, keeping hundreds of laptops configured and patched, protecting data when a laptop is stolen, making sure a machine starts only trusted code, and taming admin rights, USB sticks and browsers. Every term is defined the first time it appears; the Glossary collects them.
Scope. Defensive and educational only. Every program is a small toy simulation; the "malware" is a harmless line of text and the customer data is fake. Samples were run on 13 Nov 2026 in the SyntaxPilot compiler (Python 3.13).
What an endpoint is
Real-life example: one Monday morning. Asha opens her laptop, sees an "Invoice overdue" email, opens the attachment, and a hidden program runs. From her laptop the attacker can reach file shares, email and other machines, unless the laptop defends itself.
- Endpoint: any device at the edge of a network that people use or that runs work: laptops, desktops, phones, tablets, and servers.
- Malware (episode 5): malicious software: ransomware, spyware, trojans and more.
- Endpoint security: the controls on each device that prevent, detect and contain attacks, and protect the data on it.
Step 1: catching malicious programs
Demo 1: signature antivirus
# Signature antivirus: block files whose hash is on the list of known malware.
import hashlib
def h(data): return hashlib.sha256(data).hexdigest()[:10]
known_bad = {h(b"FAKE-MALWARE-SAMPLE v1: encrypt files, ask for money")}
files = {
"invoice.pdf": b"Invoice #2231 for 4 laptops",
"update.exe": b"FAKE-MALWARE-SAMPLE v1: encrypt files, ask for money",
"update2.exe": b"FAKE-MALWARE-SAMPLE v1: encrypt files, ask for money!",
}
for name, data in files.items():
verdict = "BLOCKED (known signature)" if h(data) in known_bad else "allowed"
print(f"{name:12} {h(data)} {verdict}")
Output:
invoice.pdf db252c8dd0 allowed
update.exe 78d9aadf41 BLOCKED (known signature)
update2.exe ceb2f102b4 allowed
- Antivirus (AV): software that scans files for malware.
- Signature: a fingerprint of a known malicious file (here, a SHA-256 hash, episode 13) or a known pattern of bytes.
- The weakness: change one byte and the hash changes, so the signature no longer matches. Polymorphic malware (episode 5) rewrites itself to do exactly that.
- Heuristics: rules of thumb that flag suspicious-looking files without an exact match; modern antivirus also uses machine-learning models. Both still look mostly at files.
Demo 2: EDR, watching behaviour
# EDR: record what processes DO on the laptop, and flag suspicious behaviour.
timeline = [ # (time, parent process -> child process, action)
("09:14:02", "outlook > winword", "open invoice.docm"),
("09:14:05", "winword > powershell", "run -EncodedCommand ..."),
("09:14:07", "powershell > update2", "write to AppData"),
("09:14:09", "update2.exe", "rename 4,812 files *.locked"),
]
RULES = [
("office app started a script shell", lambda p, a: p.startswith("winword > powershell")),
("mass file renaming (ransomware?)", lambda p, a: a.startswith("rename") and "," in a),
]
for t, proc, action in timeline:
print(f"{t} {proc:21} {action}")
for name, match in RULES:
if match(proc, action): print(f" ALERT: {name}")
print("response: isolate laptop, kill process tree, keep evidence")
Output:
09:14:02 outlook > winword open invoice.docm
09:14:05 winword > powershell run -EncodedCommand ...
ALERT: office app started a script shell
09:14:07 powershell > update2 write to AppData
09:14:09 update2.exe rename 4,812 files *.locked
ALERT: mass file renaming (ransomware?)
response: isolate laptop, kill process tree, keep evidence
- Process tree: which program started which (parent → child). Office documents starting script shells is a classic sign of a malicious macro.
- PowerShell: Windows' built-in scripting shell;
-EncodedCommandruns a hidden (base64-encoded) script. - EDR (endpoint detection and response): an agent on every endpoint that records activity (processes, files, network, logins), detects suspicious behaviour, and lets defenders investigate and respond remotely: isolate the device from the network, kill a process tree, collect evidence. Trend Micro: EDR "focuses on detecting and responding to threats at individual endpoints."
- Isolate (network containment): cut the device off from everything except the security console, so the attacker can't spread while defenders investigate.
- XDR (extended detection and response): Trend Micro: XDR "expands this capability by unifying threat detection, analysis, and response", pulling in data from email, servers, cloud workloads, networks, firewalls and SIEM. The phishing email, the laptop and a strange login become one incident instead of three alerts.
| Antivirus | EDR | XDR | |
|---|---|---|---|
| Looks at | files | endpoint behaviour | endpoints + email + network + cloud + identity signals |
| Catches unknown malware? | rarely | yes, by behaviour | yes, across sources |
| Response | quarantine a file | isolate device, kill process, investigate | coordinated response across tools |
Step 2: application allowlisting
Demo 3: deny by default
# Application allowlisting: only approved programs may run. Everything else: denied.
import hashlib
def h(data): return hashlib.sha256(data).hexdigest()[:10]
APPROVED = {h(b"word processor 16.0"): "winword.exe",
h(b"browser 131.0"): "browser.exe"}
attempts = {
"winword.exe": b"word processor 16.0",
"browser.exe": b"browser 131.0",
"update2.exe": b"FAKE-MALWARE-SAMPLE v1: encrypt files, ask for money!",
"game_mod.exe": b"never seen before",
}
for name, data in attempts.items():
ok = APPROVED.get(h(data)) == name
print(f"{name:13}", "runs" if ok else "BLOCKED: not on the allowlist")
Output:
winword.exe runs
browser.exe runs
update2.exe BLOCKED: not on the allowlist
game_mod.exe BLOCKED: not on the allowlist
- Application allowlisting: only approved programs may run; everything else is blocked by default. Programs are identified by hash (exact file), publisher signature (signed by a trusted company, episode 16) or path (a protected folder).
- It needs no knowledge of the malware. The cost: every new tool needs approval, so it works best on fixed-purpose machines (billing counters, kiosks, servers) and needs a clear request process elsewhere.
- Denylist vs allowlist (episode 24): antivirus is a denylist (block the known bad); allowlisting blocks everything not known to be good.
Step 3: keeping hundreds of laptops right
Demo 4: a fleet report
# A fleet report: compare every laptop with the hardening baseline.
BASELINE = {"firewall": True, "encrypted": True, "autoupdate": True,
"user_admin": False, "usb": "blocked"}
PATCH_DAYS = 14 # critical patches within 14 days
fleet = {
"asha-laptop": {"firewall": True, "encrypted": True, "autoupdate": True,
"user_admin": False, "usb": "blocked", "patch_age": 3},
"ravi-laptop": {"firewall": False, "encrypted": True, "autoupdate": True,
"user_admin": True, "usb": "blocked", "patch_age": 9},
"front-desk": {"firewall": True, "encrypted": False, "autoupdate": False,
"user_admin": False, "usb": "allowed", "patch_age": 61},
}
for name, dev in fleet.items():
gaps = [k for k, want in BASELINE.items() if dev[k] != want]
if dev["patch_age"] > PATCH_DAYS: gaps.append(f"patches {dev['patch_age']} days old")
print(f"{name:12}", "compliant" if not gaps else "FIX: " + ", ".join(gaps))
Output:
asha-laptop compliant
ravi-laptop FIX: firewall, user_admin
front-desk FIX: encrypted, autoupdate, usb, patches 61 days old
- Hardening: reducing a system's attack surface by turning off what isn't needed and turning on protections (episode 9).
- Hardening baseline: the agreed secure configuration for one type of device (firewall on, disk encrypted, auto-update on, user not admin, USB storage blocked, screen lock...). Often built from the CIS Benchmarks (episode 9).
- Compliance: whether a device matches the baseline. Configuration drift: devices slowly moving away from it.
- Patch: an update that fixes bugs or vulnerabilities. Patch management: the process of tracking, testing and installing patches on time, with deadlines by severity (for example critical within 14 days, as in the toy; set your own policy), and reporting devices that miss them.
- MDM (mobile device management): a central service that enrolls devices, pushes settings and updates, reports compliance, and can lock or wipe a lost device.
- UEM (unified endpoint management): the same idea across laptops, desktops, phones and tablets in one console.
Step 4: when a laptop is stolen
Demo 5: full-disk encryption
# A laptop is stolen. The thief pulls the drive and reads it in another computer.
from hashlib import sha256
DATA = b"customers.xlsx: Priya, phone 98xxxxxx21"
def xts_like(data, key): # toy stand-in for AES-XTS, NOT real crypto
stream = b"".join(sha256(key + bytes([i])).digest() for i in range(4))
return bytes(a ^ b for a, b in zip(data, stream))
plain_disk = DATA
key = sha256(b"key sealed in the TPM, released only to a trusted boot").digest()
encrypted_disk = xts_like(DATA, key)
print("unencrypted drive :", plain_disk.decode())
print("encrypted drive :", encrypted_disk[:16].hex(), "...")
print("owner boots normally ->", xts_like(encrypted_disk, key).decode())
Output:
unencrypted drive : customers.xlsx: Priya, phone 98xxxxxx21
encrypted drive : 5dfd6d2b3806f3d58df7fbdb5d4bb29c ...
owner boots normally -> customers.xlsx: Priya, phone 98xxxxxx21
(The toy cipher is only an illustration, not real cryptography.)
- Data at rest: data stored on a disk, as opposed to data moving over a network.
- Full-disk encryption (FDE): every block of the drive is encrypted; it is unlocked at start-up, so a drive pulled out and read in another computer shows only noise.
- BitLocker (Windows): Microsoft Learn: "a Windows security feature that provides encryption for entire volumes, addressing the threats of data theft or exposure from lost, stolen, or inappropriately decommissioned devices."
- FileVault (macOS): Apple: protects a lost or stolen Mac by "making its contents unreadable without valid credentials", using the AES-XTS data encryption algorithm (AES, episode 11; XTS is a mode designed for disk sectors). On Macs with Apple silicon or the T2 chip, key handling happens in the Secure Enclave.
- LUKS (Linux Unified Key Setup): the standard Linux disk-encryption format; Oracle's documentation: "an encryption specification that implements a platform independent and standard on-disk format". The
cryptsetuputility sets it up. - Recovery key: a long backup key that unlocks the drive if the normal unlock fails (forgotten PIN, hardware change). Escrow it centrally: BitLocker recovery keys can be backed up to Microsoft Entra ID, Active Directory or the Microsoft account; MDM can escrow FileVault keys. Never keep it with the device.
Step 5: trusting the boot
Real-life example: a security guard who checks every person's ID at each door of a building, in order; and a locker (the TPM) that opens only if every check passed.
- Firmware: the low-level software built into the hardware that runs first when you press power.
- UEFI (Unified Extensible Firmware Interface): the modern firmware standard that starts the hardware and loads the bootloader; it replaced the older BIOS.
- Bootloader: the small program that loads the operating system kernel.
- Bootkit (episode 5): malware that hides in the boot process, running before the OS and its defences.
- TPM (Trusted Platform Module): a small security chip that stores keys and records measurements (hashes) of each boot stage. Microsoft Learn: BitLocker "provides maximum protection when used with a Trusted Platform Module", which helps ensure "a device hasn't been tampered with while the system is offline." The TPM releases the disk key only if the measured boot matches what's expected; BitLocker can also require a PIN.
- Measured boot: recording each stage's hash in the TPM so it can be checked.
Demo 6: Secure Boot
# Secure Boot: firmware checks each stage against trusted (db) and revoked (dbx) lists.
from hashlib import sha256
def h(b): return sha256(b).hexdigest()[:8]
db = {h(b"bootloader v2 signed by vendor"), h(b"os kernel 6.8 signed")}
dbx = {h(b"bootloader v1 (known vulnerable)")}
def boot(chain):
for stage, code in chain:
d = h(code)
if d in dbx: return f"STOP at {stage}: revoked ({d})"
if d not in db: return f"STOP at {stage}: untrusted ({d})"
print(f" {stage:10} {d} trusted")
return "boot OK -> TPM releases the disk key"
KERNEL = b"os kernel 6.8 signed"
for loader in (b"bootloader v2 signed by vendor", b"bootloader v2 + bootkit",
b"bootloader v1 (known vulnerable)"):
print(boot([("bootloader", loader), ("kernel", KERNEL)]))
Output:
bootloader 67c15313 trusted
kernel 5e1272c3 trusted
boot OK -> TPM releases the disk key
STOP at bootloader: untrusted (9a548ac5)
STOP at bootloader: revoked (ce1c37b0)
- Secure Boot: Microsoft Learn: "a feature of the Unified Extensible Firmware Interface (UEFI) that verifies all low-level firmware and software components before loading". It checks the signature of each piece of boot software; untrusted components are not loaded, which "can block low-level malware injection or preboot malware attacks".
- db (signature database): holds the trusted signers (public keys, certificates) and hashes.
- dbx (revoked signatures database): holds revoked items "that the OEM identifies as malicious, vulnerable, compromised, or untrusted". "If a hash is in the signature db and the revoked signatures db, the revoked signatures database takes precedence."
- OEM (original equipment manufacturer): the company that made the device.
- Keep Secure Boot on, and keep firmware and the dbx revocation list updated.
Step 6: admin rights, USB sticks and browsers
Demo 7: one local admin password everywhere
# 50 laptops. An attacker steals the local admin password (hash) from ONE of them.
import secrets
laptops = [f"pc-{n:02}" for n in range(1, 51)]
same = {pc: "Company@123" for pc in laptops} # set once, years ago
laps = {pc: secrets.token_urlsafe(12) for pc in laptops} # unique, rotated
def opens(passwords, stolen_from):
stolen = passwords[stolen_from]
return sum(pw == stolen for pw in passwords.values())
print("same admin password everywhere:", opens(same, "pc-07"), "laptops open")
print("LAPS, unique per laptop: ", opens(laps, "pc-07"), "laptop open")
Output:
same admin password everywhere: 50 laptops open
LAPS, unique per laptop: 1 laptop open
- Local administrator account: an admin account that exists on one machine only (used by IT support).
- Password hash (episode 14): what Windows stores instead of the password. Pass-the-hash: using a stolen hash to log in to other machines without ever knowing the password (concept only).
- Lateral movement (episode 4): hopping from one compromised machine to others.
- Windows LAPS (Local Administrator Password Solution): Microsoft Learn: "automatically manages and backs up the password of a local administrator account on your Microsoft Entra-joined or Windows Server Active Directory-joined devices". It notes that local admin accounts "often share the same password across many devices, which bad actors can exploit to move laterally", and lists "protection against pass-the-hash and lateral-traversal attacks" as a benefit. Each device gets a unique password, rotated regularly, retrievable only by authorised admins.
- Local admin removal: people work as standard users; admin rights are granted just in time for a task, approved and logged. Malware running as a standard user can't install drivers or switch off defences as easily.
Removable media control
- Removable media: USB drives, memory cards, external disks. They carry malware in and data out.
- Controls: block USB storage by default; allow only encrypted, company-issued drives; make other drives read-only if needed; disable autorun (programs starting by themselves when media is inserted); log file copies to removable media.
Browser hardening
- Browser hardening: automatic updates (browsers are attacked constantly); an extension allowlist (extensions can read every page you visit); blocking risky downloads and known malicious sites; a company password manager (episode 14) instead of reusing passwords; separate browser profiles for admin work. MDM pushes these settings.
The whole chain
- One changed byte beats signatures → EDR watches behaviour; XDR joins sources.
- Unknown programs run → application allowlisting.
- 300 laptops drift → hardening baselines, patch management, MDM / UEM.
- A stolen drive is read elsewhere → full-disk encryption: BitLocker, FileVault, LUKS.
- Bootkits → UEFI Secure Boot (db, dbx) + TPM.
- The same admin password everywhere → LAPS, no daily admin.
- USB sticks and browsers → removable media control, browser hardening.
Common mistakes (and the fix)
| Mistake | What you see | Why | Fix |
|---|---|---|---|
| antivirus only | update2.exe ceb2f102b4 allowed |
signatures know only old malware | EDR on every endpoint |
| EDR alerts nobody watches | ransomware finishes before anyone looks | no response process | 24x7 triage, automatic isolation rules |
| BitLocker recovery key on a sticky note | the thief has the drive and the key | key stored with the device | escrow keys in Entra ID / AD / MDM |
Company@123 on every laptop |
same admin password everywhere: 50 laptops open |
one stolen hash works everywhere | Windows LAPS: unique, rotated |
| everyone is local admin | malware switches off defences | admin by default | standard users, just-in-time admin |
| patches "when we have time" | patches 61 days old |
no deadlines | patch SLAs by severity, MDM reports |
| Secure Boot turned off "for a driver" | untrusted boot code runs | no boot verification | keep it on; use signed drivers |
| USB storage open | data walks out on a pen drive | no media policy | block by default, allow encrypted company drives |
Mini project: an endpoint health score
Combine the toys into one program. For each laptop (a dictionary of settings), check: EDR agent running, allowlisting mode, baseline items, patch age, disk encryption with an escrowed recovery key, Secure Boot on, TPM present, a unique LAPS-managed admin password, user not admin, USB blocked, browser auto-update on. Print a score out of 12 and the top three fixes per laptop, then the fleet's average.
Practice
1. Add a rule to the EDR toy: Excel starting cmd.exe.
Solution
RULES.append(("spreadsheet started a command shell",
lambda p, a: p.startswith("excel > cmd")))
timeline.append(("09:20:00", "excel > cmd", "run whoami"))
2. Why does allowlisting block update2.exe even though no signature for it exists?
Solution
Allowlisting doesn't look for bad files. It runs only programs whose hash (or signer or path) is approved; update2.exe isn't approved, so it is blocked, whatever it is.
3. Add "screen lock after 5 minutes" to the fleet baseline.
Solution
BASELINE["screen_lock_min"] = 5
fleet["asha-laptop"]["screen_lock_min"] = 5
fleet["ravi-laptop"]["screen_lock_min"] = 30
fleet["front-desk"]["screen_lock_min"] = 5
Ravi's laptop now also reports screen_lock_min.
4. A laptop's bootloader is in both db and dbx. Does it boot?
Solution
No. Microsoft's documentation: if a hash is in both, the revoked signatures database (dbx) takes precedence.
5. Check your own computer: is disk encryption on?
Solution
Windows: search Settings for "BitLocker" or "Device encryption". macOS: look for FileVault in System Settings. Linux: lsblk -f lists the file-system type of each partition; LUKS-encrypted ones show crypto_LUKS. If it is off on a work device, tell your IT team.
6. With LAPS, the attacker still controls pc-07. What else limits the damage?
Solution
EDR isolating pc-07, the user not being admin, network segmentation between laptops (episode 24), and MFA on everything the user can reach (episode 29).
Quick quiz
A: signature antivirus
B: application allowlisting
C: full-disk encryption
D: a stronger Wi-Fi password
Malware is changed by one byte. Which control still stops it from running, without knowing it?
Answer
B. Allowlisting runs only approved programs, so anything not on the list is blocked, known or unknown. A signature needs the exact file; disk encryption protects data at rest; Wi-Fi is unrelated.
Interview questions
- Antivirus vs EDR vs XDR? AV matches files against signatures; EDR records and analyses endpoint behaviour and enables response; XDR correlates detection across endpoints, email, network and cloud.
- What does "isolate the host" mean in EDR? Cutting the device off from the network except the security console, to stop spread during investigation.
- Allowlisting vs blocklisting? Allowlisting runs only approved software (default deny); blocklisting blocks known bad (default allow).
- What is a hardening baseline? The agreed secure configuration for a device type, often based on CIS Benchmarks, enforced and monitored centrally.
- Why is full-disk encryption important for laptops? A lost or stolen device's data is unreadable without the key.
- What does the TPM do for BitLocker? It stores the key and releases it only if the boot measurements show the device wasn't tampered with.
- What is Secure Boot? UEFI verifying the signature of each boot component against db, with revoked items in dbx, so untrusted boot code doesn't run.
- What problem does LAPS solve? Shared local admin passwords enabling lateral movement and pass-the-hash; LAPS sets unique, rotated passwords stored in Entra ID or AD.
- Why remove local admin rights? Malware inherits the user's privileges; standard users limit what it can change.
- What is MDM / UEM? Central management of device enrollment, settings, updates, compliance and remote lock/wipe; UEM covers all device types.
Glossary
| Term | Meaning |
|---|---|
| endpoint | any device people use or that runs work: laptop, desktop, phone, tablet, server |
| malware | malicious software |
| antivirus (AV) | software that scans files for known malware |
| signature | a fingerprint (hash or byte pattern) of known malware |
| polymorphic malware | malware that changes its own code to avoid signatures |
| heuristics | rules of thumb that flag suspicious files without an exact match |
| process tree | the chain of which program started which |
| PowerShell | Windows' built-in scripting shell |
| EDR | endpoint detection and response: records behaviour, detects, enables response |
| isolate (network containment) | cutting a device off from the network except the security console |
| XDR | extended detection and response: detection across endpoints, email, network, cloud |
| application allowlisting | only approved programs may run; deny by default |
| hardening | reducing attack surface and turning on protections |
| hardening baseline | the agreed secure configuration for a device type |
| compliance | whether a device matches the baseline |
| configuration drift | devices slowly moving away from the baseline |
| patch | an update that fixes bugs or vulnerabilities |
| patch management | tracking, testing and installing patches on time |
| MDM | mobile device management: central settings, updates, compliance, lock/wipe |
| UEM | unified endpoint management: MDM across all device types |
| data at rest | data stored on a disk |
| full-disk encryption (FDE) | encrypting every block of a drive |
| BitLocker | Windows full-volume encryption |
| FileVault | macOS full-disk encryption (AES-XTS) |
| AES-XTS | AES in a mode designed for encrypting disk sectors |
| Secure Enclave | Apple's isolated security processor that handles keys |
| LUKS | Linux Unified Key Setup, the standard Linux disk-encryption format |
| cryptsetup | the Linux tool that sets up LUKS |
| recovery key | a backup key that unlocks an encrypted drive |
| key escrow | storing a copy of a key safely with a trusted central service |
| firmware | low-level software built into hardware, runs first |
| UEFI | Unified Extensible Firmware Interface, modern firmware that replaced BIOS |
| bootloader | the program that loads the OS kernel |
| bootkit | malware hidden in the boot process |
| TPM | Trusted Platform Module: a chip that stores keys and boot measurements |
| measured boot | recording each boot stage's hash in the TPM |
| Secure Boot | UEFI verifying each boot component's signature before it runs |
| db / dbx | Secure Boot's trusted / revoked signature databases |
| OEM | the company that made the device |
| local administrator account | an admin account on one machine only |
| pass-the-hash | logging in elsewhere with a stolen password hash (concept) |
| lateral movement | moving from one compromised machine to others |
| Windows LAPS | Local Administrator Password Solution: unique, rotated local admin passwords |
| standard user | an account without admin rights |
| just-in-time admin | admin rights granted only for a task, approved and logged |
| removable media | USB drives, memory cards, external disks |
| autorun | programs starting automatically when media is inserted |
| browser hardening | secure browser settings: updates, extension allowlist, download blocking |
| browser extension | an add-on that can read and change web pages |
| password manager | an app that creates and stores unique passwords |
Summary
- Endpoints are the way in; protect every laptop, phone and server.
- Signatures miss new malware; EDR watches behaviour and responds; XDR joins signals across tools.
- Allowlisting blocks everything not approved.
- Enforce baselines and patch deadlines through MDM / UEM.
- Encrypt every disk (BitLocker, FileVault, LUKS) and escrow recovery keys.
- Keep Secure Boot and the TPM on so only trusted boot code unlocks the disk.
- Unique admin passwords with Windows LAPS, no daily admin, and control USB and browsers.
- Next episode: mobile security basics.
Sources (fetched 13 Nov 2026)
- Trend Micro, EDR vs XDR: https://www.trendmicro.com/en_us/what-is/xdr/edr-vs-xdr.html
- Microsoft Learn, BitLocker overview: https://learn.microsoft.com/en-us/windows/security/operating-system-security/data-protection/bitlocker/
- Apple Platform Deployment, FileVault: https://support.apple.com/guide/deployment/dep82064ec40
- Oracle Linux documentation, Creating encrypted volumes (LUKS, cryptsetup): https://docs.oracle.com/en/operating-systems/oracle-linux/10/stordev/stordev-CreatingEncryptedVolumes.html
- Microsoft Learn, Secure Boot: https://learn.microsoft.com/azure/security/fundamentals/secure-boot
- Microsoft Learn, Windows LAPS overview: https://learn.microsoft.com/en-us/windows-server/identity/laps/laps-overview