TExcelTAD

What Vulnerability Research Is

A crash report lands in a project's tracker: "the importer segfaults on this file". Is that a vulnerability? Maybe. It might be a harmless null-pointer read in a tool nobody runs on untrusted files, or it might be a heap overflow reachable from every web upload form that uses the library. Vulnerability research is the work of answering that question for a whole class of inputs, before anyone else does: finding flaws, proving they are reachable, judging their impact, and getting them fixed. This lesson fixes the vocabulary and the kinds of research you will practise.

Bug, weakness, vulnerability, exploit

The words are used loosely in the press. In research they are precise:

Term Meaning Example on the toy parser
Bug the code does something its author did not intend rec_sum loops with <= instead of <
Weakness a kind of bug that can lead to a security problem, catalogued in CWE CWE-193 off-by-one, CWE-125 out-of-bounds read
Vulnerability a weakness in a specific product that an attacker can reach and that crosses a security boundary the off-by-one, reachable from any file the parser opens
Exploit a method or program that uses a vulnerability to achieve an effect out of scope for this course: we stop at proof and fix

The step from bug to vulnerability needs two arguments. Reachability: can attacker-controlled input get to the faulty code, through which entry point, under what preconditions? And boundary: does triggering it give the attacker something they should not have, such as reading memory, changing data, running code, crashing a service other people depend on, or moving from a sandboxed process to a more privileged one? The vocabulary of threats and risk comes from Threats, Vulnerabilities and Risk; this course adds the research view.

The example applies those questions to six toy findings. It runs in your browser:

python · try it yourself
# Is a finding a vulnerability? Three questions, applied to toy findings.
findings = [
    # (id, description, flaw?, attacker reaches it?, crosses a security boundary?, CWE)
    ("F1", "name record copied into a 16-byte stack buffer without a length check", True, True, True, "CWE-121"),
    ("F2", "same copy, but only in the offline converter run by the developer", True, False, True, "CWE-121"),
    ("F3", "debug log prints file sizes with %d instead of %zu", True, True, False, "CWE-686"),
    ("F4", "admin page lets the admin delete their own account", False, True, False, None),
    ("F5", "sum record reads one byte past the value (off-by-one)", True, True, True, "CWE-193"),
    ("F6", "parser accepts records of unknown type and skips them", False, True, False, None),
]

def classify(flaw, reachable, boundary):
    if not flaw:
        return "not a bug (intended behaviour)"
    if not reachable:
        return "bug, not reachable by an attacker: fix as hardening"
    if not boundary:
        return "bug, reachable but no security impact: ordinary fix"
    return "VULNERABILITY: triage, fix, disclose"

for fid, desc, flaw, reach, bound, cwe in findings:
    print(f"{fid} {classify(flaw, reach, bound):<52} {cwe or '-'}")
    print(f"   {desc}")
F1 VULNERABILITY: triage, fix, disclose                 CWE-121
   name record copied into a 16-byte stack buffer without a length check
F2 bug, not reachable by an attacker: fix as hardening  CWE-121
   same copy, but only in the offline converter run by the developer
F3 bug, reachable but no security impact: ordinary fix  CWE-686
   debug log prints file sizes with %d instead of %zu
F4 not a bug (intended behaviour)                       -
   admin page lets the admin delete their own account
F5 VULNERABILITY: triage, fix, disclose                 CWE-193
   sum record reads one byte past the value (off-by-one)
F6 not a bug (intended behaviour)                       -
   parser accepts records of unknown type and skips them

F1 and F2 are the same code, and only one of them is a vulnerability: the difference is who can reach it. But "only the developer runs the converter" is an argument that must be checked, not assumed. If anyone ever runs it on a file someone emailed them, F2 becomes F1. F3 is a genuine bug with no security effect; F4 and F6 are intended behaviour that a hurried reviewer might report. Research is mostly this kind of careful reasoning, with tools to supply evidence.

The kinds of vulnerability research

