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                  # Configure the build
stitch infer --name harn1    # Infer a harness
stitch fuzz --name harn1     # Fuzz and triage crashes

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             Source revision and project settings
├── config/                 Dockerfile, build metadata, and test program
├── harnesses/
│   └── harn1/              One directory per harness
│       ├── harness.json    Inferred harness specification
│       ├── campaign/
│       │   ├── reports/    Crash reports and triage results
│       │   └── revisions/  Harness revisions and fuzzing outputs
│       └── coverage/       HTML and JSON coverage reports
└── bugs/                   Exported C++ reproducers

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.

stitch info

Command reference

Use stitch --help to list commands, or append --help to any command for its options.

Common STITCH commands
CommandPurpose
stitch init <source>Initialize from a Git URL or local source directory.
stitch genGenerate the Docker build configuration.
stitch inferInfer a harness specification.
stitch fuzzFuzz with automatic triage and harness repair.
stitch bugsReplay, save, and analyze crashes.
stitch coverMeasure coverage from a saved corpus.
stitch infoShow project details and LLM usage.
stitch devOpen 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.