What is fuzz testing? How fuzzing finds security bugs

Fuzzing feeds a program malformed input to find crashes and security bugs. How it works, the main types, tools such as AFL++ and libFuzzer, and when it pays off.
Back to blog

What is fuzz testing? How fuzzing finds security bugs

Short answer

Fuzz testing, or fuzzing, is an automated technique that feeds a program large amounts of malformed, unexpected or random input and watches for crashes, hangs and memory errors. It finds the input-handling bugs that hand-written tests miss, which is why it is used on parsers, file formats, network protocols and APIs.

Fuzzing is cheap to start and keeps paying back. You write a small harness that hands bytes to the code you care about, then let a fuzzer mutate those bytes for hours. Anything that crashes the target is a reproducible bug, and some of those bugs are exploitable. Below: how it works, the main types, the tools worth knowing, and where it fits next to penetration testing and static analysis.

Desk and laptops in the BetterQA office in Cluj-Napoca
Article details

Question
What is fuzz testing?

Audience
Developers, testers and security leads

Standards cited
OWASP, NIST IR 8397

BetterQA team
50+ engineers, founded 2018

How fuzz testing works, step by step

Every fuzzing setup follows the same loop. The details change with the tool and the language, the loop does not.

  1. Pick a target that takes untrusted input. Parsers, decoders, file importers, protocol handlers and API endpoints are the usual candidates. Code that never sees outside data is a poor first choice.
  2. Write a harness. A short function that takes a byte array and passes it to the code under test. With libFuzzer this is one function; with AFL++ it can be a program that reads a file.
  3. Add a seed corpus. A handful of valid inputs (real files, real requests) gives the fuzzer something sensible to mutate. A fuzzer started on empty input works, but reaches deep code more slowly.
  4. Build with sanitizers. AddressSanitizer and UndefinedBehaviorSanitizer turn silent memory corruption into a visible crash, so the fuzzer can tell it happened.
  5. Run and watch coverage. A coverage-guided fuzzer keeps every input that reaches new code and mutates those further. A flat coverage line means the harness or the seeds need work.
  6. Triage the crashes. Deduplicate by stack trace, minimise the triggering input, decide whether it is exploitable, and report it with the input attached.
  7. Keep the fix honest. Add the crashing input to the regression suite and run the fuzzer again in continuous integration, so the same bug cannot come back unnoticed.

Where the idea comes from. The term was coined by Barton Miller and his students at the University of Wisconsin in the late 1980s, who fed random input to UNIX command-line tools and found that many of them crashed or hung. Their results were published in 1990 in Communications of the ACM.

Types of fuzzing

Fuzzers differ along three axes: how much they know about the target, how they make inputs, and what feedback they use.

By knowledge of the target

  • Black-box fuzzing. Sends inputs and watches the outside behaviour only. Works on anything you can run, but wanders blindly.
  • Grey-box fuzzing. Uses light instrumentation to see which code each input reached. This is what AFL++ and libFuzzer do, and it is the common default.
  • White-box fuzzing. Uses program analysis, for example symbolic execution, to work out inputs that reach a specific branch. Powerful, and slower per input.

By how inputs are made

  • Mutation-based. Takes valid samples and flips bits, changes bytes, truncates or splices them. Easy to start, needs good seeds.
  • Generation-based (grammar-based). Builds inputs from a description of the format or protocol. Reaches deeper into strict formats such as network protocols and structured documents.

By feedback

  • Random (dumb) fuzzing. No feedback at all. Simple, and it explores very little.
  • Coverage-guided fuzzing. Keeps the inputs that reach new code and builds on them. It is the main reason modern fuzzers find deep bugs.

Fuzzing tools worth knowing

No single tool fits every language. Pick by what you are testing.

Tool Best for What to know
AFL++ C and C++ programs, including binary-only targets Community-maintained successor to American Fuzzy Lop, with custom mutators and many instrumentation modes
libFuzzer Libraries, in the same process Part of LLVM. You write one fuzz target function and compile with sanitizers
Honggfuzz Memory corruption and crashes in native code Feedback-driven, with a persistent mode that avoids restarting the target
OSS-Fuzz Open-source projects Google service that runs fuzzers continuously for projects that join it, using libFuzzer, AFL++ and others
Go native fuzzing Go packages Built into the go test tool since Go 1.18
Jazzer and Atheris Java and Python code Coverage-guided fuzzers that plug into the libFuzzer engine
RESTler and Schemathesis REST APIs Generate requests from an OpenAPI description and look for server errors and broken contracts
Boofuzz Network protocols Python framework for describing a protocol and fuzzing it over a socket

