Viruses, Worms, Trojans, Malware
MIT‑Level Study Notes
(Cyber Olympiad – NCO, “Networking, Internet & Cyber Security”)
Table of Contents
| Section | Topics | Key Take‑aways |
|---|---|---|
| 1 | Foundations | Definition, taxonomy, historical evolution |
| 2 | Technical Anatomy | Payload, infection vectors, propagation mechanisms |
| 3 | Formal Models | Formal language of malware, finite‑state machine (FSM) representation |
| 4 | Detection & Mitigation | Honeypots, IDS/IPS, sandboxing, cryptographic integrity checks |
| 5 | Advanced Topics | Polymorphism, metamorphism, code‑obfuscation, code‑reduction, side‑channel attacks |
| 6 | Edge Cases & Counter‑measures | Low‑resource devices, IoT, supply‑chain, zero‑day, polymorphic worms |
| 7 | Challenging Problem | Design & analyze a provably‑secure worm‑preventing protocol |
| 8 | References & Further Reading | Books, papers, standards |
1. Foundations
1.1 Definitions
| Term | Description | Example |
|---|---|---|
| Virus | Self‑replicating code that attaches to legitimate executables or documents; requires user action to spread. | Melissa (1999) |
| Worm | Self‑replicating code that propagates without user interaction over a network. | Blaster (2003) |
| Trojan | Malicious code disguised as benign; does not replicate autonomously. | Zeus banking trojan |
| Malware | Generic term for any malicious software (viruses, worms, trojans, ransomware, spyware, etc.) |
1.2 Historical Evolution
| Decade | Milestone | Impact |
|---|---|---|
| 1980s | Brain (1986) – first virus on MS-DOS | Demonstrated persistence via boot sectors |
| 1990s | ILOVEYOU (2000) – email worm | Showed social‑engineering scalability |
| 2000s | Stuxnet (2010) – state‑level worm | Targeted industrial control systems |
| 2010s | WannaCry (2017) – ransomware worm | Exploited SMB vulnerability |
| 2020s | RustyDuke (2023) – cross‑platform ransomware | Uses code‑obfuscation & APT techniques |
2. Technical Anatomy
2.1 Components of a Malware Payload
- Metastructure – the logic (control flow, data structures).
- Data – encrypted strings, command‑and‑control (C&C) URLs, keys.
- Shellcode – low‑level code for privileged execution.
2.2 Infection Vectors
| Vector | Mechanism | Typical OS/Platform | Counter‑measure |
|---|---|---|---|
| Email attachments | Macro viruses, embedded executables | Windows | Email filtering, macro security |
| Network protocols | SMB, FTP, HTTP exploits | Windows/Linux | Patching, firewalls |
| Drive‑by downloads | Vulnerable browsers, plug‑ins | All | Browser hardening, sandboxing |
| Supply‑chain | Compromised libraries | All | Code signing, build‑time verification |
2.3 Propagation Mechanisms
| Type | Description | Example |
|---|---|---|
| Broadcast | Sends packets to all hosts on a subnet. | MSBlast (2003) |
| Targeted | Uses a list of IPs or a domain‑name enumeration. | Mydoom (2004) |
| Hybrid | Combines broadcast with targeted scanning. | Conficker (2008) |
3. Formal Models
3.1 Malware as a Finite‑State Machine (FSM)
Let M be a malware program.
- States:
S = {s0, s1, …, sn}(e.g., idle, infect, payload, self‑destruct). - Alphabet:
Σ= set of inputs (e.g., file system events, network packets). - Transition function:
δ: S × Σ → S.
Deterministic vs. Non‑Deterministic
- Deterministic: one next state for a given input.
- Non‑Deterministic: multiple possible next states (used in polymorphic code).
Proof Sketch:
- Every malware can be modeled as a Turing machine; an FSM is a restricted Turing machine.
- Since malware typically has bounded memory (RAM), an FSM abstraction is valid.
3.2 Formal Language of Malware
Define language L(M) = { w ∈ Σ* | M accepts w }.
- Acceptance here means execution of a malicious action.
Decidability
- The halting problem implies that detecting any malicious program is undecidable.
- Practical detection relies on approximation (e.g., static analysis, heuristics).
4. Detection & Mitigation
4.1 Signature‑Based Detection
- Hash (
SHA‑256) of known malware binaries. - Pattern matching in code or data sections.
- Limitations: zero‑day, polymorphic, metamorphic malware evade signatures.
4.2 Behavior‑Based Detection
- System calls monitoring (e.g.,
CreateFile,WriteFile). - Anomaly detection (statistical models, machine learning).
- Sandboxing: execution in isolated VM, monitor I/O.
4.3 Cryptographic Integrity
- Code signing: X.509 certificates,
signtool.exe. - Hash‑based integrity checks:
sha256sumagainst known good hash. - Hardware roots of trust: TPM, Secure Enclave.
4.4 Network‑Level Hardening
- IDS/IPS (Snort, Suricata) with malware‑specific signatures.
- Network segmentation: separate DMZ, internal network.
- Rate limiting: prevent rapid worm propagation.
5. Advanced Topics
5.1 Polymorphism & Metamorphism
| Feature | Polymorphic | Metamorphic |
|---|---|---|
| Goal | Evade signature detection | Evade pattern detection |
| Mechanism | Encrypt/decrypt payload with changing keys | Re‑write code, change control flow |