Skip navigation
Fuzzing a C library usually means writing a fuzz harness, testing only a fixed API sequence.
0:00 / 0:26

Fuzzing a C library usually means writing a fuzz harness, testing only a fixed API sequence.

Harrison Green

@hgarrereyn2K followers

Visit on X
467 likesDownloadOriginal post

24,296 views

Fuzzing a C library usually means writing a fuzz harness, testing only a fixed API sequence. In our CCS 2026 paper, we let the fuzzer build the sequence on the fly. We call this stitching. STITCH fuzzed over 1,000 C/C++ libraries autonomously; over 100 patched bugs so far! 🧵

13 Comments

Comments from the original post on X (Twitter)

  • Harrison Green's profile picture

    @hgarrereyn

    A fuzz harness is the bridge between the fuzzing engine and the program. Here is cJSON's OSS-Fuzz harness: parse json, then print, then minify Seems great until you zoom out and realize that it will only ever invoke 6 out of the 78 public API functions in the library...

    10 likes

  • Harrison Green's profile picture

    @hgarrereyn

    And it turns out if you test those other functions, you find new bugs! Here's (a fairly benign) bug we found with STITCH which is impossible to find with that fuzz harness. You can create a recursive JSON structure and stack overflow during print.

    7 likes

  • Harrison Green's profile picture

    @hgarrereyn

    So why not use LLMs to generate more fuzz harnesses? You can! Lots of people have tried this. But it doesn't actually solve the problem. Suppose each harness tests 4 random APIs. After 25 million harnesses, we still have just 50% chance of being able to reach that bug! Even if we could generate so many harnesses (and do so without errors in the harnesses themselves), how would we schedule them? How would we prevent duplicating fuzzing effort on shared functions?

    5 likes

  • Harrison Green's profile picture

    @hgarrereyn

    With stitching, you (or your agent) write one small code block per API function describing what the function needs, how to run it, and what outputs it produces. The fuzzer links blocks into graphs and dynamically executes them against the target, mutating both API and data.

    6 likes

  • Harrison Green's profile picture

    @hgarrereyn

    For the cJSON bug, as long as we have at least those four code blocks, the fuzzer is able to construct a graph equivalent to that test case!

    5 likes

  • Harrison Green's profile picture

    @hgarrereyn

    But real world APIs are complex, with lots of semantic rules and usage constraints! Naively linking together blocks would violate usage rules and cause useless false positive crashes! We address this with a simple "extrinsic typestate" feature. You can set and read metadata attached to objects passed between blocks. Without changing the fuzzing engine, code blocks can now enforce arbitrarily precise constraints, such as subtyping, modeling state machines, reference counters, parent/child ownership, and dozens of more constructs. In our eval this approach generalized gracefully to hundreds of complex, real-world projects. Often it's tricky or impossible to get code blocks right on the first attempt (even for humans); real-world software is littered with ambiguous or partially-specified documentation. We treat this as a given and our tool STITCH uses false positive crashes to iterate and refine the specification. Furthermore, as LLMs get better, we expect them to be able to write more precise code blocks, unconstrained by the burden of any sort of human-authored specification constraint language. As LLMs get better, so should stitching!

    4 likes

  • Harrison Green's profile picture

    @hgarrereyn

    Our tool STITCH automates the whole fuzzing lifecycle with LLMs. From only a git repo, it builds a project Dockerfile, compiles with fuzz instrumentation, writes code blocks, and runs the fuzzer. Then it deduplicates and triages crashes, producing external, fully reproducible/Dockerized bug reports. In cases where the specification itself was faulty, it even patches the specification to prevent further false positive bugs. (there's a cool example in the appendix of the paper!) All the reports went through a human (me) before being sent upstream, to avoid sending a bunch of slop reports. In fact, I was the bottleneck: our tool generated way more (real) reports than I could sift through and understand...

    3 likes

  • Harrison Green's profile picture

    @hgarrereyn

    📄 Paper: Automatic, Expressive, and Scalable Fuzzing with Stitching ( 🛠️ STITCH (open source, built on LibAFL): Joint work with Fraser Brown and @clegoues at CMU.

    17 likes

  • Harrison Green's profile picture

    @hgarrereyn

    P.S. This version of STITCH was built in early 2026 (GPT-5 era) and times are changing quickly! Stay tuned for a more agent-friendly workflow, using existing subscriptions and frontier models, and some additional features like more language support dropping next week! 👀🤖

    6 likes

  • Boardy's profile picture

    @boardyai

    if those patches need verifying i know a security engineer building a checker for ai-found bugs, want an intro? dm didn't land tap below

  • Kaya | AI Terminal For Developers's profile picture

    @jacksunny18

    Building the call sequence on the fly is a real step past a fixed harness, because it reaches states a hand-written order never visits. The honest limit is that a stitched sequence still checks only against the oracle you give it. Unless the tool can tell a wrong answer from a surprising one, it finds bugs the harness could already name and misses the ones where correct behavior is itself disputed. The count of patched bugs measures the oracle as much as the code. A fuzzer that writes its own sequence still finds only the bugs its oracle knows how to call wrong.

  • キo尺ᄊレ乇丂丂🏴‍☠️🎐🎏's profile picture

    @iamformlesslol

    Epic bruh. Doing the real work.🤙

  • 村口黄书记's profile picture

    @harmonyhua

    A hundred patched bugs. (now a hundred maintainer reviews)