google/oss-fuzz/fuzzing-rust-expert
Claude Code and agent skill by google/oss-fuzz
- vendor
Checking that the SKILL.md file is still in the repository.
Use this skill to fuzz open source Rust software projects.
Install
npx vskill@latest install google/oss-fuzz/fuzzing-rust-expertSKILL.md
Fuzzing Rust expert
This skill provides the agent with the knowledge and tools to write, build, and validate fuzz targets for Rust projects integrated into OSS-Fuzz. Rust fuzzing uses cargo-fuzz with the libfuzzer_sys crate, which drives libFuzzer.
Fundamental Concepts
OSS-Fuzz base image
Rust projects must use the Rust base builder image:
Set language: rust in project.yaml.
Harness structure
Rust fuzz targets live in fuzz/fuzz_targets/<name>.rs within the crate being fuzzed. The minimal harness using raw bytes:
For structured fuzzing using the arbitrary crate (preferred when the target expects typed input):
The Cargo.toml for the fuzz directory must declare dependencies:
Building in OSS-Fuzz
build.sh uses cargo fuzz build and then copies binaries to $OUT:
If the project requires a nightly toolchain, set it in the Dockerfile:
Or pin to a specific nightly for reproducibility:
Seed corpus and dictionaries
- Place seed files in
fuzz/corpus/<target_name>/within the repo; they are
automatically picked up by cargo-fuzz and can be zipped for OSS-Fuzz.
- To ship a corpus with OSS-Fuzz copy a zip to
$OUT/<target_name>_seed_corpus.zip. - Dictionaries go to
$OUT/<target_name>.dict. - For targets that parse a structured format, generating seeds with a script
beats hand-picking a few files — random mutation rarely passes the parser's early checks (note: cargo-fuzz's arbitrary is the better route when the target takes typed data rather than a byte format). See the structured seed generation reference.
Characteristics of good Rust fuzzing harnesses
- Targets attack surface: parsers, deserializers, protocol implementations,
unsafe blocks, and any API that processes untrusted bytes.
- Uses structured fuzzing (
arbitrary) when the target expects typed data
rather than raw bytes — this dramatically improves coverage.
- Handles expected errors:
ResultandOptionshould be let-bound and
ignored (let _ = ...). Only actual panics are findings.
- Avoids panicking on every input: do not use
.unwrap()or.expect()
on fallible operations driven by fuzz input — these create false positives.
- Avoids non-determinism: no
rand, no system time, no thread spawning
inside the fuzz callback.
- Is fast: avoid I/O, heavy allocations, or expensive setup inside the
callback; do those outside the fuzz_target! macro if needed with LazyLock / OnceLock.
- Considers `unsafe` code: if the crate has
unsafeblocks, write
harnesses that exercise those paths — this is where memory bugs can still occur in Rust.
- Builds in release mode (
-O): fuzzing in debug mode is much slower.
What Rust fuzzing finds
Rust's ownership model prevents most memory-corruption bugs, but fuzzing still finds:
- Panics:
unwrap/expectonNone/Err, index out of bounds,
arithmetic overflow in debug mode, explicit panic! calls.
- `unsafe` bugs: use-after-free, out-of-bounds reads/writes, undefined
behaviour in unsafe blocks — these are real memory bugs.
- Logic errors: incorrect parsing, data corruption, wrong output.
- Hangs: infinite loops triggered by crafted input.
- Stack overflows: deep recursion on adversarial input.
Operational guidelines
- Always validate with:
`` python3 infra/helper.py build_fuzzers <project> python3 infra/helper.py check_build <project> python3 infra/helper.py run_fuzzer <project> <fuzzer_name> -- -max_total_time=30 ``
- An instant crash usually means a
panic!on every input — check for
.unwrap() calls on fuzz-driven paths and replace with if let or ?.
- Run
cargo buildandcargo testinside the crate before adding the fuzz
harness to catch pre-existing compilation errors.
- When iterating locally clone the upstream repo and switch the Dockerfile from
RUN git clone to COPY to avoid network round-trips.
- If the crate uses
no_std, uselibfuzzer-sys'sno_stdfeature and ensure
the harness does not rely on std.
- Document why each entry point was chosen and what class of bugs it may find.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 1 Oct 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinginfra/experimental/agent-skills/fuzzing-rust-expert/SKILL.md
Popularity
- Repository stars
- 12,684
- Repository forks
- 2,913
- 7-day trend score
- 47
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/google/oss-fuzz/fuzzing-rust-expert)