Security Fundamentals · Study Notes

OS & Malware

THE SYSTEM · THE THREAT · THE CONTROL

The operating system is the foundation everything runs on — it manages processes, memory, files, permissions and the network. Malware doesn't defeat the OS; it abuses it, turning the system's own features into a foothold. This page covers how the major operating systems work and protect themselves, the full taxonomy of malware with real-world examples, how an infection actually behaves once it runs, and how it's detected and stopped.

01 Operating systems — the platform

What the OS manages, and why that's the attack surface

Everything malware wants to do — run code, read files, steal credentials, talk to the network — goes through the OS. Understanding what the kernel controls is understanding what an attacker is trying to subvert.

What every OS manages

Processes & threadsMemory (virtual/physical)File systems User & permission modelNetworking stackDrivers & hardwareSecurity controls
OSSecurity model in briefWhy it's targeted
LinuxPOSIX permissions (user/group/other rwx), UID 0 = root, SELinux/AppArmor for MACRuns most servers, cloud and containers — high-value, often internet-facing
WindowsACLs, access tokens, UAC, SIDs; Active Directory for domain identityDominant on desktops/enterprise; the AD estate is the crown jewel
macOSUnix base + SIP, Gatekeeper, TCC, notarisation, sandboxingStrong defaults, but a prime target in high-value / executive attacks
AndroidApp sandboxing, permission prompts, Linux kernel underneathHuge, fragmented install base — data theft and surveillance
Kernel vs user space

Code runs in one of two rings. User space is where normal applications live, isolated from each other. Kernel space has full control of the machine. Malware that reaches the kernel (a rootkit) can hide from everything running above it — which is why kernel integrity (Secure Boot, driver signing, PatchGuard) matters so much.

02 Common OS weaknesses

What malware exploits to get a foothold

Malware needs a way onto the box and a way to run with enough privilege. These are the recurring openings:

  • Unpatched software — known CVEs with public exploits
  • Weak / default credentials — admin:admin still works far too often
  • Misconfiguration — excessive permissions, exposed services
  • End-of-life systems — no patches will ever come
  • Exposed RDP / SMB — remote-admin ports open to the internet
  • Zero-day exploits — no patch exists yet
  • No endpoint defence — nothing watching for execution
  • Over-trusting users — the human is part of the attack surface
The OS isn't the enemy

It's the entry point. Almost every weakness above is a configuration or maintenance gap, not a flaw in the OS design. Patch, harden and monitor, and most malware never gets its first foothold.

03 Types of malware

Different tools, same goal — with the incidents that defined them

"Malware" is a family, not a thing. The categories overlap (modern threats are often blends), but each describes a distinct behaviour. The real-world examples are worth knowing — they're how these ideas show up in practice and in exams.

TypeDefining behaviourReal-world example
VirusAttaches to a file/program; spreads when the host is run by a userILOVEYOU (2000) — VBScript, ~$10bn damage
WormSelf-replicates across networks with no user actionMorris Worm (1988); Conficker (2008)
TrojanPoses as legitimate software; opens a backdoor once runEmotet; Zeus banking trojan
RansomwareEncrypts data and demands payment for the keyWannaCry (2017); Colonial Pipeline / DarkSide (2021)
WiperDestroys data outright — disguised as ransomware but no recovery intendedNotPetya (2017) — ~$10bn global damage
Spyware / KeyloggerCovertly records activity, keystrokes and dataPegasus (NSO Group) — mobile surveillance
Rootkit / BootkitHides malware at OS/firmware level for stealthy persistenceStuxnet (2010) used rootkit components
RAT (Remote Access Trojan)Gives the attacker full interactive remote controlDarkComet; njRAT
Botnet / ZombieEnlists the device into a controlled network for DDoS/spamMirai (2016) — IoT botnet, record DDoS
CryptominerHijacks CPU/GPU to mine cryptocurrency (cryptojacking)Coinhive-style in-browser miners
FilelessLives in memory / abuses legitimate tools; little on diskPowerShell / WMI-based intrusions
Supply-chain & blended threats

Modern attacks rarely fit one box. SolarWinds / SUNBURST (2020) was a trojanised software update (supply-chain) that delivered a stealthy backdoor to thousands of organisations at once — part trojan, part RAT, part espionage platform. Categories are a vocabulary, not a cage.

04 Infection vectors

How malware actually gets in

