Back to Blog

AI-Assisted Vulnerability Research and Exploit Development

Muhammad Saad
Head of RED team • RED TEAM
View Articles
AI-Assisted Vulnerability Research and Exploit Development
CyberSecurityOffensiveSecurityVulnerabilityResearchExploitDevelopmentAIinSecurity

AI-Assisted Vulnerability Research and Exploit Development

Introduction

Vulnerability research is an endurance sport: pick a target, read unfamiliar code until the control flow makes sense, hypothesize where input handling breaks, and test by hand. A serious campaign can take weeks to reach the first promising crash, then more weeks to learn whether it mattered. That model held for two decades.

Automation arrived first as a search technique, not a thinking partner. Coverage-guided fuzzing — mutating inputs and keeping those that reach new code — turned bug hunting into a pipeline: Michal Zalewski's American Fuzzy Lop (AFL, 2013) found real bugs in already-audited software, and LLVM's libFuzzer put the idea inside the compiler toolchain. Fuzzing removed input-guessing tedium but left three hard problems: writing the harness that feeds the target, deciding which crashes matter, and understanding what a patch changed.

Large language models (LLMs) added a second layer, and precision matters: they do not fuzz faster than AFL++, they read. They summarize unfamiliar parsers, draft the scaffolding that turns a library into a fuzzable target, explain stack traces, and walk through patches — the reading-heavy, writing-heavy work automation never touched.

The results stopped being theoretical. Google's Big Sleep project, announced in late 2024, described an AI agent credited with identifying a previously unknown vulnerability in widely used open-source code, reported through normal disclosure channels. Bug bounty platforms have publicly discussed the rise of AI-assisted submissions and updated their policies around them, and the tooling now appears in internal red-team workflows. The point is not a new class of bug but shifted economics: work that took days now takes an afternoon, and the bottleneck moves to judgment rather than effort.

The sections that follow explain the process, where AI accelerates it, and what it implies for offense and defense; a reproducible lab closes the piece on a deliberately vulnerable toy program.

How Vulnerability Research Actually Works

Five terms cover most of what follows.

  1. Fuzzing is automated input generation. A coverage-guided fuzzer instruments a program to see which branches each input reaches, then mutates inputs that open new branches.
  2. A crash is the observable symptom: a bad dereference, a read past a buffer, an abort on a guard. It says the program reached an invalid state, not why or whether anyone controls it.
  3. Triage is the work after the crash: reproduce, minimize, symbolize, identify the faulting operation, classify. Most crashes are boring; triage finds the interesting one in thousands.
  4. An n-day already has a public patch, sometimes with an advisory. A zero-day (0-day) has neither. Much exploitation research is n-day work: read the fix, reconstruct the bug, weaponize the window before patches land.
  5. An exploit primitive is a capability, not an exploit: a controlled write, an information leak, an out-of-bounds read. Turning one into a working exploit is separate engineering.

AI assistance today is strongest at the first two stages and weakest at the last.

Where AI Actually Helps Today

LLMs help unevenly: strong at reading and drafting, weak wherever ground truth about a running system matters.

  • Code comprehension at scale. Models trained on huge code corpora spot idioms instantly: length checks, custom allocators, malformed-header handling. It saves hours, though the summary is a starting point, not an audit.
  • Fuzzing harness generation. A harness is the glue between fuzzer and target: open the input, initialize the object under test, drive the API without leaking state. Writing one demands knowing both sides; models draft it well, teardown included.
  • Crash triage. Manually this means symbolizing the binary and reading assembly. A model reads a backtrace, names the likely faulting call, proposes minimization. It cannot judge production reachability.
  • Patch diffing and n-day research. Patches leak information: a fix often names the vulnerable site, the trigger, the violated invariant. Comparing builds is structured text comparison, which models handle well.
  • Exploit primitive reasoning. From crash type to primitive to exploitability class: a wild write suggests a controlled write; a use-after-free raises a reallocation question. Analogy, not validation.
Research stage Fully manual AI-assisted
Summarizing unfamiliar code Hours of reading Minutes; still needs verification
Writing a fuzzing harness Days of boilerplate Solid first draft, then edits
Triaging a crash queue Manual symbolization Fast hypotheses, human confirmation
Patch diffing for n-days Slow, error-prone Rapid explanation and impact sketch
Deciding exploitability Expert judgment Weak; needs a human with the live target

Limits deserve equal weight. Full exploit chains against targets protected by ASLR (address space layout randomization), CFG (control-flow guards), and stack canaries remain beyond AI alone: those mitigations exist to make bugs non-exploitable; defeating them demands iterative testing against the real binary, and reliability engineering and reachability judgments stay human.

The Dual-Use Debate

This tooling is dual use: whatever accelerates a defender's patch review accelerates an attacker's research. That is a condition to manage, not a contradiction to resolve.

The popular framing — the risk is someone jailbreaking a chatbot into writing exploit code — misdescribes the exposure. Models already assist legitimate research daily under ordinary terms of service; the real change is that the tedious majority of the workflow got faster. Jailbreak stories describe a novelty, not the mechanism that matters.