Web applications need a different approach to binaries. Fuzz the API contract with a tool like Schemathesis, and write harnesses for the parsers and validators behind the endpoints.

Fuzzing compared with other security testing

Fuzzing does not replace the other methods. Each finds a different class of problem.

Fuzz testing Penetration testing Static analysis
How it works Runs the code with generated input A person attacks the running system Reads the code without running it
Best at finding Memory corruption, parsing bugs, crashes, hangs Business-logic flaws, access control gaps, misconfiguration Known bad patterns, hard-coded secrets, unsafe calls
Blind spots Logic that does not crash, such as a wrong permission check Depth in a single parser; limited by time Reports that need triage; cannot see runtime state
Effort to start A harness per target A scoped engagement A scanner in the pipeline
Runs Continuously, in CI Per release or per year On every commit

NIST lists fuzzing among the verification techniques developers should apply (NIST IR 8397, 2021). We treat it as one layer: static analysis early, fuzzing on input-handling code, and manual penetration testing for the logic a fuzzer cannot judge.

When fuzzing is, and is not, worth it

Worth it: code that parses data from outside your trust boundary, native code in C or C++ where memory errors are possible, libraries other products depend on, and anything with a strict binary or text format.

Less useful: pure business logic with no unusual input handling, and code in memory-safe languages whose worst outcome is an exception. Fuzzing still finds logic crashes and denial-of-service paths there, but the security payoff is smaller.

Limits to plan for. Fuzzing finds what crashes or trips a sanitizer. It will not tell you that a discount was applied twice or that a user can read another user’s record. A fuzzer also needs time and a CPU budget, and results depend heavily on the quality of the harness and seeds.

How we use fuzzing on client work

BetterQA is an independent QA company: we test and do not build, so we have no stake in the code we attack. When a client’s product handles untrusted input, we add fuzzing to the security testing plan next to manual testing and our own AI Security Toolkit, then hand over each crash with the input that triggers it and the steps to reproduce.

If you want a team to set this up and read the results, our security testing service covers the scoping, the testing and the report.

Frequently asked questions

It is automated testing with junk. A tool throws huge numbers of broken, odd or random inputs at a program and records every time the program crashes, hangs or breaks a memory-safety check. Each recorded input is a reproducible bug report.

Mostly memory-safety bugs such as buffer overflows and use-after-free, plus unhandled exceptions, infinite loops, assertion failures and resource exhaustion. It is strongest on code that parses untrusted data.

Fuzzing is automated and repeats the same loop at high volume against one target. Penetration testing is a person reasoning about how the whole system can be abused. Fuzzers miss logic flaws; testers cannot try millions of malformed inputs by hand.

There is no fixed number. Run each target until coverage stops growing, then keep it running in continuous integration so new code is fuzzed too. Bugs often turn up only after days of execution, once the fuzzer reaches deeper paths.

Yes. API fuzzers such as RESTler and Schemathesis generate requests from an OpenAPI description and look for server errors. For server-side code, write harnesses for the parsers and validators behind the endpoints.

Random testing sends arbitrary input with no feedback. Modern fuzzing is coverage-guided: it keeps inputs that reach new code, mutates them further, and uses sanitizers to catch memory errors that would not crash the program on their own.

Where this comes from

OWASP, Fuzzing. NIST IR 8397, Guidelines on Minimum Standards for Developer Verification of Software (2021). LLVM, libFuzzer documentation. Google, OSS-Fuzz documentation. AFL++ project. B. P. Miller, L. Fredriksen and B. So, An empirical study of the reliability of UNIX utilities, Communications of the ACM, 1990.

Want fuzzing set up on your product?

Tell us what you are testing and what input it takes. We will tell you whether fuzzing is worth it for it.

Book a call
Security testing service

Automate your security testing

Our AI Security Toolkit runs 20 checks we wrote ourselves alongside 15 open-source scanners to find vulnerabilities other scanners miss. SAST, DAST, SCA, secrets detection - unified in one scan.

Explore AI Security Toolkit
Share the Post: