1/156
Looks like no tags are added yet.
What is a TOCTOU bug?
A security check happens, then the resource changes, then the program uses it — trusting a check that's now outdated.
Classic TOCTOU example?
Program calls access() to check a file, then open()s it later. Attacker swaps the file for a symlink in between.
What does a stack buffer overflow overwrite, in order, above the buffer?
Saved frame pointer, then the saved return address.
Why does overwriting the return address let an attacker run code?
When the function returns, the CPU jumps to whatever address is there — the attacker controls that address.
What is ASLR?
Address Space Layout Randomisation — randomises where code, stack, and libraries sit in memory each run, so attackers can't guess addresses.
What is a stack canary?
A secret value placed before the return address. If an overflow corrupts it, the program detects tampering and aborts before returning.
What is W^X (write XOR execute)?
A memory page can be writable or executable, never both — stops injected shellcode from running.
What is return-to-libc?
Instead of injecting new code, overflow the return address to jump straight to an existing function like system(), with args set up on the stack.
Why does return-to-libc beat W^X?
It never needs to execute attacker-written memory — it just reuses code that's already marked executable.
What is Intel CET / endbr64?
Hardware check requiring every indirect jump/call target to be an ENDBR instruction — blocks jumping into the middle of functions.
What is CHERI?
A CPU architecture where pointers are replaced by "capabilities" — bounded, hardware-checked addresses that fault on out-of-bounds use.
What's wrong with printf(user_input)?
If user_input contains format specifiers, printf treats it as a format string — a format string vulnerability.
What does %n do in a format string, and why is it dangerous?
It writes the number of characters printed so far to a pointer argument — giving an attacker an arbitrary memory write.
How does Windows handle %n in printf?
It doesn't implement it at all.
How does OpenBSD handle a dangerous %n use?
It crashes the program and emails the admin.
Why is gets() dangerous?
It reads input into a buffer with no length check, so long input overflows into adjacent memory.
On 32-bit Linux, how do you make a raw syscall?
Syscall number in eax, arguments in ebx/ecx/edx/esi/edi, then int 0x80.
In x86-64 (System V) calling convention, where do the first few function arguments go?
In registers: rdi, rsi, rdx, rcx, r8, r9.
Order these from biggest to smallest: arena, heap, chunk.
Arena > heap > chunk. An arena holds one or more heaps; each heap is divided into chunks.
What is a glibc memory arena?
A block of memory shared between threads of a process that the allocator can hand out from.
In a glibc chunk header, what does the P bit mean?
Previous chunk is in use (not free).
In a glibc chunk header, what does the M bit mean?
Chunk was obtained via mmap rather than the normal heap.
What extra fields does a FREE chunk have that an in-use chunk doesn't?
fd (forward) and bk (backward) pointers, linking it into the free list.
Why does free() sometimes merge neighbouring chunks?
To reduce fragmentation — if a neighbour is already free, they're coalesced into one bigger free chunk.
What is the classic glibc 'unlink' exploit?
Corrupt a free chunk's fd/bk pointers so unlink()'s pointer-fixup writes an attacker-chosen value to an attacker-chosen address.
Who used the unlink exploit against Netscape, and on what?
Solar Designer, against a JPEG comment-handling bug in Netscape Navigator (2000).
What is a use-after-free bug?
Using a pointer after the memory it points to has been freed — that memory may now hold different, attacker-influenced data.
Does free(x); x = NULL; fully fix use-after-free?
No — it only protects that one variable. Any other pointer that aliased the same memory is still dangling.
Why might a compiler defeat free(x); x = NULL; anyway?
If x is never read again, the compiler can optimise away the "dead" write to NULL.
What does a CHERI capability contain?
An address, bounds (valid range), permissions, and a validity tag.
Does CHERI fully solve use-after-free?
Not by itself — it stops out-of-bounds access well, but a freed pointer can still be a valid, in-bounds capability unless combined with revocation.
What is a ROP gadget?
A short instruction sequence already in the binary, ending in ret, that does one small useful thing.
How does a ROP chain run many gadgets in sequence?
The attacker stacks gadget addresses on the stack; each gadget's trailing ret pops the next address and jumps to it.
Is ROP Turing complete?
Given enough gadgets (move, compare, arithmetic, branch-like primitives), yes in principle.
What is Jump-Oriented Programming (JOP)?
Like ROP, but chains gadgets via indirect jumps/jump tables instead of ret — useful when defenses target returns specifically.
What is a shadow stack?
A protected second stack of return addresses, checked against the real stack on every return — catches tampering.
How does CET/endbr64 limit ROP specifically?
Indirect jumps/returns must land on an ENDBR instruction, so gadgets can't start mid-function anymore — only at real function entries.
Besides CET, what two other things make ROP much harder today?
Stack canaries (detect corruption before a bad return is used), and restricting syscalls to only go through libc wrappers.
What does return-to-libc 2.0 add over plain return-to-libc?
A leaked pointer to defeat ASLR, used to compute where libc actually loaded before chaining calls.
CVE-2023-38545 — what was it?
A heap buffer overflow in curl's SOCKS5 proxy handling — notable because curl is everywhere.
What is fuzzing?
Feeding a program lots of malformed/random input and watching for crashes or other unintended behaviour.
Who is credited with inventing fuzzing?
Barton Miller — after noticing modem-line noise during a storm was crashing Unix utilities (late 1980s).
Mutation-based fuzzing vs generation-based fuzzing?
Mutation: randomly tweak existing sample inputs (cheap, low coverage). Generation: build inputs from a known grammar/format (better coverage, expensive to set up).
Blackbox fuzzing vs whitebox fuzzing?
Blackbox: only see input/output. Whitebox: can inspect the program's internals to guide fuzzing.
Why does blind mutational fuzzing struggle with file formats like JPEG?
Random mutations rarely satisfy structural checks (like magic bytes), so most inputs get rejected before reaching interesting code.
What is coverage-guided (evolutionary) fuzzing?
Keep mutated inputs that trigger new code coverage (new edges), and mutate those further — using coverage as a feedback signal.
Name a well-known coverage-guided fuzzer.
AFL (American Fuzzy Lop).
What is a CVE?
A standard ID for a publicly known vulnerability, run by MITRE since 1999.
What is a CNA?
CVE Numbering Authority — an org approved to assign CVE IDs for its own software.
Why isn't full code coverage enough to guarantee all bugs are found?
Hitting every statement once doesn't mean every value/state combination at that statement was tried.
Which fuzzing style suits an unknown file format?
Mutation-based — there's no known grammar to generate from.
Which fuzzing style suits a known grammar like XML or a compiler's input language?
Generation-based — it can produce syntactically valid inputs that go deeper into the parser.
Why is fuzzing networked/server software harder than a simple file parser?
It often needs a stateful handshake/session before reaching interesting code, and is harder to restart and observe cheaply.
Identification vs authentication vs authorization?
Identification: claiming who you are. Authentication: proving it. Authorization: deciding what you're allowed to do.
What is a subject in access control?
An entity (user, process) that can request access to resources.
What is an object in access control?
A resource being protected — a file, device, or piece of data.
What is an Access Control Matrix?
A table of subjects vs objects, where each cell lists that subject's allowed operations on that object.
What is the Principle of Least Privilege?
Give a subject only the access it actually needs to do its job — nothing more.
What is an ACL (Access Control List)?
Per object, a list of (subject, permissions) pairs — same info as a matrix column, stored with the object.
What is DAC (Discretionary Access Control)?
The resource's owner decides who else gets access, at their own discretion (e.g. standard UNIX file permissions).
What does setUID do on a UNIX program?
Runs the program with the file owner's privileges, not just the invoking user's.
In -rwxr-x---, what do the three rwx groups mean?
Owner's permissions, then group's, then everyone else's (read/write/execute).
What is MAC (Mandatory Access Control)?
A central administrator sets policy that users/owners can't override (e.g. SELinux, AppArmor).
What is RBAC (Role-Based Access Control)?
Permissions are tied to roles (jobs), not individual users; a user gets permissions through the roles they hold.
RBAC's three core rules?
Role assignment (need an active role), role authorization (role must be allowed), transaction authorization (transaction must be allowed for that role).
Authorized role vs active role in RBAC?
Authorized = all roles you're permitted to hold. Active = the role(s) you're currently acting under.
What is ABAC (Attribute-Based Access Control)?
Access is granted based on attributes of the user/resource/environment, not a fixed identity or role.
What is sandboxing?
Running code in a restricted environment so it can't touch resources it wasn't explicitly allowed to use.
What is seccomp?
A Linux mechanism to restrict which syscalls a process can make — powerful but notoriously hard to use correctly.
What do pledge() and unveil() do on OpenBSD?
pledge(): restrict a process to named categories of syscalls. unveil(): restrict which filesystem paths it can even see.
Why can OpenBSD sandbox almost everything by default, but Linux struggles to?
OpenBSD's OS and core packages are built together by one team; Linux distros assemble many independently-maintained packages.
How does one bit of DRAM store its value?
A capacitor (plus a transistor); it leaks charge over time so must be refreshed regularly (~every 64ms).
What is Rowhammer?
Rapidly re-reading ("hammering") a DRAM row can flip bits in physically adjacent rows due to electrical interference.
Why does a Rowhammer exploit need clflush?
To evict the value from cache so each read actually hits DRAM again, instead of being served from cache.
Single-sided vs double-sided Rowhammer?
Single-sided: hammer one row to flip bits nearby. Double-sided: hammer the rows on both sides of a target row — much more effective.
Were bit flips from Rowhammer originally seen as a security issue?
No — manufacturers treated them as a reliability/quality issue, not a security one.
How did Seaborn & Flake use Rowhammer to escape Google's NaCl sandbox?
They flipped a bit in a 'safe jump' instruction sequence, turning it into an unsafe jump — escaping the sandbox.
Name two Rowhammer mitigations.
ECC memory (can correct 1 flipped bit) and Target Row Refresh (refreshes rows next to heavily-accessed ones).
What's the core idea of the Meltdown attack?
Speculatively read memory you shouldn't be able to, which leaves a trace in the CPU cache even after the read is rolled back.
Why does the cache still leak data even though Meltdown's bad read is rolled back?
The cache is a separate subsystem from the architectural rollback — its state isn't reverted.
What's the core idea of the Spectre attack?
Train the branch predictor so a bounds check is predicted to pass, then supply an out-of-range index — the CPU speculatively reads out-of-bounds data into cache before realising the misprediction.
Could Spectre be run from JavaScript in a browser?
Yes — a malicious webpage could leak memory a byte at a time.
What are the CVE numbers for Meltdown and Spectre?
Meltdown: CVE-2017-5754. Spectre: CVE-2017-5753 and CVE-2017-5715.
Main mitigation for Meltdown?
Kernel Page Table Isolation (KPTI) — stops the kernel mapping from even being visible to speculate on.
Why is Spectre considered harder to fix than Meltdown?
It has multiple variants needing separate fixes (e.g. IBRS, STIBP), and new variants keep being found.
What is fault injection (as an attack)?
Deliberately causing a hardware fault — via voltage glitching, clock glitching, EM pulses, or lasers — to make a chip misbehave.
How can a voltage glitch bypass a secure boot check?
Glitch the branch instruction implementing the signature check at the right moment, so it takes the "boot anyway" path despite failing.
One software defense against fault injection, and its limit?
Perform the check twice with a volatile comparison — reduces the chance a single glitch works, but doesn't remove the underlying hardware weakness.
Why disable SMT (hyperthreading) as a Spectre/Meltdown mitigation?
SMT shares CPU resources (incl. cache) between threads, making cross-thread cache side-channel attacks easier.
What is a kernel rootkit's goal?
Give an attacker persistent root access while hiding its own presence from the user and tools.
Name three ways a rootkit can hide itself.
Modify kernel code directly, hook function pointers to redirect calls, or edit kernel data structures (e.g. the process list) directly.
How might a rootkit hide a file from ls?
Intercept the getdents() syscall and strip the malicious entry from the results it returns.
List the 5 rootkit categories from least to most privileged layer.
Application, kernel, virtualised, bootloader, hardware/firmware.
What is the 'attack surface' of a system?
All the points where an attacker could try to get in, affect, or extract data from it.
What is a TEE (Trusted Execution Environment)?
A hardware-isolated part of the processor that keeps code/data inside it confidential and untampered.
Name three real TEEs.
Intel SGX, ARM TrustZone, Apple Secure Enclave.
What is a TCB (Trusted Computing Base)?
The small set of hardware, software, and procedures that security actually depends on — everything else can misbehave without breaking security.
TEE vs TCB — what's the difference?
A TEE is one component (like a vault door). The TCB is the whole security perimeter (the vault door, walls, alarms, guards, policy).
What is a TPM?
A dedicated hardware chip used for things like disk encryption, boot integrity checks, and key storage.
What is the CRTM?
Core Root of Trust for Measurement — the first, immutable piece of firmware that boots and starts the chain of trust.