Faster discovery pressures disclosure norms. Once a patch is public, AI-assisted tooling shortens the path from diff to understanding. Responsible disclosure — report, allow time to fix, publish after a patch — remains the standard, but the clock runs quicker and the patch window becomes an operational metric.

Policy is catching up: AI safety organizations have published disclosure frameworks for systems that find bugs at scale, DARPA's AI Cyber Challenge had AI systems find and patch infrastructure vulnerabilities, and bug bounty platforms converge on transparency — disclose the tools, stay in scope.

The key tension: acceleration is symmetric. Whatever compresses a defender's timeline compresses an attacker's too, so norms and process matter more than capability.

The lesson is not restraint on finding bugs but honesty about method and discipline about disclosure: advantage belongs to whoever closes the loop fastest.

A Realistic Researcher Workflow

A competent researcher neither hands over the job nor treats the model as an oracle. A typical day looks like this.

Morning is the crash queue. Overnight fuzzing produced four hundred crashes; the researcher asks the model to group them by faulting function and flag unfamiliar traces, then decides which cluster deserves time.

Mid-morning is harness work. The researcher describes a parser's API and input format; the model drafts a harness that reads the file and calls the parse function. It compiles after two corrections: half a day becomes twenty minutes, and the saved time goes to edge cases the model missed.

Afternoon is n-day work: a dependency advisory lands, the researcher asks the model what invariant changed and where the flaw sat, then checks the reading against the vulnerable build.

Exploitation logic stays human: deciding what to overwrite under the live service's constraints happens with the debugger, not in the prompt.

  1. Repetitive reading and drafting: delegated, then reviewed.
  2. Hypothesis generation: delegated, then tested.
  3. Exploitation logic and validation: owned by the human.

Researchers who benefit treat every response as a lead. Those who lose time treat it as a verdict.

What This Means for Defenders

The uncomfortable conclusion for blue teams: the n-day window is shrinking. Publishing a patch diff starts a race, and AI-assisted analysis cheapens turning that diff into understanding, so defenders have less time between "fix available" and "exploit plausible."

That pressures patch SLAs. Patching measured in months runs on a timeline the threat does not respect; speed becomes a frontline control alongside segmentation and detection, and prioritization should follow exploit availability, not severity scores alone.

Defenders gain the same leverage: the tooling that diffs patches for attackers can diff them for defenders, and asking a model what behavioral signature a fixed path implies is practical detection engineering today.

The claim worth repeating: patching speed is now a frontline control, not a backend metric. Teams that compress their own timelines survive the compression everyone else experiences.


Hands-On Lab: Watching the AI-Assisted Loop in Action

This lab proves the theory on a small, safe, local target: no real-world software, no payload, no mitigation bypass.

Step 1 — What the lab proves

You will watch AI accelerate the fuzzing setup, crash interpretation, and the fix, and you will see where the human still owns the work: verifying arithmetic, judging exploitability.

Step 2 — Environment setup

sudo apt-get update && sudo apt-get install -y afl++
echo core | sudo tee /proc/sys/kernel/core_pattern
echo 2 | sudo tee /proc/sys/kernel/perf_event_paranoid

AFL++ needs core dumps on disk and performance-counter access.

Step 3 — The vulnerable program

The toy reads a name and appends it to Hello, inside a 16-byte stack buffer using strcat(), which does no bounds checking. Save as vuln.c.

#include <stdio.h>
#include <string.h>

#define NAME_CAP 4096

static char name[NAME_CAP];

int main(int argc, char **argv) {
    if (argc > 1) {
        FILE *f = fopen(argv[1], "rb");
        if (!f) return 1;
        size_t n = fread(name, 1, NAME_CAP - 1, f);
        fclose(f);
        name[n] = '\0';
    } else {
        printf("Enter your name: ");
        fflush(stdout);
        if (!fgets(name, NAME_CAP, stdin)) return 1;
    }

    name[strcspn(name, "\r\n")] = '\0';

    char greeting[16];
    strcpy(greeting, "Hello, ");   /* 7 chars + NUL */
    strcat(greeting, name);        /* no bounds check -> overflow */
    strcat(greeting, "!");

    printf("%s\n", greeting);
    return 0;
}

Sixteen bytes hold Hello, plus the name plus !; any longer name writes past the end.

Step 4 — Compiling with instrumentation

afl-clang-fast -g -O0 -fno-stack-protector -z execstack -o vuln_fuzz vuln.c

Instrumentation records which basic blocks execute, so the fuzzer sees what a mutation explores. -g keeps debug symbols for GDB; -O0 keeps the stack layout predictable. -fno-stack-protector disables the canary so the overflow surfaces as a clean crash, not an early abort — a toy choice, not a hardened-target technique.

Step 5 — Asking AI to design the harness and seeds

I have a small C program that reads a name from argv[1] (or stdin) and copies it
into a fixed-size stack buffer with strcat(). I want to fuzz it with AFL++.
Suggest a harness approach, a seed corpus, and the exact afl-fuzz command.
Explain each choice, and tell me what result would confirm the bug.

A good answer proposes @@, seeds covering normal input plus one near the boundary, and a bounded run — trade-offs explicit for review.

