Security Research: Introduction and Scope
Somebody has to find a vulnerability before it can be fixed. In most serious cases that somebody is a researcher: a fuzzing engineer who left a parser running over a weekend, a reviewer who read a patch and wondered whether the same mistake exists elsewhere, a student who modelled a protocol and found a state the designers never imagined. Vulnerability research is the discipline of finding such flaws deliberately and systematically, understanding them well enough to judge how bad they are, and handing them to the people who can fix them. This course teaches it as a process with tools, on targets you write yourself, and ends where every finding should end: with a fix, a regression test and an advisory.
Before anything else: authorization and scope
Research tools are dual-use. A fuzzer pointed at your own parser is a quality tool; the same fuzzer sending inputs to someone else's server without permission is an attack. The rule of the whole track applies here without exceptions:
Only test software and systems you own, or that you have written permission to test, within the agreed scope.
Read these lessons of Security Foundations first; this course builds on them and does not repeat them:
- Authorization, Scope and Rules of Engagement: who may permit a test and what the permission must say.
- US Law, UK and EU Law and Vietnamese Law: what counts as unauthorised access or interference.
- Responsible Disclosure, Bug Bounties and security.txt: the first steps after a real finding. This course's Disclosure section goes deeper.
Analysing software you installed on your own machine is usually lawful, but licences, anti-circumvention laws and programme rules differ, and research on hardware, cars, medical devices or radio can carry extra rules. When in doubt, ask the vendor first or stay with the toy targets of this course.
How this course stays on the right side of the line
The track's safety line is binding, and research is where it matters most:
- Every target is a toy the lesson writes: a parser with seeded bugs, a toy protocol server, a toy bytecode verifier, a tiny model. No lesson hunts for bugs in real, named software.
- Process, not weapons. You will find bugs, prove them with a sanitizer report, find their root cause and fix them. There is no exploit development: no shellcode, no ROP chains, no heap grooming, no bypass recipes for any real product.
- AI attacks are mechanism, detection and defence on toy models with harmless strings. There is no collection of jailbreak or prompt-injection payloads.
- Every attack idea ends at detection and the fix, and the fix is tested again.
How the examples run
```bash runblocks are recorded sandbox sessions, made with real clang 18 (including libFuzzer), gcc 13, gdb 15 and Python 3.12 in a container with no network and no root. Run-time addresses change on every run (ASLR); they are masked when the sessions are checked, so your own run shows other numbers in the same places.```python runruns in your browser (Pyodide). The Python fuzzer, the delta debugger, the model checker, the toy eBPF verifier and the AI-security models are all written out in full, so you can change them and run them again.- Tools that can't run here (AFL++, syzkaller, QEMU, Semgrep, CodeQL, Frida, browser builds) appear as labelled lab transcripts.
The whole cycle in one session
Here is the course in miniature. The toy parser tlv.c reads a made-up format, TLV1 followed by records of a type byte, a length byte and a value. It checks that each value fits in the input, but its name handler copies the value into a 16-byte stack buffer without checking that it fits in the buffer. The session builds it with AddressSanitizer, feeds it a valid file and a file with a 24-byte name, applies the one-line fix and replays the crashing file. It runs in your sandbox, on files it creates:
cat > tlv.c <<'SRC'
#include <stddef.h>
#include <stdint.h>
#include <string.h>
/* Toy format "TLV1": magic, then records of type (1 byte), length (1 byte), value. */
static int rec_name(const uint8_t *v, size_t len) {
char name[16];
memcpy(name, v, len); /* seeded bug 1: len is never checked against 16 */
return name[0];
}
static int rec_sum(const uint8_t *v, size_t len) {
unsigned sum = 0;
for (size_t i = 0; i <= len; i++) /* seeded bug 2: <= reads one byte too many */
sum += v[i];
return (int)(sum & 0xff);
}
int tlv_parse(const uint8_t *data, size_t size) {
if (size < 4 || memcmp(data, "TLV1", 4) != 0) return -1;
size_t pos = 4;
int acc = 0;
while (pos + 2 <= size) {
uint8_t type = data[pos], len = data[pos + 1];
pos += 2;
if (len > size - pos) return -1; /* the input-length check is correct */
if (type == 1) acc += rec_name(data + pos, len);
else if (type == 2) acc += rec_sum(data + pos, len);
pos += len;
}
return acc;
}
SRC
cat > run_tlv.c <<'SRC'
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int tlv_parse(const uint8_t *data, size_t size);
int main(int argc, char **argv) {
FILE *f = fopen(argv[1], "rb");
if (!f) return 2;
uint8_t *buf = malloc(4096);
size_t n = fread(buf, 1, 4096, f);
fclose(f);
uint8_t *data = malloc(n); /* exact-size copy, so over-reads hit a redzone */
for (size_t i = 0; i < n; i++) data[i] = buf[i];
free(buf);
printf("%s: tlv_parse = %d\n", argv[1], tlv_parse(data, n));
free(data);
return 0;
}
SRC
gcc -g -O0 -fsanitize=address,undefined tlv.c run_tlv.c -o run_tlv
printf 'TLV1\x01\x03bob' > ok.tlv
python3 -c "import sys; sys.stdout.buffer.write(b'TLV1\x01\x18' + b'N' * 24)" > long-name.tlv
./run_tlv ok.tlv
./run_tlv long-name.tlv 2>&1 | grep -E 'ERROR|WRITE|#1 |#2 '
echo "exit code: ${PIPESTATUS[0]}"
sed -i 's| memcpy(name, v, len); /\* seeded bug 1: len is never checked against 16 \*/| if (len > sizeof name) return 0; /* fix: the value must fit the buffer */\n memcpy(name, v, len);|' tlv.c
gcc -g -O0 -fsanitize=address,undefined tlv.c run_tlv.c -o run_tlv
./run_tlv long-name.tlv; echo "exit code: $?"ok.tlv: tlv_parse = 98
==21==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7810c8900030 at pc 0x7810cb7d8303 bp 0x7ffeaee606f0 sp 0x7ffeaee5fe98
WRITE of size 24 at 0x7810c8900030 thread T0
#1 0x5c7ead26f493 in rec_name /home/learner/tlv.c:8
#2 0x5c7ead26f819 in tlv_parse /home/learner/tlv.c:27
exit code: 1
long-name.tlv: tlv_parse = 0
exit code: 0
Each line is a step of the research cycle. A valid input parses (98 is the byte value of b). An input written to break an assumption makes AddressSanitizer stop the program at the first bad byte: a WRITE of size 24 into a stack buffer, in rec_name at line 8, called from tlv_parse at line 27. That is the proof: not "it crashed", but which access, how large, where. The fix rejects values that do not fit, and the same input now passes cleanly. In later lessons a fuzzer finds such inputs on its own, you deduplicate and minimise them, find the root cause with gdb, and write it up.
The map
| Section | What you learn |
|---|---|
| Getting started | what vulnerability research is and the workflow: target, attack surface, hypothesis, tooling, triage, root cause, disclosure |
| Fuzzing | why it works, a coverage-guided fuzzer in Python, mutation vs generation vs grammars, libFuzzer with sanitizers, AFL++ and OSS-Fuzz, corpora and dictionaries, property-based testing |
| Triage and root cause | stack-hash deduplication, exploitability classes, delta debugging, root cause with gdb, the bug report |
| Static and variant analysis | review heuristics, taint analysis, Semgrep and CodeQL rules, finding the siblings of a known bug |
| Kernel security | the user/kernel boundary, syscalls as attack surface, KASLR, SMEP, SMAP, KPTI, HVCI and VBS, syzkaller, the eBPF verifier |
| Browser security | multi-process browsers, site isolation, sandboxes, JIT hardening, browser bug bounties |
| Protocol security | state-machine bugs, protocol fuzzing, model checking a handshake, TLS 1.3 and QUIC |
| Hardware security | timing side channels and constant-time code, Spectre, Meltdown and Rowhammer, firmware, secure boot, TPMs |
| AI security | the OWASP Top 10 for LLM Applications, prompt injection, poisoning and backdoors, adversarial examples, extraction, membership inference, model supply chain, NIST AI RMF and the EU AI Act |
| Supply chain | the xz-utils backdoor as a detection case study |
| Disclosure | ISO/IEC 29147 and 30111, CVE and CNAs, CVSS in advisories, writing an advisory, bug bounties, safe harbour |
| Practice | exercises and a full research cycle on a toy image parser |
What you should know first
This is the last specialisation of the track. You need C and memory-safety bugs at the level of Memory Safety & Binary Exploitation Concepts: its Sanitizers in CI and a First Look at Fuzzing lesson is the starting point of the fuzzing section, and its From Crash to Patch lesson the model for the fix. Reading disassembly and using gdb come from Reverse Engineering & Binary Analysis. The AI section builds on the ML track's Security of ML Systems and the LLM course's Privacy & Security. If the field is new to you, the survey course Cybersecurity is the gentlest start.
Start with What Vulnerability Research Is.
Test yourself
What may this course's examples be aimed at?
- Any open-source project
- Only toy targets the lessons write, such as a parser with seeded bugs
- Public bug-bounty targets
- Old versions of popular software
In the session, what does WRITE of size 24 tell you?
- The file was 24 bytes
- memcpy wrote 24 bytes into a 16-byte stack buffer, the length of the name value
- The program wrote a 24-byte log
- ASan needs 24 bytes of redzone
Why is fuzzing your own parser fine but sending fuzzed inputs to someone else's server not?
- Servers are faster
- Testing systems you have no permission to test is unauthorised access or interference in most legal systems
- Fuzzers only work offline
- It is fine either way
Where does a finding end in this course?
- At a working exploit
- At the crash
- At a fix, a regression test and an advisory
- At a social-media post