Approach How it finds bugs Strong at Lessons
Fuzzing runs the target on millions of generated inputs, with a sanitizer as the judge parsers, decoders, protocol handlers Fuzzing
Manual code review a human reads code with hypotheses about where it breaks logic bugs, authorisation, rare paths Static analysis
Static analysis tools reason about all paths without running them: patterns, data flow, taint known bug shapes across large code bases Static analysis
Variant analysis starts from one known bug and searches for its siblings finding the other copies of a mistake Variant analysis
Patch analysis reads a security fix to understand what was wrong, and checks that the fix is complete incomplete fixes, regressions From Crash to Patch
Design and formal analysis models a protocol or state machine and checks properties exhaustively protocol and state bugs Model checking
Reverse engineering recovers behaviour from binaries when there is no source closed software, firmware Reverse Engineering

Real projects combine them. A typical cycle: review the code to find the risky parsers, write fuzz harnesses for them, triage what the fuzzer finds, then run variant analysis for each root cause, because a mistake made once is usually made again.

Who does it, and why it is legitimate

Vendors run internal security teams and continuous fuzzing; operating-system and browser makers pay bug bounties; universities publish new bug classes and defences; independent researchers report through disclosure programmes; governments and CERTs coordinate. What makes all of it legitimate is the same set of conditions you met in Security Foundations: permission or ownership, scope, minimal impact, and disclosure to the party who can fix it. Research that ends with a private sale to an unknown buyer, or with silence, is not what this course teaches.

How a vulnerability is detected (from the defender's side)

Organisations find vulnerabilities in their own code through the same methods, run continuously: sanitizer builds in CI, fuzzing services, static analysis in code review, dependency scanners matching published advisories, and a public reporting channel so outside researchers can reach them. The signal that research is working is that most bugs are found before release, by the project itself.

How the risk is reduced

The fix for an individual vulnerability is a code change. The fix for a class is a design change: memory-safe languages, parsers generated from a grammar, APIs that make the wrong thing hard (bounded copies, typed lengths), privilege separation so that one bug does not give everything away. Good research reports name both: the patch for this bug and the change that prevents the next one.

Pitfalls

  • "It crashed" is not a finding. Without the sanitizer report, the input, the reachable path and the impact, nobody can act on it.
  • Severity by bug class alone. An out-of-bounds write is usually worse than a read, but a read that leaks a key can be worse than a write in dead code. Argue from reachability and boundary.
  • Reporting intended behaviour. Read the documentation and the threat model first: if the admin is allowed to do it, it is not privilege escalation.
  • Stopping at one. One bug is a hint that its siblings exist.

Practice

1. A tool that converts files for printing runs as a normal user and crashes on a malformed file with a stack overflow. When is it a vulnerability?

When an attacker can get a file to it (a print queue that accepts jobs from the network, a mail attachment, a shared folder) and the overflow can affect something the attacker should not control: the user's data, the session, other users' print jobs. If the tool only ever processes files its own user created, it is a robustness bug to fix as hardening.

2. Name the CWE for each of the toy parser's two seeded bugs.

The unchecked memcpy into name[16] is CWE-121 (stack-based buffer overflow), more generally CWE-787 (out-of-bounds write). The <= loop is CWE-193 (off-by-one), which causes CWE-125 (out-of-bounds read).

3. Which approach would you start with for a closed-source firmware image with a network service, and why?

Reverse engineering to find the service's parsers (there is no source), then fuzzing those parsers in an emulator or on your own device, then variant analysis for each root cause. Static source analysis is not available, and design review needs the protocol documented first.

Test yourself

What turns a bug into a vulnerability?

  1. Being written in C
  2. Being reachable by attacker-controlled input and crossing a security boundary
  3. Causing a crash
  4. Having a CVE number

What does CWE catalogue?

  1. Individual vulnerabilities in products
  2. Kinds of weaknesses, such as CWE-121 stack-based buffer overflow
  3. Exploit code
  4. Severity scores

Which approach starts from a known bug and looks for similar code elsewhere?

  1. Fuzzing
  2. Variant analysis
  3. Formal verification
  4. Penetration testing

F1 and F2 in the example are the same code. Why is only F1 a vulnerability?

  1. F2 has no CWE
  2. F2's code path is not reachable by attacker input, as long as that assumption really holds
  3. F1 is newer
  4. F2 is in Python