System Security

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/156

encourage image

There's no tags or description

Looks like no tags are added yet.

157 Terms

1
New cards

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.

2
New cards

Classic TOCTOU example?

Program calls access() to check a file, then open()s it later. Attacker swaps the file for a symlink in between.

3
New cards

What does a stack buffer overflow overwrite, in order, above the buffer?

Saved frame pointer, then the saved return address.

4
New cards

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.

5
New cards

What is ASLR?

Address Space Layout Randomisation — randomises where code, stack, and libraries sit in memory each run, so attackers can't guess addresses.

6
New cards

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.

7
New cards

What is W^X (write XOR execute)?

A memory page can be writable or executable, never both — stops injected shellcode from running.

8
New cards

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.

9
New cards

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.

10
New cards

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.

11
New cards

What is CHERI?

A CPU architecture where pointers are replaced by "capabilities" — bounded, hardware-checked addresses that fault on out-of-bounds use.

12
New cards

What's wrong with printf(user_input)?

If user_input contains format specifiers, printf treats it as a format string — a format string vulnerability.

13
New cards

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.

14
New cards

How does Windows handle %n in printf?

It doesn't implement it at all.

15
New cards

How does OpenBSD handle a dangerous %n use?

It crashes the program and emails the admin.

16
New cards

Why is gets() dangerous?

It reads input into a buffer with no length check, so long input overflows into adjacent memory.

17
New cards

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.

18
New cards

In x86-64 (System V) calling convention, where do the first few function arguments go?

In registers: rdi, rsi, rdx, rcx, r8, r9.

19
New cards

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.

20
New cards

What is a glibc memory arena?

A block of memory shared between threads of a process that the allocator can hand out from.

21
New cards

In a glibc chunk header, what does the P bit mean?

Previous chunk is in use (not free).

22
New cards

In a glibc chunk header, what does the M bit mean?

Chunk was obtained via mmap rather than the normal heap.

23
New cards

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.

24
New cards

Why does free() sometimes merge neighbouring chunks?

To reduce fragmentation — if a neighbour is already free, they're coalesced into one bigger free chunk.

25
New cards

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.

26
New cards

Who used the unlink exploit against Netscape, and on what?

Solar Designer, against a JPEG comment-handling bug in Netscape Navigator (2000).

27
New cards

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.

28
New cards

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.

29
New cards

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.

30
New cards

What does a CHERI capability contain?

An address, bounds (valid range), permissions, and a validity tag.

31
New cards

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.

32
New cards

What is a ROP gadget?

A short instruction sequence already in the binary, ending in ret, that does one small useful thing.

33
New cards

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.

34
New cards

Is ROP Turing complete?

Given enough gadgets (move, compare, arithmetic, branch-like primitives), yes in principle.

35
New cards

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.

36
New cards

What is a shadow stack?

A protected second stack of return addresses, checked against the real stack on every return — catches tampering.

37
New cards

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.

38
New cards

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.

39
New cards

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.

40
New cards

CVE-2023-38545 — what was it?

A heap buffer overflow in curl's SOCKS5 proxy handling — notable because curl is everywhere.

41
New cards

What is fuzzing?

Feeding a program lots of malformed/random input and watching for crashes or other unintended behaviour.

42
New cards

Who is credited with inventing fuzzing?

Barton Miller — after noticing modem-line noise during a storm was crashing Unix utilities (late 1980s).

43
New cards

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).

44
New cards

Blackbox fuzzing vs whitebox fuzzing?

Blackbox: only see input/output. Whitebox: can inspect the program's internals to guide fuzzing.

45
New cards

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.

46
New cards

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.

47
New cards

Name a well-known coverage-guided fuzzer.

AFL (American Fuzzy Lop).

48
New cards

What is a CVE?

A standard ID for a publicly known vulnerability, run by MITRE since 1999.

49
New cards

What is a CNA?

CVE Numbering Authority — an org approved to assign CVE IDs for its own software.

50
New cards

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.

51
New cards

