Techniques for writing effective fuzzing harnesses across languages. Use when creating new fuzz targets or improving existing harness code.
View on GitHubtrailofbits/skills
testing-handbook-skills
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/trailofbits/skills/blob/main/plugins/testing-handbook-skills/skills/harness-writing/SKILL.md -a claude-code --skill harness-writingInstallation paths:
.claude/skills/harness-writing/# Writing Fuzzing Harnesses A fuzzing harness is the entrypoint function that receives random data from the fuzzer and routes it to your system under test (SUT). The quality of your harness directly determines which code paths get exercised and whether critical bugs are found. A poorly written harness can miss entire subsystems or produce non-reproducible crashes. ## Overview The harness is the bridge between the fuzzer's random byte generation and your application's API. It must parse raw bytes into meaningful inputs, call target functions, and handle edge cases gracefully. The most important part of any fuzzing setup is the harness—if written poorly, critical parts of your application may not be covered. ### Key Concepts | Concept | Description | |---------|-------------| | **Harness** | Function that receives fuzzer input and calls target code under test | | **SUT** | System Under Test—the code being fuzzed | | **Entry point** | Function signature required by the fuzzer (e.g., `LLVMFuzzerTestOneInput`) | | **FuzzedDataProvider** | Helper class for structured extraction of typed data from raw bytes | | **Determinism** | Property that ensures same input always produces same behavior | | **Interleaved fuzzing** | Single harness that exercises multiple operations based on input | ## When to Apply **Apply this technique when:** - Creating a new fuzz target for the first time - Fuzz campaign has low code coverage or isn't finding bugs - Crashes found during fuzzing are not reproducible - Target API requires complex or structured inputs - Multiple related functions should be tested together **Skip this technique when:** - Using existing well-tested harnesses from your project - Tool provides automatic harness generation that meets your needs - Target already has comprehensive fuzzing infrastructure ## Quick Reference | Task | Pattern | |------|---------| | Minimal C++ harness | `extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)` | | Minim