Fuzzing is a type of automated testing which continuously manipulates inputs to a program to find bugs. Since fuzzing can reach edge cases which humans often miss, fuzz testing can be particularly valuable for finding security exploits and vulnerabilities.

Go supports fuzzing in its standard toolchain beginning in Go 1.18. It uses coverage guidance to intelligently walk through the code being fuzzed to find and report failures to the user.

The testing package docs describes the testing.F type which is used when writing fuzz tests, and the cmd/go package docs describe the flags associated with fuzzing.

For an introductory tutorial for fuzzing with Go, please see Blog: Fuzzing is Beta Ready.

See the design draft and proposal for additional details.

Glossary

corpus entry: An input in the corpus which can be used while fuzzing. This can be a specially-formatted file, or a call to (*testing.F).Add.

coverage guidance: A method of fuzzing which uses expansions in code coverage to determine which corpus entries are worth keeping for future use.

fuzz target: The function of the fuzz test which is executed for corpus entries and generated values while fuzzing. It is provided to the fuzz test by passing the function to (*testing.F).Fuzz.

fuzz test: A function in a test file of the form func FuzzXxx(*testing.F) which can be used for fuzzing.

fuzzing: A type of automated testing which continuously manipulates inputs to a program to find issues such as bugs or vulnerabilities to which the code may be susceptible.

fuzzing engine: A tool that manages fuzzing, including maintaining the corpus, invoking the mutator, identifying new coverage, and reporting failures.

generated corpus: A corpus which is maintained by the fuzzing engine over time while fuzzing to keep track of progress. It is stored in $GOCACHE/fuzz.

mutator: A tool used while fuzzing which randomly manipulates corpus entries before passing them to a fuzz target.

package: A collection of source files in the same directory that are compiled together. See the Packages section in the Go Language Specification.

seed corpus: A user-provided corpus for a fuzz test which can be used to guide the fuzzing engine. It is composed of the corpus entries provided by f.Add calls within the fuzz test, and the files in the testdata/fuzz/{FuzzTargetName} directory within the package.

test file: A file of the format xxx_test.go that may contain tests, benchmarks, examples and fuzz tests.

vulnerability: A security-sensitive weakness in code which can be exploited by an attacker.