Disclaimer: This study guide attempts to touch upon the most important topics that may be covered on the exam but does not claim to necessarily cover everything that one needs to know for the exam. Finally, don’t take the one hour time window in the title literally.
Last update: Sat Nov 21 21:27:00 2026
Week 9-10: Malware
Malware is defined by what the people responsible for a system authorize, not by what a program does. A malware infection passes through a sequence of activities, from how the code first executes to how it spreads. Each activity has its own mechanisms and its own defenses.
What Malware Is
Malware is software deliberately deployed to violate the security interests or authorized policies of the people responsible for a system. Three parts of that definition carry the weight:
-
Authorization comes from the people responsible for the system, who are not always the person at the keyboard. A user who clicks an installer does not authorize it to steal company documents.
-
The difference between malware and a bug is intent. The same file operations can be a reliability problem or the subject of a malware investigation.
-
Malware does not need administrator privileges to do substantial damage, because an ordinary user’s process can already read and write that user’s data.
A potentially unwanted program (PUP) is software whose behavior or installation practices conflict with the user’s expectations or interests: intrusive advertising, unwanted browser changes, or bundled installations with inadequate disclosure. Classifying one depends on what the installer disclosed, what the user authorized, and whether the user can reverse the changes.
Malware Labels
Labels describe independent properties, so a program can have several. Propagation labels describe how a program spreads, payload labels describe what it does, and other labels describe deception or concealment:
-
A virus replicates by inserting its code into a host: an executable, a document with macros, or a boot sector. A program that never inserts itself into another is not a virus.
-
A worm is a self-replicating program that spreads between systems without a host. Not needing a host is the defining difference from a virus; not needing user action is common but not required.
-
A trojan presents itself as desirable or legitimate while performing hidden, unauthorized actions.
-
A backdoor provides an unauthorized way to enter or control a system that bypasses its access controls.
-
A remote access trojan (RAT) is a trojan that carries a backdoor and gives an operator remote control.
-
Ransomware denies access to data or systems and demands payment for restoration.
-
A wiper destroys data or makes it unrecoverable, sometimes behind a ransom demand.
-
Spyware covertly collects information about a person. An infostealer specializes in stored credentials, session tokens, and wallet secrets.
-
A rootkit conceals unauthorized activity by changing what the system or its tools report.
Propagation and persistence are independent. A worm can live in memory and vanish at reboot, while a backdoor that never replicates can stay for years.
Backdoors in Legitimate Code
A backdoor need not be a separate program. An altered login routine, a hidden account, or an added key is a backdoor too. So is a debugging feature left enabled in a production release, whether or not harm was intended.
A backdoor can be planted in a library that other programs load. A compromised compiler can insert a backdoor into the programs it builds, including the next compiler, while both sources stay clean. Source code reviews show what people wrote, not what the tools produced, so they can’t rule out a backdoor inserted during the build.
The Malware Lifecycle
The classic model of a virus has three functions: an infection mechanism that finds and infects the next host, a trigger that decides when an action occurs, and a payload that performs the action.
Modern malware is described with a longer list of activities. The list is a teaching order rather than a sequence every program follows, since malware can omit, repeat, or combine them:
-
Infection: how the malware arrives and first executes.
-
Delivery: a dropper or loader deploys the actual payload, often in stages.
-
Persistence: surviving logouts and reboots.
-
Trigger: the condition under which the payload activates.
-
Communication: contact with an operator for instructions and results.
-
Payload: what the malware does.
-
Propagation: spreading to other systems.
Concealment runs alongside the activities rather than being one of them. Detection is the defender’s view of all of them.
Infection
Malware enters a computer by exploiting a vulnerability in running software, convincing a user to run something, or through physical access, such as a removable drive. Stolen credentials and compromised update channels are further routes that need neither a new exploit nor a user mistake.
Four terms describe the boundaries an attacker crosses:
-
Initial access is the first foothold.
-
Execution is running attacker-chosen instructions.
-
Privilege escalation gains more authority on a machine.
-
Lateral movement uses one machine or account to reach others.
Exploits
An exploit uses a vulnerability to make a system perform an unintended operation. The attacker starts with only the privileges of the compromised process, so escaping a sandbox or controlling the kernel requires further steps. Fixing the vulnerability closes the entry route but doesn’t remove a payload that has already installed itself.
A zero-day vulnerability is a flaw for which no protective patch is available; the developers have had zero days of warning to prepare a fix. The term describes the patch status, not the attack technique or whether it requires user interaction.
An N-day vulnerability has been public for N days, usually because a patch was released. Attackers compare the patched code with the previous version to find the flaw and build an exploit. Machines that have not yet installed the patch are exposed until they do, and most exploitation uses such flaws.
An exposed network service can be both the entry point and the source of attacks on other machines. Each infected host becomes another scanner, so infections grow exponentially at first, faster than people can respond.
Social Engineering
Social engineering manipulates people into revealing information or taking actions that weaken security. It targets the decision that grants authority rather than the mechanism that enforces it. It needs no vulnerability, so it is cheap, and anyone with access can be an entry point.
Attackers rely on a small set of persuasion principles: authority, urgency and scarcity, trust and familiarity, fear, curiosity, reward, helpfulness and reciprocity, and consistency and commitment. The strongest lures combine several. Two related habits help the attacker:
-
Social proof is the tendency to do what others appear to be doing.
-
Security fatigue is the habit of dismissing warnings when every program displays one.
Three forms of attack appear repeatedly:
-
Phishing uses a deceptive message or site that impersonates a trusted source to collect credentials or to start a malware chain.
-
Spear phishing targets a particular person or organization with information chosen to make the request plausible. Large language models have removed the per-target labor that once limited it to a few valuable targets.
-
Pretexting presents an invented situation that justifies the requested action.
Attackers can supply every trust signal a reader relies on: a logo, a deadline, personal details, and even a real conversation history from a compromised account. HTTPS shows only that the connection to the domain in the URL is encrypted, not that the domain belongs to the organization shown on the page.
The mismatches that deserve scrutiny concern the requested action:
-
A web page that tells the visitor to run a command (the ClickFix technique).
-
A document that says a security control must be disabled.
-
A payment, password change, or software installation outside the usual process.
-
A demand for secrecy or urgency.
-
A displayed link or sender that differs from the real one.
Independent verification tests the claim through a channel the message didn’t provide.
Lookalike Domains
A phishing link needs an address that looks right:
-
Typosquatting registers a domain that differs from a real one by a typing or reading error: a substituted, omitted, added, or adjacent-key character, a different top-level domain, or a lookalike character from another alphabet.
-
Combosquatting combines a real brand name with another word, so there is no typo to catch, and registering misspellings in advance cannot cover every combination.
-
Software package registries have the same problem: a mistyped package name installs attacker code with the developer’s permissions.
The defenses act on the address rather than on judgment:
-
Bookmarks rather than search results, which can carry advertisements for impersonation sites.
-
A password manager that offers a saved password only when the address matches.
-
Filtering and monitoring of lookalike domains.
-
For packages, checking the exact name and source.
Phone and Text Attacks
Vishing uses phone calls, giving the attacker a live conversation to answer objections and apply pressure. Caller ID can be spoofed. Smishing uses text messages that imitate familiar notifications, with shortened links that conceal the destination.
A one-time code doesn’t stop a real-time phishing attack. The attacker’s page collects the password and the code and uses them on the real site within the code’s validity period.
A code from an authenticator app is better than a text message because there is no message to intercept, but it doesn’t stop relay attacks because the code doesn’t depend on which site is asking for it. A SIM swap moves the victim’s phone number to the attacker’s phone.
Phishing-resistant authentication is bound to the legitimate site. A passkey signs a challenge that includes the site’s domain, so a lookalike page receives a signature the real site rejects.
A user’s decision to run a program does not have to grant it every permission the user holds. Application control, macro policy, sandboxes, and the Principle of Least Privilege limit what a deceived user’s action can do.
Removable Media and Devices
An air gap separates a system from direct network connections but not from removable storage, maintenance laptops, or imported files, so those transfers become the entry points.
A drive does not execute code merely by storing it. Execution needs a mechanism:
-
A user launching a file.
-
A startup feature such as AutoRun that runs a program named on the medium.
-
An infected boot sector that the machine executes at startup.
-
A vulnerability in the software that displays the drive’s contents.
Defense depends on the mechanism: application control and macro policy for files the user runs, disabling AutoRun, a firmware setting to prevent booting from external media, and patching parser flaws.
A USB drop attack leaves a drive where a target will find it and relies on the finder to connect it and open its contents. People who intend to return a drive still open what it carries, so the controls that limit what an unknown drive may do are stronger than training.
BadUSB alters a device’s firmware so it reports an interface it shouldn’t have, such as a keyboard. Injected keystrokes run with the privileges of the logged-in session, so file scanning, reformatting, and blocking removable storage do not stop it. Device-control policy that restricts which USB interfaces are accepted, and locking unattended workstations, do.
Documents
A macro is a program stored in a document and run by the application that opens it, with all the permissions of the user. A malicious macro needs macro execution enabled, not a vulnerability, which is why Office now blocks macros in files from the Internet by default.
A parsing flaw is the other document attack: malformed content corrupts memory in the application that reads it. The two need different defenses: blocking macros doesn’t fix a parser bug, and fixing parser bugs doesn’t stop an authorized macro. A document can also include a link or QR code to a phishing page and execute nothing.
Drive-by and Zero-click Attacks
A drive-by download delivers software through a visited web page, usually by exploiting the browser, so visiting the page supplies the input that runs the code. A zero-click attack does not need any interaction, because a messaging application parses the attacker’s content when it arrives or generates a preview. Zero-click describes the user interaction required and says nothing about whether the flaw is new.
Trusted Channels
In a supply chain compromise, malicious code arrives through a channel the victim deliberately trusts: a compromised update or a malicious dependency inside a library a legitimate program loads. Code signing protects signed content from later changes, but a compromised build or signing process produces correctly signed malicious code.
A counterfeit utility downloaded from an attacker’s site is a different case. Nothing in the publisher’s channel was compromised; the failed control was the user’s judgment of the source. A stolen administrator account can likewise install software through a legitimate management service that works exactly as designed.
Delivery
Multi-stage delivery divides the work among components. The code that first executes may be small, such as the few bytes an exploit can inject, while the payload needs much more. A small initial component launches a later one, chosen for the target’s platform and replaceable without changing the lure.
Each required download is also a dependency that defenders can interrupt and an event they can observe. A delivery stage is not a stage of an intrusion: a whole chain of downloads may accomplish only execution.
The components have standard names:
-
A dropper contains the next payload and places it on the target, so delivery works without a network connection.
-
A downloader retrieves the next component from the network, so the first file stays small, and the operator can change what it fetches.
-
A loader prepares and starts another component, possibly decoding it in memory without writing an executable file.
-
Process injection places code inside another running process and makes that process execute it.
-
Process hollowing starts a legitimate program suspended, replaces its code in memory, and resumes it. The process keeps a legitimate name and an unchanged signed file on disk. A signature authenticates the file, not the code later placed in the process.
-
A packer compresses or encrypts an executable and attaches code that restores it at runtime, so a file scanner sees only transformed data. The unpacked program can be inspected in memory.
Fileless malware is execution that does not depend on a payload executable stored on disk. Memory is volatile, so persistence still needs something stored that reloads the code. Living off the land uses programs already present on the system, such as an administration scripting environment. A valid signature on an interpreter authenticates the interpreter, not the script it is given.
The attacker-supplied scripts and loader in a chain are malware even when they do not steal anything themselves, because each exists to run code the user did not authorize. The legitimate utilities they run are not.
Persistence
Persistence allows malicious code to resume execution after logout, process termination, or reboot. Every mechanism is a stored program or setting plus an event that triggers it. Malware can register itself at three layers, which run at different points in startup:
-
Registration points the operating system and applications already provide: services, login items, scheduled tasks, shell profile files, document templates, and library loading.
-
The boot code that runs before the operating system.
-
The firmware that runs before the boot code.
A registered program’s privileges come from the account configured for it. Who can install persistence depends on who may write the registration point: a service’s configuration needs administrative access to change, while a login item or profile file can be written by its user.
In library hijacking, a program loads a library by name, and the attacker places a malicious library with that name where the program looks first.
Cleaning a machine requires removing both the running program and the settings that would start it again.
Boot Code and Firmware
At power-on, a PC runs firmware, which initializes the hardware and starts a boot loader, which loads the kernel and transfers control to it. Code that runs earlier controls what runs later. Anything before the kernel runs before the kernel’s protections and before security software.
Three kinds of malware use that position:
-
A boot sector virus replaces the small program a PC executes from a disk at startup and then infects other disks.
-
A bootkit modifies the boot process to gain early execution; its files sit on the disk partition used for startup.
-
A firmware implant modifies firmware storage itself and survives a disk replacement.
Early execution lets a bootkit modify later code in memory even when that code has a valid signature on disk. Installing it still requires authority to modify the startup components or a vulnerability that permits it.
Secure Boot verifies each boot component against an authorization policy before letting it run. The firmware holds trusted public keys and a revocation list, and each stage checks the next. A signature proves who signed the code, not that the code is safe: an old signed boot loader with a known flaw still passes unless it has been revoked, so fixing a boot-code vulnerability also requires revocation.
Rootkits
A rootkit conceals unauthorized activity or access by altering system programs, libraries, or the kernel:
-
A user-mode rootkit replaces programs or libraries outside the kernel. A modified listing utility omits a file, or library interposition substitutes a function through a mechanism such as a preloaded library. The kernel still holds the true information, so a trusted copy of the tool exposes the discrepancy.
-
A kernel-mode rootkit changes the operating system itself, usually through a driver, and filters what every utility receives. Unmodified tools all show the same incomplete listing, and security software that trusts the kernel is fed false data.
A rootkit is found by looking somewhere it hasn’t changed. For a kernel rootkit there are two approaches:
-
Offline inspection from trusted recovery media examines the disk without starting the installed kernel.
-
Cross-view detection runs on the live system and compares what the kernel’s interfaces report with lower-level reads of the disk and registry structures. A kernel rootkit can interfere with those reads too, so matching results do not prove the system is clean.
Driver signing restricts what can load into the kernel but does not prove a driver is harmless, since code-signing private keys can be compromised and signed drivers can have vulnerabilities.
Triggers
A trigger is the condition under which the payload activates: a date, a count, a user action, or the presence of a particular target. A logic bomb is malicious code that stays dormant until a specified condition occurs, usually planted by someone who already has access. Not every payload waits: an infostealer runs at startup, and a worm’s replication is itself the harm.
Communication
Command and control (C2) is the exchange through which an operator directs compromised systems and receives results. Exfiltration is the unauthorized transfer of collected information out of the environment. Fully autonomous malware does not require command and control.
A botnet is a collection of compromised machines, called bots or zombies, that one operator directs at once; it can be rented out for different jobs. In a centralized botnet, bots contact control servers. In a peer-to-peer botnet, bots relay commands to one another, so there is no single server for defenders to seize.
Hiding the traffic relies on what the network already permits:
-
An outbound HTTPS connection is allowed almost everywhere, and TLS hides the content from the network. Blocking inbound connections does not stop a machine that calls out.
-
An account on a legitimate cloud service can carry instructions and stolen files, and blocking the service would also disrupt employees who use it.
-
DNS tunneling embeds data in DNS queries and replies. The queried name carries data out, the reply record carries data in, and the organization’s own resolver relays both to a domain the attacker controls. Lookups are allowed everywhere and are so common that extra ones do not look unusual.
Malware also needs to find its operator again after a server is blocked:
-
A dead-drop resolver is a public page or account that publishes the current controller address.
-
A domain generation algorithm (DGA) lets malware and operator compute the same sequence of candidate domains, of which the operator registers a few. Recovering the algorithm lets defenders predict and block them.
Encryption hides the content of a connection but not its existence. Network monitoring still records timing, volume, and destination, and monitoring on the machine can identify the originating process. Beaconing is the repeated check-in that announces availability, and its regularity can expose it.
Sinkholing redirects traffic for malicious infrastructure to a defender’s server. It interrupts contact and identifies victims but doesn’t remove malware or invalidate stolen passwords.
Payloads
An infostealer collects browser passwords, session tokens, wallet secrets, and documents. A session token lets a site recognize a user who has already logged in, so a copied token reuses the session without the password or second factor. Multifactor authentication protects login, not the session afterward, and removing the infostealer doesn’t recall what was copied.
Ransomware encrypts files with a symmetric key, encrypts that key with the attacker’s public key, and discards the unencrypted copy. Recovery requires the attacker’s private key, which was never on the victim’s machine, and the malware needs no connection to the attacker while it runs. Double extortion copies documents before encrypting them and threatens publication, which a backup cannot undo. A wiper discards what recovery would require, whatever its screen says.
Other payloads provide remote control through a backdoor or RAT, consume resources through cryptocurrency mining or spam, flood a target in a distributed denial-of-service (DDoS) attack from a botnet, or sabotage industrial equipment while showing its operators normal readings.
Propagation
A worm searches for reachable systems and makes them execute a copy of itself; each copy then repeats the process independently. Replication alone can be the damage. Blocking propagation protects uninfected machines but leaves the payload active on infected ones.
Detection
A malware signature is a pattern used to recognize known malicious code, usually a sequence of bytes that an analyst chose because it occurs in the malware and is unlikely to occur in legitimate programs. A pattern from a part that variants share matches the whole family.
A hash of the whole file is the simplest signature but matches only one exact copy, and changing one byte defeats it. A malware signature is unrelated to a digital signature.
Static analysis examines a program without running it. A heuristic flags a program by suspicious features without a match to a known sample, which is how previously unseen malware and new variants are caught:
-
A static heuristic judges the file’s structure and instructions. Most anti-malware products combine signature matching with static heuristics, since both run before execution.
-
A dynamic heuristic judges a program by what it does while running, which a mutated program cannot change. Behavioral detection tends to produce more false positives because legitimate programs often perform the same actions.
Attackers evade static detection by changing the bytes:
-
Packing hides the payload’s instructions until the program runs, but the unpacker can be recognized, and the unpacked body appears in memory.
-
Polymorphic malware keeps one body and encrypts it with a new key and a new decryption routine in each copy. The body in memory is identical every time, so a memory scanner can match it.
-
Metamorphic malware rewrites its own instructions into equivalent forms for each copy, so even the running program does not have a fixed body to match. Detection relies on heuristics about the code’s features or its behavior.
Behavioral detection evaluates actions during execution: file access, process creation, memory changes, configuration changes, and network connections. A sequence of events is stronger evidence than any one action. An endpoint detection and response (EDR) system records and correlates those events so the chain from download to script to connection can be reconstructed later.
Behavioral rules make mistakes in both directions. A false positive flags legitimate activity, and a false negative misses malicious activity, so the policy needs context about which actions are authorized.
An analysis sandbox runs a suspicious program in an isolated environment and records what it does. It is a tool for vendors and security teams rather than users. A clean run proves little: the malware may detect the sandbox, wait for user activity, or delay past the observation window.
Code that exists only in memory does not have a file to scan, but it runs in a process, something loaded it, and it usually communicates, so defenders inspect memory, the loader, and network activity. An interpreter can hand its decoded script to security software before running it. A kernel rootkit can alter reports or disable the monitor, but an independent network record still shows that a connection happened.
Reputation-based detection uses prior observations of a file, publisher, address, or domain, and telemetry from many machines exposes rare relationships invisible from one. A rare file isn’t malicious by itself, and a familiar publisher doesn’t authorize every use of its programs.
The detector belongs to the trusted computing base: it runs with broad privileges and parses hostile input, and a compromised monitor can corrupt the evidence administrators rely on.
What You Don’t Need to Study
These exclusions apply to the malware material. Network attacks and defenses in general, web security, steganography and covert channels, and AI security are not part of this material; we will cover those topics later. The malware-related network concepts covered here remain in scope: command and control, DNS tunneling, botnets, and DDoS as a payload.
The following are not required for the exam:
-
Incident names, dates, and figures, including the Lumma, Morris worm, XZ Utils, Code Red, Slammer, Melissa, Concept, Emotet, Stuxnet, NotPetya, WannaCry, BlackLotus, Sony BMG, Mirai, Conficker, QakBot, Pegasus, and UBS cases, and the USB drop and AI spear-phishing studies. Know the mechanism each one illustrated: a worm that spreads through exposed services, a macro that mails itself, a backdoor planted in a library through a build script, a bootkit that passes Secure Boot with old signed code, a rootkit that hides anything matching its naming rule, ransomware that spreads as a worm, a wiper behind a ransom note, and a botnet built from devices with default passwords.
-
Which company or agency found, named, disrupted, or prosecuted anything, and the names of vendor tools and interfaces.
-
The specific registry keys, file names, directory names, and startup mechanisms of Windows, Linux, and macOS. Know the three layers of persistence, that every mechanism is a stored program or setting plus a triggering event, that a registered program’s privileges come from its configured account, and that installing persistence requires permission to write the registration point.
-
The history of Office macro settings, PDF launch actions, AutoRun’s version history, UEFI’s relationship to the BIOS, or when Secure Boot became required. Know what each mechanism does.
-
Measured boot, the Trusted Platform Module, and remote attestation. Know what Secure Boot establishes and what it does not.
-
Malware on mobile devices, including app permissions, accessibility services, and the Pegasus exploit chain.
-
The internals of process hollowing or the loader’s rules for preloaded libraries.
-
The format of DNS tunnel queries, DNS record types, and TXT record details beyond the idea that names carry data out and replies carry data in.
-
Exact phishing message features, the hotel campaign’s lures, the lookalike domain examples, the remote-worker vishing campaign, the toll-text campaign, or the package-registry incident. Know the mismatches that deserve scrutiny and why independent verification works.
-
The names of the psychologists whose work the principles of persuasion come from, or the figures from the combosquatting study. Know the principles and why combining them works.
-
The economics of access brokers, botnet rental prices, or the Computer Fraud and Abuse Act.
Week 10-11: Network security & DDoS
The protocols that move data across the Internet were designed without authentication. A router believes what its neighbors announce. A host believes a reply that says which hardware address belongs to an IP address. A name server’s response is believed because it arrived. Replacing the protocols is impractical, so defenses add checks around them. Every attack in this material exploits an unauthenticated claim, unsafe default, or resource that runs out.
How a Packet Reaches Its Destination (Background Info)
A MAC address identifies a network interface on its local network. Software can change it, so it isn’t a reliable identifier. An IP address identifies a host across networks. Addresses are allocated in blocks called prefixes: 128.6.0.0/16 means the first 16 bits identify the network. Private addresses such as 192.168.1.1 are never routed across the Internet.
A local network is a set of devices that can send frames directly to one another through a switch or access point. A switch learns which MAC address is on each port from the source addresses of arriving frames. It forwards a frame only to the port connected to its destination. A router connects a local network to other networks. A host sends packets for other networks to its default gateway.
A host that joins a network obtains its IP address, gateway, and DNS server from any server that responds to its DHCP broadcast. Nothing in the exchange proves the server was authorized. To send to a host on the same network, it obtains that host’s MAC address with ARP: it broadcasts a request and caches whichever reply arrives.
Network software is organized in four layers, each adding its own header:
-
The link layer moves frames on one local network. MAC addresses belong here.
-
The network layer moves IP packets between hosts across networks. Routers operate here.
-
The transport layer delivers data to the right program, identified by a port number, over TCP or UDP.
-
The application layer is HTTP, DNS, and TLS, which runs between TCP and the application.
TCP gives two programs a reliable, ordered stream of bytes over a connection. It numbers every byte with a sequence number so the receiver can order data and acknowledge what arrived. UDP sends individual messages with none of those mechanisms. The Domain Name System translates names into addresses. A host sends its query to a resolver, which asks a chain of servers until it reaches one that is authoritative for the domain.
Loading a web page uses all of these in order:
-
DHCP to get the network laptop’s configuration.
-
ARP to find the router’s MAC address from its IP address.
-
DNS to get the server’s IP address from its name.
-
Routes exchanged with BGP for the path between networks.
-
A TCP handshake to set up the connection between the two programs.
-
A TLS handshake to authenticate the server and set up an encrypted channel.
-
An HTTP request to get the web page content.
Each step relies on a message the recipient cannot verify, and each is an attack target. Only the TLS handshake includes authentication. It protects the contents of the exchange and the server’s identity, but not against packets being redirected, delayed, or dropped.
Why the Protocols Lack Authentication
The end-to-end principle holds that application-specific functions such as reliability, security, and error recovery belong in the communicating hosts rather than inside the core of the network. Only the endpoints can tell whether a function was performed correctly for the application, so a check inside the network doesn’t remove the need for one at the ends. A function built into the network also imposes its overhead on every application, including those that don’t need it. IP therefore doesn’t guarantee delivery or ordering. TCP at the endpoints provides those guarantees for the applications that want them, and TLS at the endpoints provides security.
ARP, DNS, and BGP were designed for a much smaller Internet and don’t include cryptographic authentication. A message that looks like what a protocol expects is still usually trusted.
Attacks on the Local Network
Most of these attacks require the attacker to be on the victim’s local network, which can mean:
-
An open Wi-Fi network.
-
A compromised machine inside an organization.
-
A device plugged into an unused jack.
From that position, the attacker exploits the assumption that every device on the local network is telling the truth.
CAM Table Overflow
A switch keeps its table of MAC addresses and ports in content-addressable memory (CAM), memory that is searched by content: the switch presents a destination address and gets back the port in one step. CAM is expensive, so the table is small. The vulnerability is that a switch learns addresses from any frame it receives, and the CAM table has a fixed size. The attacker floods the switch with frames from invented source MAC addresses until the table is full. The switch then copies frames for unknown destinations to every port, so the attacker can read unencrypted traffic among the others.
The defense is port security on a managed switch, a switch an administrator can configure. It limits how many MAC addresses, or which ones, may appear on each port.
ARP Cache Poisoning
The vulnerability is that ARP does not authenticate replies. Hosts update their caches on replies they never asked for. The attack takes three steps:
-
The attacker sends the victim a forged reply mapping the router’s IP address to the attacker’s MAC address.
-
The attacker sends the router a forged reply for the victim’s address.
-
The attacker forwards everything in between, so the victim doesn’t notice.
The attacker can read unencrypted data, modify unauthenticated data, and drop or delay anything. A validated TLS session protects its contents but not its availability.
The defense is Dynamic ARP Inspection on a managed switch, which drops ARP replies that do not match the address bindings the switch learned from DHCP traffic. IPv6 replaced ARP with the Neighbor Discovery Protocol, which trusts local messages the same way. The attack and the defense are the same.
DHCP Spoofing and Starvation
The vulnerability is that a DHCP client cannot tell an authorized server from any machine that responds first. The attacker runs a rogue DHCP server that can hand out two kinds of false configuration:
-
A false default gateway, which gives the attacker the ARP-poisoning position with one exchange.
-
A false DNS server, which lets the attacker decide what every name resolves to.
In DHCP starvation, the attacker requests addresses for thousands of invented MAC addresses until the real server has none left, so new devices cannot join.
The defense against spoofing is DHCP snooping on a managed switch. The administrator marks the ports that lead to the real DHCP server as trusted, and the switch drops DHCP server replies that arrive on any other port. Snooping does not stop starvation. Port security and a limit on the rate of DHCP requests per port do.
VLAN Hopping
Organizations divide a physical network into virtual LANs (VLANs), separate logical networks on shared switches. Frames between switches travel over a trunk with a tag naming their VLAN. Traffic between VLANs must pass through a router or firewall.
The vulnerability is a switch configuration that lets an end device act like another switch. In switch spoofing, the attacker’s machine negotiates a trunk link with a switch that allows automatic trunk negotiation, and the switch forwards other VLANs to it. Double tagging exploits the trunk’s untagged native VLAN to inject a frame into another VLAN.
The defenses are:
-
Disable trunk negotiation on ports connected to end devices.
-
Configure trunks manually.
-
Keep unused ports in an isolated VLAN.
The Evil Twin
The vulnerability is that a Wi-Fi network name doesn’t prove anything, and on an open network there’s nothing else to check. The attacker runs an access point that broadcasts the name of a legitimate network. A victim who connects gets the attacker’s DHCP and DNS servers, which gives the attacker the same redirection as ARP poisoning. TLS protects validated sessions, but a fake login page on the attacker’s equipment collects whatever the user types.
The defense is a password-protected network, which stops an attacker who does not know the password. Enterprise Wi-Fi authenticates the network to the client, but only if the client validates the authentication server’s certificate.
The protocols in this section don’t authenticate anything, so the switch is configured to verify what they do not. Transport-layer encryption limits what an attacker who gets past those controls can do with the traffic.
Forging Source Addresses
An on-path attacker is somewhere the victim’s packets pass through and can see and alter them. An off-path attacker is anywhere else on the Internet. It can send packets but cannot see the victim’s, so it has to guess anything it needs to know.
IP spoofing is writing a false source address into a packet. The vulnerability is that routers forward on the destination address and most do not check the source, so the packet is delivered with the false address. Replies go to the forged address, not to the attacker. A spoofed packet therefore cannot by itself complete a login or hold a conversation. That limit is why blind TCP attacks have to guess. It is also what makes spoofing useful for reflection attacks, where the attacker wants a server’s reply to go to someone else.
The defense is ingress filtering: each network drops packets leaving it whose source address does not belong to it. Deployment is voluntary and uneven. An attacker needs only one network that forwards spoofed packets.
Routing Between Networks: BGP Attacks
The Internet is a network of networks. Each autonomous system (AS) is a set of prefixes and routers under one administration, and each has a unique number. Autonomous systems exchange routes with BGP. An AS announces each prefix it owns to its neighbors. A neighbor that accepts the route adds its own number to the front and announces it in turn, so an announcement contains the AS path it has traveled. Each AS decides by policy which routes to accept and pass on. Participation requires a BGP session with a neighbor, so an attack requires one of:
-
A customer connection to a provider that does not filter announcements.
-
A compromised router.
-
Control of an AS.
A router picks the most specific prefix that matches a destination. A route to a /24 beats a route to the /22 containing it, regardless of path length or who announced it. Among routes to the same prefix, the router applies its policy and then prefers the shortest AS path.
BGP Hijacking
A BGP hijack is an unauthorized announcement of someone else’s addresses. The vulnerability is that BGP does not verify that an AS is authorized to announce a prefix or that the AS path is real. A router that doesn’t filter its neighbors’ announcements passes on what it receives. Announcing exactly the victim’s prefix wins only where the hijacker’s path is shorter. Announcing a more specific prefix wins everywhere the announcement is accepted.
Once traffic arrives, the hijacker can do three things with it:
-
Drop it, which is denial of service.
-
Inspect and forward it, which is an adversary-in-the-middle position at the scale of a network. Encrypted traffic passes through unread.
-
Respond to it with an impostor server.
A route leak is an AS passing on routes it learned from one neighbor to another that should not have received them, usually by mistake. Traffic then flows through a network never meant to transport it.
A hijack combined with forged DNS responses defeats everything except certificate validation. A hijacker who also obtains a certificate for the hijacked name defeats that too, which is possible because certificate authorities verify domain ownership by connecting to the domain’s addresses.
Defending Routing
Prefix filters on each neighbor connection list the prefixes a customer may announce and reject anything else. They stop most accidental hijacks at the first hop. Monitoring services alert a prefix owner when someone else announces its addresses.
The Resource Public Key Infrastructure (RPKI) adds signed statements of who may announce a prefix. The registries that allocate address blocks act as certificate authorities. A block’s holder signs a Route Origin Authorization (ROA), which says that one AS may announce a prefix and may not announce anything more specific than a given length.
A router that validates routes compares each announcement with the published ROAs. The check has three outcomes:
-
A route passes when a covering ROA authorizes its claimed origin AS and prefix length.
-
A route is marked invalid when ROAs cover the prefix and none authorize the announcement.
-
A route with no covering ROA remains unverified.
The operator’s routing policy determines which routes to accept or drop. Three conditions have to hold for this to stop a hijack:
-
The holder has published an ROA.
-
No covering ROA authorizes the announcement.
-
The receiving network drops routes marked invalid.
Origin validation checks only the claimed origin AS, which the announcer writes. A hijacker who forges a path ending in the legitimate origin AS, and announces a length the ROA allows, passes validation. Stopping that requires verifying the path itself. BGPsec has each AS sign the announcement as it forwards it. It requires every AS on the path to participate, and it is almost entirely undeployed. Path verification is still rare.
Routers as Targets
A router is a computer, and its vulnerabilities are those of any exposed computer:
-
A factory-default password, which is published.
-
A management interface exposed to the Internet.
-
Missing firmware updates.
Compromising a router gives an on-path position for everything that passes through it. The attacker can redirect, delay, or drop traffic and read anything unencrypted, but cannot decrypt a TLS session. The defenses are:
-
Change default credentials.
-
Keep the management interface off the Internet.
-
Apply firmware updates.
Transport Layer Attacks
The transport layer’s identifiers are the addresses and ports in each packet and, for TCP, the sequence numbers. The vulnerability shared by the attacks in this section is that an attacker who knows or can guess those numbers can inject segments the receiver accepts. Injection does not defeat TLS, because the attacker cannot produce the authentication code that TLS attaches to its data. Password login alone doesn’t provide that protection.
A TCP connection begins with a three-way handshake:
-
The client sends a SYN with a random initial sequence number.
-
The server replies with a SYN-ACK that acknowledges it and supplies its own.
-
The client sends an ACK.
Each side maintains a receive window and discards a segment whose sequence number falls outside it. Sequence numbers were designed to order data, not to authenticate it.
Sequence Number Prediction
The attack lets an off-path attacker complete a handshake while claiming to be another host. It requires two vulnerabilities: a server that trusts clients by address, and initial sequence numbers that are predictable. The attack takes three steps:
-
The attacker opens a connection to learn the server’s current sequence number.
-
The attacker forges a SYN from the trusted host and never sees the SYN-ACK.
-
The attacker sends a correctly guessed ACK followed by a command.
The defense computes each initial sequence number from a secret combined with the connection’s addresses and ports, so numbers cannot be predicted from one connection to another. An on-path attacker can still read the real numbers, so services no longer trust a client by its address.
SYN Flooding
A SYN flood fills a server’s table of pending connections. The vulnerability is an imbalance in the handshake. Each SYN makes the server allocate memory and wait for an ACK that never comes. The sender spends one packet, usually with a forged source address.
The defense is SYN cookies, which remove the allocation. The server encodes what it needs in the sequence number of its SYN-ACK. It allocates the connection only when a matching ACK arrives. A cookie proves only that the client can receive packets at the address it claims. It protects the pending-connection table, not bandwidth or processing.
Forged Resets
A forged TCP reset terminates a connection. The vulnerability is that a segment with the RST flag tells the receiver to abandon the connection, and the receiver cannot tell a forged one from a real one. An on-path attacker has everything needed. An off-path attacker must guess a sequence number.
The defense against the off-path attacker is the rule that a receiver accepts an RST only if its number exactly matches the next expected one, which makes blind guessing impractical. TLS doesn’t help against either attacker, because encryption protects a connection’s content, not its availability.
UDP
UDP has no handshake, sequence numbers, or connection state. The vulnerability is that a UDP service that responds to any request will respond to a forged one. If the reply is larger than the request, the attacker has amplified the traffic.
A UDP application can add its own checks, such as a token the client must echo before the server does any real work. Networks use ingress filtering and rate-limit replies.
DNS
A domain name is read from right to left. The namespace is divided into zones, each served by its own servers. A zone’s servers know where to find the servers for any part that has been delegated. Three kinds of servers make up the hierarchy:
-
The root servers know the servers for each top-level domain.
-
The top-level domain servers know the authoritative name servers for each domain beneath them.
-
The authoritative servers hold the domain’s records.
A domain is created by registering it with a registrar, which tells the top-level domain which name servers are authoritative for it. A host sends its query to a recursive resolver, which performs the full lookup on its behalf and caches everything it learns. Each record has a time to live that says how long a resolver may cache it. Caching speeds up DNS. It also lets a forged record persist until its TTL expires.
Three record types come up in the attacks:
-
An A record maps a name to an address.
-
An NS record identifies a zone’s authoritative servers.
-
An MX record identifies the servers that accept the domain’s email.
A query is a UDP message carrying the name, record type, and a 16-bit transaction ID. A resolver accepts a reply that comes from the server’s address to the port the query was sent from, repeats the transaction ID, and asks about the same name and type. Those fields match replies to queries. They are not authentication. The query and reply both travel in the clear.
Pharming
Pharming sends a user who typed the correct name to a server the attacker runs. The vulnerability is that a host asks whatever name server it was configured to ask. Each place that configuration can be changed needs a different kind of access:
-
The hosts file on the victim’s machine, which overrides DNS for a name and needs the ability to write files.
-
The host’s resolver setting, which needs code running on the machine.
-
The home router, which needs its administrative password and redirects every device on the network through DHCP.
-
The local network, through a rogue DHCP server or an evil twin.
-
The domain’s registrar account, which needs the owner’s credentials and redirects every resolver in the world.
The defenses follow the access points:
-
Endpoint protection for the hosts file and the resolver setting.
-
The router’s password and firmware.
-
The switch controls for the local network.
-
Strong authentication and a registry lock for the registrar account. A registry lock prevents the registry from changing a domain’s name servers without confirmation from the owner through a separate channel. TLS limits all of these, because the attacker’s server doesn’t have a certificate for the name the user typed. A registrar-level hijack can defeat that, since certificate authorities verify domain ownership through DNS.
Cache Poisoning
Cache poisoning plants a forged record in a resolver, so that every client of that resolver is affected for as long as the record stays cached. The vulnerability is that a resolver accepts any reply that matches the fields it can see. An off-path attacker beats the real reply:
-
The attacker triggers a lookup at the resolver.
-
The attacker floods the resolver with forged replies that use the authoritative server’s source address and different guesses at the fields the resolver checks.
-
If a matching forgery arrives before the real reply, the resolver caches it.
In early resolvers, the only unpredictable field was the transaction ID, and the cache was the obstacle, since a resolver with a cached record stopped asking until the TTL expired. The Kaminsky attack bypasses the cache by querying non-existent names, each a fresh chance to win. The forged reply is a referral that names a server at the attacker’s address as authoritative for the domain. The resolver caches that, so one forged reply that arrives first poisons the whole domain.
The defense is source port randomization. Each query is sent from a random port, so the attacker must guess both the port and the transaction ID. That raises the possibilities from about 65,000 to several billion. It defends only against a blind attacker. An attacker on the path between the resolver and the authoritative server sees everything and doesn’t need to guess. Against that attacker, only a signed reply helps.
DNSSEC
DNSSEC is the defense that signs the data. A resolver can verify that a record was published by the zone’s administrator and not modified. It does not encrypt anything, and it doesn’t say who sent a reply.
A zone’s administrator signs each set of records and publishes the signatures with the zone’s public key. The parent zone authenticates the key by publishing a signed hash of it, and so on up to the root. The root’s key is the trust anchor that ships with the resolver.
A validating resolver handles a reply in one of three ways:
-
A signed response that verifies through the chain is accepted.
-
An unsigned zone is accepted as it always was.
-
A reply from a signed zone whose signatures are missing, expired, or wrong is bogus and is rejected.
The client then gets an error rather than a forged address, which stops cache poisoning for signed zones and means a signing mistake makes the domain unreachable.
Validation usually happens at the resolver, not on the user’s machine, so the resolver’s reply to the host is an ordinary unsigned message that an attacker on that hop can forge. DNSSEC also authenticates whatever a zone’s owner published, so a malicious domain can sign its own records.
Adoption is low because a signing mistake takes the domain offline for every validating resolver, and the owner who signs bears that risk while the benefit reaches only users whose resolvers validate.
DNS Rebinding
DNS rebinding lets a script on a web page send requests to devices on the victim’s private network, such as a home router or a development server. The vulnerability is in the browser’s same-origin policy, which keeps a script from reading responses from other sites. The policy compares hostnames, not addresses. The attack uses that rule:
-
The attacker’s name server returns the attacker’s web server with a very short TTL, and the page loads with its script.
-
When the page’s script requests the same name again, the name server returns a private address.
-
The request is to the same origin, so the script may read the reply. It is now talking to a device that accepts unauthenticated requests from inside the network.
The durable defense is on the local service: require authentication and check the Host header. Resolvers can refuse to return private addresses for public names. Browsers have begun asking permission before a public page may reach a private address.
Abandoned Delegations
The vulnerability is a lame delegation: a domain’s NS records point to a DNS hosting provider where the zone no longer exists. If the provider lets a new customer claim any zone without verifying ownership, an attacker can create the zone there and respond to queries for the domain. The registrar’s records stay untouched, and the domain keeps its reputation.
Defenses include owners removing name servers that no longer serve the domain and providers verifying control of a domain before serving it.
Encrypting DNS
DNSSEC leaves queries readable, so anyone along the path can see every name a user looks up. DNS over TLS and DNS over HTTPS encrypt the connection between the host and its resolver, which is the hop DNSSEC does not cover. They don’t go further: the resolver still sees every query, and an encrypted connection to a dishonest resolver delivers dishonest responses securely.
Denial of Service (DoS, DDoS)
A denial-of-service (DoS) attack makes a system unavailable to the people who are supposed to use it. A distributed denial-of-service (DDoS) attack is one whose traffic comes from many sources at once. Nearly every large attack is a DDoS attack, because one machine on one connection cannot produce enough traffic to hurt a large service. There are two ways to deny service:
-
Exploit a flaw that crashes the software, which is fixed once found.
-
Overload the service, its link, or something it depends on, which doesn’t require a flaw and is how most large attacks work.
A flaw in how a service limits its work can make overloading it far easier.
The arithmetic favors the attacker because handling a request usually takes more work than sending it. The attacker looks for the request with the highest ratio of receiver effort to sender effort. Saturating a large service’s link is harder because one machine has one connection. An attacker can generate traffic at scale through reflection, amplification, or a botnet.
Reflection and Amplification
A reflection attack sends requests to ordinary public servers with the victim’s address as the source, so that their replies go to the victim. It requires a network that forwards spoofed packets and servers that reply to unauthenticated requests, typically UDP services. The reflectors are not compromised. Reflection hides the attacker from the victim, but by itself it doesn’t increase volume. The smurf attack sent a ping to a network’s broadcast address so that every host replied to the victim.
An amplification attack chooses a reflector whose reply is much larger than the request. The amplification factor is the reply size divided by the request size. It depends on the protocol, request, and server’s configuration. DNS gives factors of several dozen. An exposed cache server that returned hundreds of kilobytes for a 15-byte request gave a factor in the tens of thousands.
Three things must be true for amplification to work, and each is a point of defense:
-
The attacker’s network forwards spoofed packets (ingress filtering).
-
The service is reachable from the Internet (firewalls).
-
The service sends a large reply to a small request (rate limiting and protocol changes).
Botnets
A botnet is a group of compromised devices that an attacker controls. Those devices can flood a victim directly or send forged requests to reflectors. They are the usual source of DDoS traffic. The largest botnets are built from devices that stay on, rarely update, and sit on fast home links, often compromised through default passwords. Traffic sent directly from real devices is hard to filter because none of it is forged. Botnets are rented: booter or stresser services sell attacks by the hour. An attack on a shared dependency, such as a DNS provider, can make every site that depends on it unreachable.
Attacks on Applications
An application-layer attack exhausts a server’s processing rather than its link, with requests that are individually valid and hard to tell from real users. The most effective target the requests that take the server the most work, such as search and pages built from several database queries. A flaw in how a server limits work makes such an attack far easier. In the Rapid Reset attack, a client sends an HTTP/2 request and cancels it, over and over, so the server’s limit on open requests never applies while it keeps paying the startup overhead of each one.
An attack is measured by whatever it exhausts:
-
Bits per second for bandwidth.
-
Packets per second for routers and firewalls, which decide per packet regardless of size.
-
Requests per second for an application.
Defenses
Every defense absorbs the traffic, filters it, or reduces the work each request causes. One rule governs the network-level defenses: filter before the bottleneck. A firewall behind an already-full link discards attack packets after legitimate ones were dropped upstream, so the provider, or a facility with far more capacity than the target, must remove the traffic.
The network-level defenses differ in what they protect:
-
Overprovisioning buys more capacity than normal operation needs. It absorbs short attacks but not a large botnet.
-
Anycast announces the same address from many data centers, so an attack from devices worldwide is divided among many sites.
-
Scrubbing centers receive a customer’s traffic during an attack over very large links, discard the attack traffic, and forward the rest.
-
Blackhole routing asks the provider to discard all traffic for one address. That service goes down, but the link stays up for everyone else.
-
Rate limiting caps packets, connections, or requests. Per-source limits do little against a botnet. Limits on a destination or on an operation that takes a lot of work apply regardless of how many sources there are.
-
Ingress filtering stops reflection and amplification at the source. It benefits other networks rather than the one that deploys it.
The application-level defenses keep requests from reaching the origin or reduce the work each one causes:
-
A reverse proxy or content delivery network sits in front of the origin server, serves cached content, and absorbs the flood, provided the origin accepts traffic only from the proxy.
-
A web application firewall blocks HTTP requests that match attack signatures, arrive too fast from one source, or target an operation that takes a lot of work.
-
A CAPTCHA or proof-of-work puzzle makes each client do something before the server does any real work. A botnet spreads the work, solvers exist, and every real user pays too.
-
Graceful degradation turns off the features that take the most work and serves plain cached pages, so the essential service survives.
An organization also keeps itself from becoming part of an attack:
-
Patch devices and change default credentials, so they don’t join botnets.
-
Don’t expose unneeded UDP services, so servers don’t become reflectors.
-
Filter spoofed packets at the border, so the network isn’t a launch point.
The last two mostly benefit other networks, which is why they remain incompletely deployed.
What You Don’t Need to Study
These exclusions apply to the network security material. VPNs, email authentication, and web security are covered by later lectures and their own study guides. The background section on how a packet reaches its destination is a review for anyone who has not studied IP networking, not exam material in itself.
The following are not required for the exam:
-
Incident names, dates, and figures: the YouTube, MyEtherWallet, and Softaculous hijacks, the Panix SYN flood, 1994 sequence-number attack, Great Firewall, Estonia attacks, Mirai and Dyn, memcached attack on GitHub, Slack DNSSEC outage, Sitting Ducks, and loop DoS. Know the mechanism each one illustrated.
-
Which organization runs, found, or named anything: the regional registries, root server operators, measurement projects, research groups, and companies that sell protection services. RFC numbers and the years protocols were standardized.
-
Specific amplification factors. Know what the factor is and that memcached was far larger than DNS.
-
Address notation details beyond reading a prefix length, and the sizes of IPv4 and IPv6 addresses.
-
The internals of double tagging. Know that VLAN hopping exploits permissive switch defaults and that the defenses are to disable trunk negotiation and configure trunks manually.
-
The details of IPv6 Neighbor Discovery beyond the fact that it has the same trust problem and the same attack as ARP.
-
QUIC and HTTP/3, and the internals of HTTP/2 streams beyond what Rapid Reset exploits.
-
DNS record types beyond A, NS, and MX, and the number of root servers.
-
How DNSSEC proves that a name does not exist, the key-rotation procedure, and the difference between a registry lock and a registrar lock.
-
The law-enforcement operation against booter services, the Project Shield program, and the sizes of the largest recorded attacks.
Week 11: VPNs
The protocols that move data across the Internet do not authenticate the sender, check the data, or hide its contents. Cryptography lets the endpoints protect the data themselves: assume the network is hostile and encrypt and authenticate everything that crosses it. TLS applies this to a single application’s connection. A VPN applies it to all traffic between networks.
What TLS Provides
TLS creates a secure channel between two applications. It provides authentication, confidentiality, and integrity. The handshake proves that the server holds the private key for its certificate. The data is protected with authenticated encryption, which encrypts and authenticates in one operation.
Client certificates are rarely used. Services instead authenticate the user after the channel is up, with a password or a one-time code, and TLS protects those credentials from eavesdropping.
TLS stops at the application boundary. Each application must choose to use it, and it protects only the one connection between two programs. A valid certificate proves the server’s identity but does not make the server trustworthy.
Tunneling
Tunneling carries the packets of one network inside the packets of another, so two networks behave as if a direct link joined them. The mechanism is encapsulation: an entire IP datagram, with its private source and destination addresses, becomes the payload of an outer packet addressed from one gateway to the other. The communicating computers do not see the encapsulation. A plain tunnel provides connectivity but not security: the inner packet travels in cleartext, the endpoints are not authenticated, and the contents can be modified.
What Makes a Tunnel a VPN
A VPN adds three protections to a tunnel: encryption of the inner packet, integrity protection so modified packets are detected and discarded, and authentication of the endpoints. Encryption covers the inner packet, its addresses included, but the outer header stays readable because routers need it. An observer between the gateways still sees the gateways’ addresses, when packets flow, and how large they are.
Deployment Models
The three arrangements differ in what sits at each end of the tunnel:
-
A site-to-site VPN runs between two networks’ gateways, joining the networks into one. The computers behind the gateways need no VPN software.
-
A remote access VPN runs from an individual device to an organization’s gateway. It encrypts traffic on untrusted networks, the gateway authenticates the user, and internal services stay off the public Internet.
-
A consumer VPN runs from a device to a commercial provider, which forwards the traffic to its destination. Sites see the provider’s address, which masks the user’s location. The provider sees the destination of every connection and can read unencrypted traffic, but HTTPS contents stay protected between the browser and the website. The user moves trust from the local Internet provider to the VPN provider.
Full and Split Tunneling
With full tunneling, all of a device’s traffic goes through the VPN, so the organization can apply its policies to everything, at the price of slower browsing. With split tunneling, only corporate traffic uses the tunnel, and other traffic bypasses the corporate gateway’s controls. The device is then on two networks at once, and a device compromised through its local connection can be used to reach corporate resources over its tunnel. Many organizations disable split tunneling for this reason.
IPsec
IPsec protects IP traffic at the network layer and is implemented in the operating system kernel. An IPsec header sits where a TCP or UDP header would, directly above IP, so IPsec can protect any higher-layer protocol without the applications knowing.
IPsec defines two protocols. The Authentication Header (AH) provides integrity and authentication without encryption and survives only for historical reasons. The Encapsulating Security Payload (ESP) authenticates and encrypts the payload, and it is the standard choice.
Tunnel mode encapsulates the entire original packet between two gateways. This is how site-to-site and remote access VPNs work. Transport mode keeps the original IP header and protects the payload between two hosts. Transport mode resembles TLS but differs from it: it protects all traffic between the machines, whatever the protocol, and the applications do not have to do anything.
IKE sets up an IPsec connection. It authenticates the peers with certificates or a pre-shared key, negotiates algorithms, and establishes session keys with a Diffie-Hellman exchange, which provides forward secrecy. IPsec’s strengths are broad support, kernel efficiency, and transparency to applications. Its weaknesses are the complexity of the standard and the fact that ESP is neither TCP nor UDP, so address translation devices and restrictive firewalls can block it.
OpenVPN
OpenVPN runs in user space and builds its security on TLS. The operating system hands it traffic through a virtual network interface, and the OpenVPN process encrypts that traffic and sends it to the peer. The control channel uses TLS for authentication and key exchange, which reuses certificates, certificate authorities, and mature TLS libraries. The data channel carries the tunneled traffic under symmetric encryption with keys from the handshake. Users authenticate with certificates or with a password over the encrypted channel.
OpenVPN prefers UDP as its outer transport: the tunnel already carries TCP connections, and TCP inside TCP can retransmit at both layers when packets are lost. TCP on the HTTPS port is the fallback for restrictive networks. OpenVPN is portable and auditable, but running in user space makes it slower than kernel implementations.
TLS-Based Enterprise VPNs
The dominant corporate remote access products also tunnel traffic inside TLS, using proprietary protocols with the same design as OpenVPN. Their appeal is manageability: the gateway ties into corporate authentication with a password, a second factor, and checks on the connecting device. The Rutgers VPN is one of these products.
WireGuard
WireGuard was designed for simplicity, modern cryptography, and speed. The implementation is small, the protocol has been formally analyzed, and it runs in the kernel. It supports exactly one set of cryptographic algorithms. With nothing to negotiate, an attacker cannot force a downgrade to weaker cryptography. A broken algorithm would be replaced by versioning the protocol.
A peer’s identity is its public key, and there are no certificates. Keys must be distributed outside the protocol, which is simple for a few machines but needs infrastructure at scale. Commercial mesh services provide that infrastructure. WireGuard’s handshake is a fresh key exchange, which provides forward secrecy, and frequent rekeying limits what a captured key exposes. It runs over UDP and does not keep connection state, so a device that changes networks resumes its tunnel without reconnecting.
What a VPN Does Not Protect
A VPN secures the path between its endpoints, and the guarantee stops there:
-
It does not protect the endpoints. Malware on a laptop reads data before encryption and rides the tunnel into the network with the user’s credentials.
-
It does not provide anonymity. The provider or gateway sees where the traffic goes, and websites identify users through cookies and logins.
-
The gateway itself is a target. It is reachable from the Internet by design, holds credentials, and sits at the edge of the network it protects.
-
Trust moves rather than disappearing: to the IT department that runs the gateway or to the provider that forwards the traffic.
What You Don’t Need to Study
The following are not required for the exam:
-
You don’t need to remember the cipher and algorithm names each protocol uses, including WireGuard’s list of primitives. Know that WireGuard fixes one modern set while IPsec and TLS negotiate theirs.
-
You don’t need to know packet header layouts, header sizes, or port numbers. Knowing that OpenVPN can fall back to TCP on the HTTPS port is enough.
-
You don’t need to remember the enterprise VPN product or vendor names. Know what the product category does and why organizations choose it.
-
You don’t need to remember dates, version numbers, or code sizes.
-
You don’t need to know the details of the Ivanti incident or the UK signup statistic. Know that VPN gateways are attack targets.
-
You don’t need to know L2TP or PPTP. Know that old VPN protocols with broken cryptography still appear in configuration menus and should not be used.
Week 12: Firewalls
Encryption protects traffic as it crosses a network, but it does not decide which traffic may enter or leave. Firewalls enforce that decision at network boundaries. Their designs have grown from stateless packet filters to systems that identify applications inside encrypted traffic, and zero trust extends the same controls to a world without a defensible perimeter.
Network Address Translation
NAT lets devices in an organization use private IP addresses, reserved ranges that are never routed on the public Internet. A NAT router rewrites addresses and ports as packets pass, using a translation table that maps internal address and port pairs to external ones. An outside host cannot address an internal device directly. Inbound traffic reaches a device only through a translation entry: one created by the device’s own outbound connection, or a fixed port forwarding entry configured to expose a service.
Translation and filtering are separate functions. NAT translates addresses, while firewall rules decide which traffic is allowed. Blocking unsolicited inbound traffic is a side effect of translation, not a security design, since NAT does not inspect traffic and does not restrict outbound connections.
Packet Filters
A packet filter examines each packet by itself and accepts or drops it based on header values: addresses, ports, protocol, and network interface. Rules form an ordered chain, and the first matching rule decides, so rule order determines the policy.
The basic principle of firewalling is that all traffic crossing a security boundary passes through the firewall that enforces the boundary’s policy. Ingress filtering controls inbound traffic and follows default deny: everything is blocked except the specific services the organization intends to expose. Filters also drop packets whose source addresses could only be forged, such as external packets claiming an internal source. Egress filtering controls outbound traffic and can keep a compromised host from downloading malware or exfiltrating data.
A stateless filter admits return traffic by accepting TCP packets with the ACK flag set. The approximation fails because an attacker can set the ACK flag on any packet.
Stateful Packet Inspection
A stateful firewall checks new connection attempts against its rules and records permitted connections in a state table. It uses that table, rather than a header flag, to admit return traffic and to reject packets inconsistent with the connection’s state. This supports the common policy that internal hosts may initiate outbound connections while outside hosts cannot initiate anything.
Protocols such as SIP negotiate their data ports inside their messages. Handling them requires an application-aware firewall that parses the payload and temporarily opens the negotiated ports.
Security Zones, the DMZ, and Segmentation
Organizations define security zones with different trust levels and enforce policy on traffic between each pair of zones. A DMZ holds the servers that must be reachable from the Internet, separated from both the Internet and the internal network. The policy differs by direction: the Internet reaches only specific services in the DMZ, outside traffic never reaches the internal network directly, and DMZ servers reach only what their jobs require. A server in the DMZ is hardened as a bastion host, with minimal software, essential accounts, and close monitoring.
Network segmentation generalizes the DMZ. The infrastructure is divided into separate networks, such as a web tier, a database tier, a development network, and guest WiFi, with firewalls enforcing policy between them. Segmentation applies the Principle of Least Privilege to networks: each segment can reach only the systems and services its work requires, restricting an attacker’s movement between segments.
Deep Packet Inspection
Deep packet inspection reads the application data inside packets. It supports hostname filtering through the server name exposed in a TLS handshake, validation that traffic follows its protocol, and matching content against malware signatures. Inspection systems reassemble traffic streams, so a signature split across packets is still detected.
Inspection faces two constraints: it must keep up with network speed, and it cannot read encrypted traffic without the plaintext. TLS interception obtains the plaintext by decrypting and re-encrypting traffic at the firewall. Clients then receive the firewall’s certificate instead of the real server’s, and end-to-end protection stops at the firewall. Encrypted Client Hello hides the server name in the handshake, which takes away the signal hostname filtering depends on.
Intrusion Detection and Prevention
An IDS monitors traffic and reports suspicious activity. An IPS sits inline in the traffic path and drops malicious packets before delivery. Detection takes three forms, used separately or together:
-
Protocol-based detection checks messages for violations of protocol rules. It detects malformed messages but misses attacks carried in valid messages.
-
Signature-based detection matches traffic against known attack signatures and misses attacks whose traffic matches none of its rules.
-
Anomaly-based detection flags deviations from a baseline of normal behavior and produces false positives when legitimate behavior changes.
In deployment, false positives produce more alerts than analysts can review, content inspection requires access to decrypted traffic, and attackers evade matching by splitting, encoding, and re-timing their traffic.
Next-Generation Firewalls
An NGFW combines stateful inspection, deep packet inspection, and intrusion prevention in one platform, and adds awareness of applications and user identities. Port numbers no longer identify applications, since nearly everything uses HTTPS on port 443, so an NGFW classifies applications from network-visible clues: handshake structure, TLS metadata, traffic timing and sizes, and known server addresses. It cannot see which program on a host generated the traffic.
Application Proxies
An application proxy is a service’s external interface. It terminates the client’s connection and opens its own connection to the real server, which gives it control of both sides. It validates the protocol, filters content, hides internal structure, and logs every request. Each protocol needs its own proxy, and the proxy can become a bottleneck. An API gateway applies the same design to web APIs, authenticating and authorizing every request before forwarding it to an internal service.
Host-Based Firewalls
A host-based firewall runs on the endpoint and filters that system’s own traffic, including traffic from machines on the same internal network that never crosses the perimeter. Filtering at the endpoint restricts lateral movement, an attacker spreading from one compromised machine to its neighbors. Host firewalls integrated with the operating system can allow or block network access per application. Network and host-based firewalls complement each other, and the network firewall still stands when malware with administrator privileges disables the host’s own firewall.
Zero Trust
The perimeter model trusts a location: inside the perimeter means safe. Mobile devices, cloud computing, insider threats, and compromised internal systems have erased the defensible boundary, a change called deperimeterization.
Zero trust replaces trusted locations with verified identity: never trust, always verify. Access is granted per session, to one resource at a time, by dynamic policy that weighs the user’s identity, the device’s state, location, and threat level. Authentication establishes identity, while policy decides access to each resource, so being inside the network does not authorize anything.
Microsegmentation applies segmentation to individual applications and workloads, giving each a policy that permits only its required communication. Zero Trust Network Access replaces broad VPN access. An intermediary authenticates the user, checks the device’s posture, and connects the user to the one application requested, without general network connectivity.
Zero trust is an architecture rather than a product. Legacy applications assume the network protects them, coordinating identity, devices, and policy across every resource is complex, and an attacker holding valid credentials and a compliant device still passes the checks.
What You Don’t Need to Study
The following are not required for the exam:
-
The history: who coined zero trust, when products appeared, and the names of early intrusion detection systems. Know the progression from stateless filtering to stateful inspection to content inspection.
-
How services authenticate each other inside a data center, including service meshes. Know that zero trust applies to connections between services, not only to users.
-
The term NAPT and the private address ranges by number. Know that private addresses are not routable and that NAT rewrites ports as well as addresses.
-
The deep content inspection (DCI) label. Know that content inspection reassembles streams and decodes content before matching.
-
Which operating systems enable their firewalls by default, the names of specific products, and which regulations call for segmentation.
-
Port numbers beyond the well-known web and mail ports you have already seen.
Week 12: Web security
A browser runs code and displays content from many sources on a single page, and some of those sources are hostile. The same-origin policy keeps content from different sites apart, and cookies maintain login state across requests. Most web attacks abuse one of these two mechanisms, exploit a server that trusts its input, or deceive the user.
The Browser as an Application Platform
Early browsers displayed static pages, so attacks targeted servers. JavaScript lets a page run code inside the browser. Scripts can modify the page through the Document Object Model (DOM), exchange data with servers without reloading the page, and use device features such as the camera and location. Each capability adds to the browser’s attack surface.
HTTPS and Its Limits
HTTPS is HTTP sent over a TLS connection. It provides confidentiality, integrity, and server authentication for data in transit. HTTPS does not protect against the following:
-
A compromised server, which sees data after it is decrypted.
-
Malware on the client, which reads data before encryption or after decryption.
-
A malicious site, which can hold a valid certificate for its own lookalike domain.
-
Observation of which sites a user visits, since destination IP addresses remain visible.
Web attacks work over HTTPS because they target the browser, server, or user rather than the network.
The Same-Origin Policy
A page assembles content from many sources: scripts, images, fonts, and frames. An iframe embeds one page inside another.
An origin is the combination of a URL’s scheme, hostname, and port. Two URLs have the same origin only when all three match. The path isn’t part of the origin, and a subdomain is a different hostname.
The same-origin policy allows a page’s scripts to read and modify only data that came from the page’s own origin. Each origin has its own JavaScript namespace, DOM, and local storage. A script on one page cannot read another origin’s page content, stored data, or network responses.
A script runs with the authority of the frame that loads it, not the server it was downloaded from. A third-party script that a page includes has full access to that page, so including a script is a trust decision. An embedded frame keeps the origin of its own content and is isolated from the page around it. Passive content, such as images and stylesheets, has no authority.
The policy restricts reading, not sending. A page can display images, follow links, and submit forms to other origins, and those requests reach the server. Cross-Origin Resource Sharing (CORS) lets a server permit specified origins to read its responses. CORS doesn’t authenticate users and doesn’t prevent forged requests.
Cookies
HTTP is stateless. A cookie is a name-value pair that a server sets and the browser returns with every later request to that server. Cookies have three uses:
-
Session management: a cookie holds a session ID that identifies a logged-in user.
-
Personalization: a cookie records the user’s preferences.
-
Tracking: a cookie with a unique ID lets a server record a browser’s visits.
All three use the same mechanism. A session ID must be unpredictable, since anyone who holds it can use the session.
Three cookie attributes protect cookies:
-
HttpOnly prevents scripts on the page from reading the cookie.
-
Secure sends the cookie only over HTTPS.
-
SameSite controls whether the cookie accompanies requests that originate from another site, which helps prevent CSRF.
A first-party cookie belongs to the site shown in the address bar. A third-party cookie belongs to another site whose content the page loads, such as an ad or a social media button. The browser sends a third-party server’s cookie each time it loads that server’s content. A tracker whose content appears on many sites receives the same cookie from all of them and can link a browser’s visits into one profile. Browsers increasingly block or isolate third-party cookies.
Cross-Site Scripting
Cross-site scripting (XSS) runs an attacker’s JavaScript inside a page from a legitimate site. The script runs with that page’s origin, so the same-origin policy doesn’t protect against it. XSS is an injection attack: the site places user input into a page where the browser treats it as code.
The common forms of XSS are:
-
Reflected XSS: the script is part of a request, typically a link the victim clicks, and the server echoes it into its response.
-
Stored XSS: the script is saved on the server, as in a forum post, and runs for every later visitor to the page.
An injected script can do anything the page’s own scripts can do. It can read the site’s cookies, make authenticated requests to the site through the victim’s browser, modify the page, capture keystrokes, and display a fake login form on the trusted site. HttpOnly keeps the script from reading the session cookie, but the script can still make requests to the site, and the browser sends the cookie with them.
The main defense is to keep untrusted data from becoming executable page content. Defenses include encoding output for the place where it is inserted, using templates that escape text automatically, and sanitizing user-supplied HTML with a library.
Cross-Site Request Forgery
Cross-site request forgery (CSRF) makes a victim’s browser send an unwanted request to a site where the victim is logged in. The browser attaches a site’s cookies to every request to that site, including a request triggered by another site’s page. The server receives an authenticated request and performs the action. The attacker never obtains the cookie.
Defenses include the following:
-
An anti-CSRF token is an unpredictable value that the server includes in its forms and requires with state-changing requests. The server rejects requests with a missing or incorrect token. An attacker’s page can’t read the token, so it can’t supply the required value.
-
The server sets SameSite on its authentication cookies to restrict them on cross-site requests.
-
The server uses GET only to retrieve information, never to change application state. State-changing actions use POST and require an anti-CSRF token. POST doesn’t prevent CSRF by itself.
Broken Access Control
Authentication establishes who a user is. Authorization decides what the user is allowed to do. Broken access control lets someone access data or perform an action without the required permission because the server doesn’t enforce authorization. A common case is changing a record ID in a URL to retrieve another user’s record.
Browser-side controls don’t secure the server. An attacker can modify requests, change hidden form fields, and bypass a page’s JavaScript checks. The server must validate input and enforce authorization on every request.
Clickjacking
Clickjacking places an invisible frame over visible content, so a user’s click lands on a hidden control from another site. The click is real and uses the victim’s logged-in session. The defense is for a server to tell browsers which sites may display its pages in a frame.
Deception Attacks
A homograph attack uses a domain name whose characters look like those of a legitimate name. The lookalikes can be similar Latin characters or identical-looking letters from other alphabets, which internationalized domain names allow. Browsers display suspicious international names in an encoded form, but only after the user has followed the link. A link in an email or text message still shows the lookalike name.
A tracking pixel is an invisible one-pixel image. Loading it sends a request that gives the image’s server the user’s IP address, browser type, and any cookies for that server. In an email message, it tells the sender that the message’s images were fetched.
A page can display borrowed logos to appear credible. A script can also change a link’s destination when the user clicks it, so the URL shown before the click isn’t where the browser goes.
The Attacks Compared
The four attacks on web applications differ in what the attacker causes to happen:
| Attack | What the attacker causes |
|---|---|
| Cross-site scripting | The trusted page executes the attacker’s code. |
| Cross-site request forgery | The browser sends an unwanted authenticated request. |
| Clickjacking | The user clicks a concealed control. |
| Broken access control | The server permits an unauthorized action or disclosure. |
What You Don’t Need to Study
These exclusions apply to the web security material. Topics developed in earlier lectures, including SQL injection, drive-by downloads, typosquatting, and combosquatting, are covered by those lectures’ study guides.
The following are not required for the exam:
-
WebAssembly.
-
JavaScript code, including postMessage, textContent, innerHTML, and the code shown in the notes. Know that a script runs with the authority of the page that loads it.
-
The names of HTTP headers, such as Set-Cookie, Access-Control-Allow-Origin, X-Content-Type-Options, X-Frame-Options, Origin, and Referer. Know what cookies and CORS do, and that a server can limit which sites may frame its pages.
-
The Content Security Policy.
-
Cookie scope: the domain and path rules, and the difference between session cookies and persistent cookies. Know the three attributes that protect cookies.
-
The SameSite settings (Strict, Lax, and None) and the exact definition of a site. Know that SameSite controls whether cookies accompany cross-site requests, and know the definition of an origin.
-
DOM-based XSS. Know reflected XSS and stored XSS.
-
MIME sniffing and mixed content.
-
Dates, the history of JavaScript, and the incidents used as examples, such as the Netflix and ING Direct attacks.
-
Unicode code points and the name Punycode. Know that letters from different alphabets can look identical.
-
Which browsers block third-party cookies, the names of advertising products, and the list of ranked web risks.