Fuzzing
Nuclei uses go-fuzz for targeted harnesses behind the gofuzz build tag.
Targets
The Makefile exposes these go-fuzz targets:
Required variable:
GOFUZZ_PACKAGE: any package path thatgo listcan resolve from the repo root. The normal form in this repo is a relative package path such as./pkg/operators/matchers.
build-fuzz, fuzz, and fuzz-ci derive everything else from that package path:
workdir:
<package>/.gofuzz/seed corpus:
<package>/testdata/gofuzz-corpus/instrumented archive:
<package>/.gofuzz/<pkgname>-fuzz.zip
discover-fuzz-packages emits the GitHub Actions matrix JSON to stdout, and writes matrix=... to GITHUB_OUTPUT when that file is present.
fuzz-ci wraps make fuzz in the CI timeout.
build-fuzz and fuzz fail immediately if GOFUZZ_PACKAGE is missing, the package cannot be resolved, or the seed corpus directory is missing or empty.
Examples
Operators (matchers & extractors) harness:
Harness Coverage:
Matchers exercise Matcher.CompileMatchers() through a compact line-based grammar. Supported keys are:
typeconditionpartencodingnegativecase-insensitivematch-allnamevaluestatussize
Extractors exercise Extractor.CompileExtractors() and the matching extraction path with fixed local corpora. Supported keys are:
typepartnameinternalcase-insensitivegroupattributevalueregexkvaljsonxpathdsl
Artifacts
Each run writes under <package>/.gofuzz/:
corpus/: evolving seed corpus used bygo-fuzz.crashers/: saved crashing inputs.*-fuzz.zip: the instrumented build output created bygo-fuzz-build.
Promote real crashers into ordinary regression tests in the owning package once the underlying issue is fixed.
GitHub Actions
The repository also has a dedicated GitHub Actions fuzz workflow in .github/workflows/fuzz.yaml.
Triggers:
workflow_dispatchand a weeklyschedule.Scheduled runs: limited to
projectdiscovery/nuclei; manual dispatch still works in forks.Matrix source: any package that has committed seeds under
testdata/gofuzz-corpus/and a siblingfuzz.goharness.Current package matrix:
./pkg/operators/matchersand./pkg/operators/extractors.Runtime model: discovery runs
make discover-fuzz-packages, and each package runsCI=true make fuzz-ci GOFUZZ_PACKAGE=... FUZZ_DURATION=15m.Artifacts: each matrix job uploads the full
<package>/.gofuzz/as the artifacts.Failure policy: crashers are summarized and uploaded, but they do not fail the workflow; build/setup errors still fail the job.