The Research Workflow: From Target to Disclosure
Beginners open a big code base, start reading at main, and give up a week later with nothing. Experienced researchers do something less heroic: they choose a target for a reason, list where untrusted input enters, write down concrete guesses about what could be wrong, and pick the cheapest tool that can confirm or refute each guess. Every finding then goes through the same pipeline of triage, root cause, fix and disclosure. This lesson lays out that workflow; the rest of the course fills in each step.
The seven steps
- Target selection. Pick something you are allowed to test and where a finding matters: widely deployed, handling untrusted data, written in a memory-unsafe language, recently changed, or with a history of bugs (old advisories are a map). For a learner, your own code and the toys of this course are the right first targets; open-source projects come later, under their disclosure policies.
- Attack surface. List every place untrusted input enters: file formats, network messages, IPC calls, environment variables, configuration, plug-ins. For each, note who can send it and what privileges the code runs with. Attack Surface introduced the idea; here it becomes a ranked work list.
- Hypotheses. Write down falsifiable guesses: "the decoder trusts the length byte", "the sync handler accepts messages before login", "the signature is checked after the manifest is parsed". A hypothesis says where to look and what evidence would confirm it.
- Tooling. Choose the cheapest test for each: a fuzz harness for parsers, a targeted unit test, a static-analysis query, a debugger session, a model of a protocol.
- Triage. Deduplicate what the tools report, reproduce each finding, minimise the input, rate the impact.
- Root cause and fix. Find the first wrong decision in the code, not the line that crashed; propose the fix and a regression test.
- Disclosure. Report privately to whoever can fix it, agree a timeline, publish an advisory with the fix.
The loop matters as much as the line: a refuted hypothesis sends you to the next one, and every confirmed root cause is a new hypothesis for variant analysis ("where else does the code trust a length byte?").
Ranking the attack surface
The example ranks the entry points of a fictional desktop app, labview, with a simple heuristic: how exposed the input is, how much parsing code sits behind it, whether that code is memory-unsafe, and what privileges it runs with. It then prints the research log, where every hypothesis has a test and a result. It runs in your browser:
# Attack-surface ranking for a toy target: "labview", a desktop image viewer with a sync service.
EXPOSURE = {"network, no login": 5, "network, logged in": 4, "file from anyone": 4, "local user": 2, "admin only": 1}
PRIV = {"runs as root": 3, "runs as the user": 2, "sandboxed": 1}
entry_points = [
# name, who can send input, parser size (kLOC), memory-unsafe language?, privileges
("TLV1 image decoder", "file from anyone", 3.1, True, "runs as the user"),
("sync protocol handler", "network, logged in", 1.8, True, "runs as root"),
("thumbnail cache reader", "local user", 0.6, True, "runs as the user"),
("settings page (web UI)", "admin only", 0.9, False, "runs as root"),
("update manifest parser", "network, no login", 0.4, False, "runs as root"),
("font renderer (sandbox)", "file from anyone", 7.5, True, "sandboxed"),
]
def score(src, kloc, unsafe, priv):
# exposure x size x (memory-unsafe doubles it) x privileges; a heuristic, not a law
return EXPOSURE[src] * kloc * (2 if unsafe else 1) * PRIV[priv]
ranked = sorted(entry_points, key=lambda e: -score(*e[1:]))
print(f"{'entry point':<26}{'input from':<20}{'score':>6}")
for name, src, kloc, unsafe, priv in ranked:
print(f"{name:<26}{src:<20}{score(src, kloc, unsafe, priv):6.1f}")
# The research log: every hypothesis gets a test and a result, including the negative ones.
log = [
("H1", "TLV1 decoder trusts the length byte for its own buffers", "fuzz with ASan, 1 h", "confirmed: stack overflow in rec_name"),
("H2", "sync handler accepts messages before login", "replay a message sequence", "refuted: rejected with 401"),
("H3", "update manifest signature is checked after parsing", "read the code path", "open"),
]
print()
for hid, hyp, test, result in log:
print(f"{hid}: {hyp}\n test: {test} -> {result}")entry point input from score
font renderer (sandbox) file from anyone 60.0
TLV1 image decoder file from anyone 49.6
sync protocol handler network, logged in 43.2
update manifest parser network, no login 6.0
thumbnail cache reader local user 4.8
settings page (web UI) admin only 2.7
H1: TLV1 decoder trusts the length byte for its own buffers
test: fuzz with ASan, 1 h -> confirmed: stack overflow in rec_name
H2: sync handler accepts messages before login
test: replay a message sequence -> refuted: rejected with 401
H3: update manifest signature is checked after parsing
test: read the code path -> open
Read the ranking critically, because the heuristic has blind spots that are typical of real ones:
- The sandboxed font renderer comes first because it is large and takes files from anyone. The sandbox lowers the impact of one bug, but researchers still study such code: a renderer bug is often the first link of a chain, and sandbox escapes are a field of their own (Browser Security).
- The update manifest parser is near the bottom because it is small and memory-safe. Yet it is reachable without login and runs as root, and hypothesis H3 (signature checked after parsing) is a logic bug no memory-safety score can see. Small, privileged, unauthenticated code deserves review even when fuzzing it is pointless.
- H2 was refuted, and stays in the log. Negative results save the next person a day and show the scope you covered.
The research notebook
Keep one notebook per target: version and build flags, harness code, corpus location, commands with their seeds, every hypothesis with its result, every crash with its hash and status. When you write the advisory in the last section of this course, everything it needs is already there, and if a vendor or a court later asks what you did, the notebook shows that you stayed in scope.
How vendors use the same workflow defensively
Security teams run the workflow on their own products as threat modelling plus testing: a design review lists the attack surface and the trust boundaries, each boundary gets fuzz harnesses and review, and findings are tracked like any other defect. Microsoft's STRIDE, OWASP's threat-modelling guidance and the "four questions" (what are we working on, what can go wrong, what are we going to do about it, did we do a good job) all describe the same loop from the builder's side.
Pitfalls
- No hypothesis, no progress. "Look for bugs" is not a plan; "check every length field against every buffer it fills" is.
- Ranking only by bug class. Logic and authorisation bugs live in small, boring code paths with high privileges.
- Losing reproducibility. A crash without the exact build, flags and input is a rumour. Record seeds and versions.
- Scope creep. Testing a vendor's live service because "the library is open source" is outside scope. Test the library locally.
Practice
1. Write two falsifiable hypotheses for the toy TLV1 decoder.
"Every record length is checked against the remaining input, but not against the destination buffer of its handler" (test: fuzz each record type under ASan, or review each handler's copy). "The parser loops forever on a zero-length record of an unknown type" (test: a unit test with a timeout). Each names where to look and what result confirms or refutes it.
2. Change the heuristic so that the update manifest parser ranks higher. Is that a good idea?
For example, add a factor for "reachable without authentication" or treat root privilege as 5. It moves the parser up, but every weight is a judgement call; the real lesson is to run a separate review pass for small privileged code instead of trusting a single score.
3. Why keep refuted hypotheses in the log?
They document coverage (what was tested and how), stop others from repeating the work, and make the advisory and any later dispute about scope easier.
Test yourself
What is a good research hypothesis?
- The code probably has bugs
- A falsifiable statement that says where to look and what would confirm it, e.g. 'the decoder trusts the length byte for its buffers'
- A list of tools
- The CVSS score
Why did the update manifest parser rank low, and why is that misleading?
- It is unreachable
- The heuristic rewards large memory-unsafe code; a small privileged unauthenticated parser can still hide a logic bug like checking the signature after parsing
- It runs sandboxed
- It is written in C
What does the loop from root cause back to the attack surface represent?
- Retesting the fix
- Variant analysis: each root cause becomes a hypothesis about similar code elsewhere
- Disclosure
- Fuzzing again with a new seed