Phishing & attachments

Malicious links and documents (macro-enabled Office files, ISO/LNK droppers). Still the dominant delivery method by a wide margin.

Drive-by & malvertising

Compromised or malicious websites and ad networks that exploit the browser or trick a download.

Malicious downloads

Cracked software, fake installers and trojanised apps — the user invites it in.

Removable media

Infected USB drives — how Stuxnet crossed into air-gapped networks.

Exploiting exposed services

Attacking known holes in internet-facing software — the worm route (EternalBlue).

Social engineering

Convincing a person to run the payload themselves — the hardest vector to patch.

05 Behaviour & lifecycle

What malware does once it executes — mapped to ATT&CK tactics

Getting in is only the start. A capable threat follows a recognisable sequence — and each stage is a chance to detect and disrupt it.

  1. Infection — the payload reaches the host via a vector above.
  2. Execution (TA0002) — code runs, often abusing a trusted interpreter (PowerShell, wscript, bash).
  3. Persistence (TA0003) — hooks into startup so it survives reboot and logout (see below).
  4. Privilege escalation (TA0004) — gains admin/root for deeper control.
  5. Defence evasion (TA0005) — disables AV, clears logs, hides processes.
  6. Command & control (TA0011) — "phones home" to attacker infrastructure for instructions.
  7. Objective — lateral movement, data theft, encryption, or destruction.
Command & control (C2)

Almost all modern malware beacons out to a C2 server — for new commands, to exfiltrate data, or to receive the ransomware encryption key. This outbound channel is often the easiest thing to detect: unexpected, regular connections to unfamiliar domains or IPs. Cutting C2 can neutralise an infection even before it's fully understood.

06 Persistence mechanisms

TA0003 — how malware survives a reboot

Persistence is where malware hides its "restart me" hooks. Knowing the common locations is exactly how analysts find and remove it.

PlatformMechanismATT&CK ID
WindowsRegistry Run / RunOnce keysT1547.001
WindowsScheduled TasksT1053.005
WindowsNew / hijacked ServicesT1543.003
WindowsWMI event subscriptionT1546.003
Linuxcron jobsT1053.003
Linuxsystemd servicesT1543.002
Linux/macOSShell profile / rc files (.bashrc)T1546.004
macOSLaunch Agents / DaemonsT1543.001 / .004
Investigator's shortcut

Tools like Sysinternals Autoruns enumerate nearly every persistence location on Windows in one view — the fastest way to spot "what runs at boot that shouldn't."

07 Detection & defence

Know the OS · spot the signs · stop the spread

How malware is analysed

Static analysis

Examining the sample without running it — strings, hashes, imports, signatures. Fast and safe, but obfuscation and packing limit it. YARA rules match known patterns at scale.

Dynamic analysis

Detonating it in an isolated sandbox (Cuckoo, Any.run) and watching behaviour — files touched, registry changes, network calls. Reveals what the code actually does.

Defensive controls that matter most

ControlWhat it buys you
Patch managementCloses the known-CVE entry and worm routes
Least privilegeMalware inherits the user's rights — fewer rights, smaller blast radius
Application allow-listingOnly approved binaries run; unknown payloads simply can't execute
EDR / XDRBehavioural detection of execution, persistence and C2 on the endpoint
Backups — the 3-2-1 rule3 copies, 2 media, 1 offline/off-site — the real answer to ransomware
Network monitoringCatches C2 beaconing and exfiltration leaving the network
User awareness trainingShrinks the phishing / social-engineering vector
On ransomware specifically

Paying rarely restores everything and funds the next attack. Tested, offline backups are the only reliable recovery — and the NCSC advises against paying. Prevention (patch, least privilege, segmentation) plus recovery (backups) beats any detection alone.

08 References & further reading

Authoritative sources — go deeper here
  1. MITRE ATT&CK — Persistence (TA0003) & the full tactics matrix — attack.mitre.org
  2. NCSC — Mitigating malware and ransomware attacks — ncsc.gov.uk
  3. VirusTotal & Any.run — sample lookup and sandboxing
  4. YARA documentation — pattern-matching for malware — yara.readthedocs.io
  5. Microsoft Sysinternals (Autoruns, Process Monitor) — learn.microsoft.com
  6. Malpedia — malware family encyclopedia — Fraunhofer FKIE
  7. CISA StopRansomware — cisa.gov