Automatic fuzzing for C and C++.
STITCH uses LLMs to configure builds and infer harness specifications, then runs coverage-guided fuzzing with automatic crash triage.
Quickstart
Requires Python 3.10+, Git, Docker with linux/amd64 support, and an OpenAI API key. Start Docker before running the commands below.
pip install stitch-fuzz
export OPENAI_API_KEY="your-api-key"
stitch init https://github.com/madler/zlib
cd madler_zlib
stitch gen
stitch infer --name harn1
stitch fuzz --name harn1
Installing from an artifact checkout? Use pip install ./stitch at the repository root instead of the first command.
The first run builds Docker images. Setup and inference time depend on the target; LLM steps use your API account.
Press Ctrl + C to request a graceful stop. Rerun stitch fuzz --name harn1 to resume. Crash reports are saved in harnesses/harn1/campaign/reports/.
Project layout
Each target has a project directory. Build settings are shared; each harness keeps its own fuzzing and coverage results.
madler_zlib/
├── stitch.json
├── config/
├── harnesses/
│ └── harn1/
│ ├── harness.json
│ ├── campaign/
│ │ ├── reports/
│ │ └── revisions/
│ └── coverage/
└── bugs/
Main files and folders are shown above; they appear as you run each stage. Raw fuzzing writes to the directory given by -o (outputs/ in the example below).
Examples
Run these from the project directory created above. If you already have a configured project and harness, use those instead.
Reproduce bugs
After a campaign produces triaged reports, recompile and replay their minimized testcases with AddressSanitizer enabled.
stitch bugs replay --name harn1
To select one report, add -b <bug-hash>, using its directory name under campaign/reports/. The output shows whether the crash reproduces.
Run a standalone C++ reproducer
With a configured project and a saved testcase.cpp:
stitch bugs run -t testcase.cpp
Add -d to open the debugger, or -c <commit> to test another revision of the target library.
Run a coverage experiment
Fuzz the inferred harness for one hour without LLM triage, then measure source coverage from the saved corpus.
stitch fuzz --name harn1 --no-triage -o outputs \
--time-limit-seconds 3600
stitch cover --name harn1 --outputs outputs --nproc 4
Open harnesses/harn1/coverage/html/index.html for the report. Machine-readable results are in harnesses/harn1/coverage/coverage.json.
The time limit applies to fuzzing, excluding the build. Coverage requires a nonempty outputs/queue/. Use a fresh project copy for each independent trial: coverage profiles accumulate within a harness.
Inspect a project
Check the pinned source revision, generated harnesses, and recorded LLM usage. Add --harness harn1 for harness statistics.
Command reference
Use stitch --help to list commands, or append --help to any command for its options.
Common STITCH commands
| Command | Purpose |
stitch init <source> | Initialize from a Git URL or local source directory. |
stitch gen | Generate the Docker build configuration. |
stitch infer | Infer a harness specification. |
stitch fuzz | Fuzz with automatic triage and harness repair. |
stitch bugs | Replay, save, and analyze crashes. |
stitch cover | Measure coverage from a saved corpus. |
stitch info | Show project details and LLM usage. |
stitch dev | Open a shell in the target container. |
For repeatable experiments, pin the target with stitch init <repo-url> -c <commit> and retain the generated configuration and harness.