Which fuzzing style suits an unknown file format?

Mutation-based — there's no known grammar to generate from.

52
New cards

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.

53
New cards

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.

54
New cards

Identification vs authentication vs authorization?

Identification: claiming who you are. Authentication: proving it. Authorization: deciding what you're allowed to do.

55
New cards

What is a subject in access control?

An entity (user, process) that can request access to resources.

56
New cards

What is an object in access control?

A resource being protected — a file, device, or piece of data.

57
New cards

What is an Access Control Matrix?

A table of subjects vs objects, where each cell lists that subject's allowed operations on that object.

58
New cards

What is the Principle of Least Privilege?

Give a subject only the access it actually needs to do its job — nothing more.

59
New cards

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.

60
New cards

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).

61
New cards

What does setUID do on a UNIX program?

Runs the program with the file owner's privileges, not just the invoking user's.

62
New cards

In -rwxr-x---, what do the three rwx groups mean?

Owner's permissions, then group's, then everyone else's (read/write/execute).

63
New cards

What is MAC (Mandatory Access Control)?

A central administrator sets policy that users/owners can't override (e.g. SELinux, AppArmor).

64
New cards

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.

65
New cards

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).

66
New cards

Authorized role vs active role in RBAC?

Authorized = all roles you're permitted to hold. Active = the role(s) you're currently acting under.

67
New cards

What is ABAC (Attribute-Based Access Control)?

Access is granted based on attributes of the user/resource/environment, not a fixed identity or role.

68
New cards

What is sandboxing?

Running code in a restricted environment so it can't touch resources it wasn't explicitly allowed to use.

69
New cards

What is seccomp?

A Linux mechanism to restrict which syscalls a process can make — powerful but notoriously hard to use correctly.

70
New cards

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.

71
New cards

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.

72
New cards

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).

73
New cards

What is Rowhammer?

Rapidly re-reading ("hammering") a DRAM row can flip bits in physically adjacent rows due to electrical interference.

74
New cards

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.

75
New cards

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.

76
New cards

Were bit flips from Rowhammer originally seen as a security issue?

No — manufacturers treated them as a reliability/quality issue, not a security one.

77
New cards

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.

78
New cards

Name two Rowhammer mitigations.

ECC memory (can correct 1 flipped bit) and Target Row Refresh (refreshes rows next to heavily-accessed ones).

79
New cards

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.

80
New cards

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.

81
New cards

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.

82
New cards

Could Spectre be run from JavaScript in a browser?

Yes — a malicious webpage could leak memory a byte at a time.

83
New cards

What are the CVE numbers for Meltdown and Spectre?

Meltdown: CVE-2017-5754. Spectre: CVE-2017-5753 and CVE-2017-5715.

84
New cards

Main mitigation for Meltdown?

Kernel Page Table Isolation (KPTI) — stops the kernel mapping from even being visible to speculate on.

85
New cards

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.

86
New cards

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.

87
New cards

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.

88
New cards

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.

89
New cards

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.

90
New cards

What is a kernel rootkit's goal?

Give an attacker persistent root access while hiding its own presence from the user and tools.

91
New cards

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.

92
New cards

How might a rootkit hide a file from ls?

Intercept the getdents() syscall and strip the malicious entry from the results it returns.

93
New cards

List the 5 rootkit categories from least to most privileged layer.

Application, kernel, virtualised, bootloader, hardware/firmware.

94
New cards

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.

95
New cards

What is a TEE (Trusted Execution Environment)?

A hardware-isolated part of the processor that keeps code/data inside it confidential and untampered.

96
New cards

Name three real TEEs.

Intel SGX, ARM TrustZone, Apple Secure Enclave.

97
New cards

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.

98
New cards

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).

99
New cards

What is a TPM?

A dedicated hardware chip used for things like disk encryption, boot integrity checks, and key storage.

100
New cards

What is the CRTM?

Core Root of Trust for Measurement — the first, immutable piece of firmware that boots and starts the chain of trust.