Step 6 — Running the fuzzer

mkdir -p in out
printf 'Alice\n' > in/seed1
printf 'Bob\n'   > in/seed2
python3 -c "import sys; sys.stdout.write('A'*32+'\n')" > in/seed3

export AFL_SKIP_CPUFREQ=1 AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 AFL_NO_AFFINITY=1
timeout 90 afl-fuzz -i in -o out -m none -- ./vuln_fuzz @@

AFL++ mutates seeds that open new edges; the 32-character seed sits near the boundary, so the reference run quickly found a crash under out/default/crashes/.

Step 7 — Triaging the crash in GDB

f=$(ls out/default/crashes/id* | head -1)
gdb -q -batch -ex "run $f" -ex bt -ex 'info registers rip rbp rsp' ./vuln_fuzz
Program received signal SIGSEGV, Segmentation fault.
0x0000555555557706 in main (argc=<error reading variable: Cannot access memory at address 0x4141414141414139>, argv=<error reading variable: Cannot access memory at address 0x4141414141414131>) at vuln.c:41
41	}
rip            0x555555557706      0x555555557706 <main+566>
rbp            0x4141414141414141  0x4141414141414141

The frame pointer is 0x4141414141414141 — eight As from the input — and GDB can no longer locate argc and argv, which derive their addresses from it. Input bytes have overwritten saved control data.

Ask the model to interpret it:

Here is a GDB backtrace and register dump from a crashing C program that uses
strcpy/strcat into a 16-byte stack buffer. Explain which operation overflowed,
which stack slot was overwritten, and what the corrupted rbp implies about
control of the return address. Do not write an exploit.

A strong answer names strcat(greeting, name) and concludes the epilogue jumps uncontrolled once those slots are overwritten — still a hypothesis until measured.

Step 8 — Confirming the offset yourself

Do not accept the model's arithmetic. Sweep progressively longer names:

for n in $(seq 40 56); do
  python3 -c "import sys; sys.stdout.write('A'*$n+'\n')" > /tmp/t.txt
  ./vuln_fuzz /tmp/t.txt >/dev/null 2>&1
  echo "len $n -> exit $?"
done

Up to 47 characters exits cleanly; at 48 it segfaults. A 64-character name leaves the saved frame pointer at 0x4141414141414141 and the return-address slot full of input bytes: saved control data falls roughly 48 bytes into the name. Verifying that is the point.

AI output is a hypothesis to verify, not a conclusion to trust. The debugger is the arbiter.

Step 9 — The AI-suggested fix

Suggest a minimal, safe fix for this overflow and explain why it works. Prefer
bounded string functions and preserve the program's behavior for normal input.

Apply bounded copies. strncat caps each append, and the size arithmetic reserves the terminator:

char greeting[96];
greeting[0] = '\0';
strncat(greeting, "Hello, ", sizeof(greeting) - strlen(greeting) - 1);
strncat(greeting, name,    sizeof(greeting) - strlen(greeting) - 1);
strncat(greeting, "!",     sizeof(greeting) - strlen(greeting) - 1);

Each append is capped, space recomputed after each concatenation, - 1 reserving the NUL. A larger destination would only raise the threshold; the bound makes the bug impossible.

Step 10 — Re-testing the fixed binary

afl-clang-fast -g -O0 -fno-stack-protector -z execstack -o vuln_fixed fixed.c

f=$(ls out/default/crashes/id* | head -1)
./vuln_fixed "$f"; echo "afl crash file -> exit $?"

rm -rf out_fixed
timeout 60 env AFL_SKIP_CPUFREQ=1 AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 \
  afl-fuzz -i in -o out_fixed -m none -- ./vuln_fixed @@

The crash file exits 0, inputs to 2000 characters exit 0, and a fresh fuzzing run reports zero crashes. The bug is gone, not displaced.

Step 11 — What this lab proves

AI accelerated the reading and drafting: harness shape, seed strategy, backtrace interpretation, patch. The human chose which suggestions to follow, measured the offset, and judged the result — acceleration covered the repetitive eighty percent, judgment the rest.


Conclusion

The shift is economic, not ceremonial: AI changes what an hour of research buys. Work that took days now takes minutes, and the scarce resource becomes verification, prioritization, and exploitation judgment — for attacker and defender alike.

The strongest posture is neither dismissal nor dependence: delegate the repetitive work, keep humans on consequential decisions, and measure what can be measured. Organizations that compress their own patching and detection timelines will gain from the acceleration they fear; those waiting for the old clock will find it was never theirs.

The single strongest takeaway: AI changed the speed of vulnerability research, not the need for judgment. Advantage goes to whoever closes the loop fastest, on either side.

Further Reading

  • Google's Big Sleep write-up (Threat Intelligence Group and Project Zero) — an AI agent credited with a real open-source vulnerability.
  • DARPA AI Cyber Challenge (AIxCC) — AI systems finding and patching infrastructure flaws in a public contest.
  • Michal Zalewski's American Fuzzy Lop and the AFL++ documentation — the fuzzing lineage behind this lab.
  • Google Project Zero blog — n-day and patch-diff analyses showing the craft AI accelerates.