agentic-actions-audito…
Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI, OpenAI Codex, and GitHub AI…
Sets up and runs cargo-fuzz, the standard fuzzing tool for Cargo-based Rust projects. Covers cargo fuzz init, the nightly toolchain requirement, fuzz_target! harnesses, Arbitrary-derived structured inputs, sanitizer options, cargo fuzz coverage, and reproducing a crash artifact.
$ npx -y skills add trailofbits/skills --skill cargo-fuzz --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/cargo-fuzzContext preview
The summary Claude sees to decide when to auto-load this skill.
Sets up and runs cargo-fuzz, the standard fuzzing tool for Cargo-based Rust projects. Covers cargo fuzz init, the nightly toolchain requirement, fuzz_target! harnesses, Arbitrary-derived structured inputs, sanitizer options, cargo fuzz coverage, and reproducing a crash artifact.
name: cargo-fuzz type: fuzzer description: "Sets up and runs cargo-fuzz, the standard fuzzing tool for Cargo-based Rust projects. Covers cargo fuzz init, the nightly toolchain requirement, fuzz_target! harnesses, Arbitrary-derived structured inputs, sanitizer options, cargo fuzz coverage, and reproducing a crash artifact. Use when fuzzing a Rust crate, writing a fuzz_target!, exercising unsafe blocks or FFI in Rust, or triaging a cargo fuzz crash."
cargo-fuzz is the de facto choice for fuzzing Rust projects when using Cargo. It uses libFuzzer as the backend and provides a convenient Cargo subcommand that automatically enables relevant compilation flags for your Rust project, including support for sanitizers like AddressSanitizer.
cargo-fuzz is currently the primary and most mature fuzzing solution for Rust projects using Cargo.
| Fuzzer | Best For | Complexity | |--------|----------|------------| | cargo-fuzz | Cargo-based Rust projects, quick setup | Low | | AFL++ | Multi-core fuzzing, non-Cargo projects | Medium | | LibAFL | Custom fuzzers, research, advanced use cases | High |
**Choose cargo-fuzz when:**
#![no_main]
use libfuzzer_sys::fuzz_target;
fn harness(data: &[u8]) {
your_project::check_buf(data);
}
fuzz_target!(|data: &[u8]| {
harness(data);
});Initialize and run:
cargo fuzz init # Edit fuzz/fuzz_targets/fuzz_target_1.rs with your harness cargo +nightly fuzz run fuzz_target_1
cargo-fuzz requires the nightly Rust toolchain because it uses features only available in nightly.
# Install nightly toolchain rustup install nightly # Install cargo-fuzz cargo install cargo-fuzz
cargo +nightly --version cargo fuzz --version
cargo-fuzz works best when your code is structured as a library crate. If you have a binary project, split your `main.rs` into:
src/main.rs # Entry point (main function) src/lib.rs # Code to fuzz (public functions) Cargo.toml
Initialize fuzzing:
cargo fuzz init
This creates:
fuzz/
├── Cargo.toml
└── fuzz_targets/
└── fuzz_target_1.rs#![no_main]
use libfuzzer_sys::fuzz_target;
fn harness(data: &[u8]) {
// 1. Validate input size if needed
if data.is_empty() {
return;
}
// 2. Call target function with fuzz data
your_project::target_function(data);
}
fuzz_target!(|data: &[u8]| {
harness(data);
});| Do | Don't | |----|-------| | Structure code as library crate | Keep everything in main.rs | | Use `fuzz_target!` macro | Write custom main function | | Handle `Result::Err` gracefully | Panic on expected errors | | Keep harness deterministic | Use random number generators |
> **See Also:** For detailed harness writing techniques and structure-aware fuzzing with the > `arbitrary` crate, see the **fuzz-harness-writing** technique skill.
cargo-fuzz integrates with the [arbitrary](https://github.com/rust-fuzz/arbitrary) crate for structure-aware fuzzing:
// In your library crate
use arbitrary::Arbitrary;
#[derive(Debug, Arbitrary)]
pub struct Name {
data: String
}// In your fuzz target
#![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: your_project::Name| {
data.check_buf();
});Add to your library's `Cargo.toml`:
[dependencies]
arbitrary = { version = "1", features = ["derive"] }cargo +nightly fuzz run fuzz_target_1
If your project doesn't use unsafe Rust, disable sanitizers for 2x performance boost:
cargo +nightly fuzz run --sanitizer none fuzz_target_1
Check if your project uses unsafe code:
cargo install cargo-geiger cargo geiger
# Run a specific test case (e.g., a crash) cargo +nightly fuzz run fuzz_target_1 fuzz/artifacts/fuzz_target_1/crash-<hash> # Run all corpus entries without fuzzing cargo +nightly fuzz run fuzz_target_1 fuzz/corpus/fuzz_target_1 -- -runs=0
cargo +nightly fuzz run fuzz_target_1 -- -dict=./dict.dict
| Output | Meaning | |--------|---------| | `NEW` | New coverage-increasing input discovered | | `pulse` | Periodic status update | | `INITED` | Fuzzer initialized successfully | | Crash with stack trace | Bug found, saved to `fuzz/artifacts/` |
Corpus location: `fuzz/corpus/fuzz_target_1/` Crashes location: `fuzz/artifacts/fuzz_target_1/`
ASan is enabled by default and detects memory errors:
cargo +nightly fuzz run fuzz_target_1
For pure safe Rust (no unsafe blocks in your code or dependencies):
cargo +nightly fuzz run --sanitizer none fuzz_target_1
**Performance impact:** ASan adds ~2x overhead. Disable for safe Rust to improve fuzzing speed.
cargo install cargo-geiger cargo geiger
> **See Also:** For detailed sanitizer configuration, flags, and troubleshooting, > see the **address-sanitizer** technique skill.
cargo-fuzz integrates with Rust's coverage tools to analyze fuzzing effectiveness.
rustup toolchain install nightly --component llvm-tools-preview cargo install cargo-binutils cargo install rustfilt
# Generate coverage data from corpus cargo +nightly fuzz c
A Claude Code plugin marketplace from Trail of Bits providing skills to enhance AI-assisted security analysis, testing, and development workflows. Codex can load this marketplace through its Claude marketplace compatibility.
Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI, OpenAI Codex, and GitHub AI…
Understand a codebase before looking for bugs in it - what each function assumes, what it guarantees, and what it depends on elsewhere. Use when starting an…
Scans Algorand smart contracts for 11 common vulnerabilities including rekeying attacks, unchecked transaction fees, missing field validations, and access…
Prepares codebases for security review using Trail of Bits' checklist. Helps set review goals, runs static analysis tools, increases test coverage, removes…
Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithmetic overflow, L1-L2 messaging issues, address conversion problems,…
Systematic code maturity assessment using Trail of Bits' 9-category framework. Analyzes codebase for arithmetic safety, auditing practices, access controls,…