Static analysis and fuzzing both promise to find security bugs before release, but they find different bugs, fail in different ways and cost different things, so treating one as a substitute for the other leaves predictable gaps. Static analysis reasons about code without running it and reports possible weaknesses; fuzzing runs the code with huge volumes of generated input and reports actual failures. This guide compares the two by bug class, false positive and false negative profile, CI cost and language fit, then shows how to combine them using coverage data so each covers what the other misses. It is for AppSec leads, security engineers and engineering managers deciding where the next unit of testing effort should go. For fuzzing mechanics in depth, see the Fuzzing Guide; for the wider static versus runtime debate, see SAST vs DAST.
Key takeaways
- They answer different questions. Static analysis asks "could any path through this code reach a dangerous state?", fuzzing asks "here is an input that actually breaks it", so one produces warnings and the other produces reproducible test cases.
- Bug classes split cleanly. Static analysis is strongest on injection flows, hardcoded secrets, unsafe API use and coding standard violations; fuzzing is strongest on memory corruption, crashes, hangs and parser logic in input handling code.
- The error profiles are mirror images. Static tools over-report (false positives) and cannot tell if a weakness is mitigated; fuzzers rarely report false bugs but silently miss every path they never reach (false negatives).
- Cost sits in different places. Static analysis costs triage time per finding; fuzzing costs harness engineering up front and compute time continuously, and pays back best at scale.
- Coverage is the join. Fuzzing coverage reports show which code has never been exercised, which is exactly where static findings deserve the most attention and where new harnesses should go next.
What each technique actually does
NIST's minimum standards for developer verification, NISTIR 8397, lists both as separate required techniques rather than alternatives: use a code scanner to look for top bugs, use heuristic tools to look for hardcoded secrets, and, under dynamic analysis, run a fuzzer. The distinction NIST draws is that static analysis is code based and independent of program execution, while fuzzing is automatic active testing that creates huge numbers of inputs.
Static analysis
A static analyser parses source or binary code into a model (syntax tree, control flow graph, data flow graph) and searches that model for patterns. Simple rules match syntax, such as a call to a banned function. Stronger engines run data flow and taint tracking: they mark untrusted inputs as sources, dangerous operations as sinks, and report paths where tainted data reaches a sink without passing a sanitiser. CodeQL's documentation describes the trade-off engineers live with: local data flow inside one function is fast and precise enough for many queries, while global data flow across functions and object properties sees more of the program but is more resource intensive. Taint tracking also follows derived values, which widens what is caught and widens what is over-reported.
Fuzzing
A fuzzer feeds generated inputs to a target and watches for a bug oracle to fire: a crash, a hang, a sanitizer report, an assertion or, for APIs, a server error. Coverage-guided engines such as libFuzzer instrument the build, keep inputs that reach new code and mutate them further, so the corpus grows towards deeper paths over time. The input that triggered a failure is saved, minimised and replayed, which is why NISTIR 8397 notes that fuzzing "typically produces actual positive tests for bugs, not just static warnings".
Side-by-side comparison
| Dimension | Static analysis | Fuzzing |
|---|---|---|
| Needs the program to run | No; some tools need a successful build, others work on source text | Yes; needs a build, a harness and usually instrumentation |
| Output | Warnings with file, line and data flow trace | A crashing or failing input plus stack trace and sanitizer report |
| Typical false positives | Many; tools cannot tell if a weakness is mitigated elsewhere | Few; a crash with a reproducer is a real defect, though not always exploitable |
| Typical false negatives | Bug classes with no rule, flows through reflection, frameworks or unmodelled libraries | Any code the corpus never reaches; logic errors that do not crash |
| When it can start | As soon as code is written, including in the IDE | Once a callable interface and harness exist |
| Main cost | Triage and suppression management per finding | Harness writing, compute hours, crash deduplication |
| Scaling behaviour | Scans whole repositories repeatedly at predictable cost | Best results at scale and over long runs |
| Best evidence for auditors | Scan reports, rule sets, suppression justifications | Coverage reports, corpus growth, regression tests from fixed crashes |
Bug classes each finds
The most useful way to allocate effort is by the weakness classes your codebase is exposed to. The table below reflects the strengths and limits stated by NIST and OWASP, plus common practitioner experience; treat it as a starting profile and adjust with your own findings data.
| Bug class | Static analysis | Fuzzing | Notes |
|---|---|---|---|
| Buffer overflows, out-of-bounds reads and writes, use after free | Partial: finds common patterns, many false positives in complex pointer code | Strong with AddressSanitizer, which reports out-of-bounds access even without a crash | Fuzzing plus sanitizers is the default answer for memory-unsafe parsers |
| Integer overflow and undefined behaviour | Partial | Strong with UndefinedBehaviorSanitizer | Static rules help find candidate arithmetic; fuzzing proves reachability |
| SQL, command and template injection | Strong via taint tracking from request to query or shell call | Weak unless the oracle detects injected behaviour | Injection does not crash, so a plain fuzzer sees nothing |
| Cross-site scripting | Strong for reflected and stored flows the engine models | Weak at unit level; better covered by DAST | See SAST vs DAST |
| Hardcoded secrets and keys | Strong with secret detection rules | None | NISTIR 8397 notes dynamic testing is unlikely to uncover them |
| Denial of service: hangs, infinite loops, memory exhaustion | Weak | Strong; timeouts and memory limits are built-in oracles | Go native fuzzing applies a one second limit per execution by default |
| Deserialisation and parser logic errors | Partial: flags unsafe deserialisation APIs | Strong where the harness feeds the parser directly | Structure-aware fuzzing gets past format checks |
| Race conditions | Partial: some engines flag shared state access | Partial: failures may not reproduce in threaded code | Pair either with a thread sanitizer in testing |
| Authentication, access control and crypto misuse | Weak: NIST and OWASP both name these as hard to find | Weak | Needs threat modelling, design review and manual testing |
| Configuration and deployment errors | Weak: usually not represented in code | None | Use configuration and infrastructure scanning |
False positive and false negative profiles
The two techniques fail in opposite directions, and that should shape how you read their results.
- Static false positives: NISTIR 8397 says that in almost all tools some warnings are false positives and some are insignificant in context, and that tools usually cannot determine whether a weakness is mitigated. OWASP describes high numbers of false positives as a known weakness. Every warning needs a human decision, and untriaged backlogs teach developers to ignore the tool. The SAST Triage Guide covers how to run that process.
- Static false negatives: a static tool only finds what its rules and models describe. Dynamic dispatch, reflection, code generation, framework magic and third-party libraries without models all create blind spots that produce a clean report rather than an error. OWASP notes tools find only a relatively small percentage of application security flaws.
- Fuzzing false positives: rare in the sense of "no bug exists", but common in the sense of "not a security issue". A harness that violates the API contract, for example passing a null pointer the real caller never passes, produces crashes that are harness bugs. Duplicate crashes from one root cause also inflate counts until deduplicated.
- Fuzzing false negatives: the dominant failure mode. A fuzzer is silent about every path it never executes and every bug that does not trip its oracle. NISTIR 8397 notes that only a tiny fraction of inputs trigger problems and that unguided fuzzing typically explores execution paths shallowly. Silence from a fuzzer is evidence about covered code only.
The rule that follows: a clean static report is weak evidence, a static finding is a hypothesis; a fuzzer crash is strong evidence, a quiet fuzzer is evidence only for the lines it reached.
CI cost and where each runs
Both fit in a pipeline, but they want different slots.
| Stage | Static analysis | Fuzzing |
|---|---|---|
| IDE and pre-commit | Fast syntactic rules and secret detection, immediate feedback | Seed corpus replay as ordinary unit tests (Go runs testdata/fuzz entries on every go test) |
| Pull request | Incremental or diff-aware scan; block only on high confidence rules | Short code change fuzzing for minutes per target, using the corpus from batch runs |
| Main branch or nightly | Full scan with global data flow and the complete rule pack | Batch fuzzing for hours to deepen the corpus and find slower bugs |
| Continuous | Rule pack updates rerun against the codebase | Long-running fuzzing on dedicated infrastructure; corpus pruning and coverage reports |
- Static cost model: compute is modest and predictable; the expensive resource is people. Budget triage time per new rule pack and per repository onboarded, and expect the first full scan of a legacy repository to need a baseline and suppression exercise before gating anything.
- Fuzzing cost model: the expensive resources are the first harness for each target (engineer days) and compute over time. Sanitizers such as AddressSanitizer add significant overhead, so sanitised fuzz builds are separate build configurations. NISTIR 8397 describes fuzzing as computationally intensive and best at scale.
- Tooling reality: ClusterFuzzLite runs code change fuzzing, batch fuzzing and coverage reports in GitHub Actions, GitLab, Google Cloud Build and Prow, for C, C++, Java and other JVM languages, Go, Python, Rust and Swift. For open source projects, OSS-Fuzz runs libFuzzer, AFL++, Honggfuzz and Centipede; Google reported over 10,000 vulnerabilities and 36,000 bugs found across 1,000 projects as of August 2023.
- Engine maintenance: check the status of the engine you standardise on. LLVM's libFuzzer page says its original authors moved to Centipede and libFuzzer now receives important bug fixes rather than major features.
Language and target fit
- C and C++: fuzzing with sanitizers delivers the most value here because memory errors are both the most likely and the most severe class. Static analysis still earns its place for banned functions, format strings and coding standard enforcement. See the Memory-Safe Languages Guide for the longer-term fix.
- Rust and Go: memory safety removes most corruption bugs from safe code, so fuzzing shifts to panics, hangs, resource exhaustion and logic errors, plus
unsafeblocks and FFI boundaries. Go has native fuzzing since Go 1.18; its coverage-guided mode currently works only on AMD64 and ARM64. - Java, C#, Python, JavaScript web services: injection, deserialisation and authorisation flaws dominate, so taint-tracking static analysis usually comes first. Fuzzing pays off for custom parsers, file upload handling and libraries that process documents or images.
- Binaries and third-party components without source: source-based static analysis is unavailable; binary analysis exists but is noisier. Binary-only fuzzing modes work but run much slower than compile-time instrumentation.
- APIs and protocols: stateful API fuzzing and protocol fuzzing reach code that unit harnesses cannot, but need a safe test environment because they can damage data. Static analysis of the service code covers the logic behind the endpoints.
Where identity fits
Two identity points are specific to this comparison. First, hardcoded credentials, API keys and private keys in source are a static analysis job that no fuzzer will ever find; pair code scanning with dedicated secret detection and the practices in the Secrets Management Guide. Second, continuous fuzzing and scanning services need repository read tokens, CI service accounts and storage credentials for corpora and crash artefacts. Crash reports can contain memory contents from the process under test, so scope those identities narrowly, keep crash artefacts in access-controlled storage and rotate the tokens like any other non-human identity. The Securing the SAST, SCA and code scanning tool itself page covers hardening the scanner side.
Combining them with coverage
Coverage data is what connects the two.
- Map the attack surface: list the components that parse untrusted input, from the threat model. These are fuzzing candidates; everything else starts with static analysis only.
- Run static analysis everywhere first: it is cheap to start, needs no harness and gives an initial weakness map. Gate pull requests on a small set of high confidence rules only.
- Write harnesses for the top input handlers: start with the parsers and decoders that static analysis flagged most often or that handle the most exposed input.
- Read the fuzzing coverage report: identify functions in attack surface components that the fuzzer never reaches. NISTIR 8397 sets a separate target of at least 80 percent structural coverage for test suites; fuzzing coverage tells you how far below that the security-relevant code is.
- Prioritise static findings by coverage: a static warning in code the fuzzer exercises heavily without failures is lower priority; a warning in unreached attack surface code is higher priority and a sign a new harness or seed is needed.
- Use static findings to aim fuzzers: when a static rule flags a suspicious copy or arithmetic operation, write or extend a harness that reaches it; a crash confirms the finding, and a fixed crash becomes a regression test.
- Feed results back: each confirmed bug class becomes a static rule where possible, and every fixed crash input joins the seed corpus, so both tools learn from each finding.
Rollback is simple for both: static gates can be moved back to report-only mode per rule, and fuzz jobs can be made non-blocking without losing their corpus.
Threat model, failure modes and decision criteria by option
Static analysis
- Threat model: attacker-controlled data flowing to dangerous operations, insecure API use, secrets committed to source, and coding standard drift across many developers.
- Architecture in words: a build or source extraction step produces a code database; a rule engine evaluates rules against it; results are exported (commonly as SARIF) to the code host, where findings are deduplicated against a baseline and shown on pull requests.
- Failure modes: alert fatigue from untuned rule packs; suppressions without justification; scans that silently skip code that failed to build; treating a clean report as proof of safety.
- Controls: curated rule sets per language, baseline plus new-findings-only gating, reviewed suppressions with expiry, build success checks on the scan step.
- Choose it first when: the codebase is mostly managed-language web services, the main risks are injection and secrets, or you need organisation-wide coverage fast.
Fuzzing
- Threat model: malformed or hostile input to parsers, decoders and protocol handlers causing memory corruption, crashes or resource exhaustion.
- Architecture in words: an instrumented, sanitised build links a harness to the target function; an engine mutates a seed corpus and records coverage; batch jobs grow and prune the corpus; pull request jobs replay it and fuzz briefly; crashes are deduplicated, minimised and filed with reproducers.
- Failure modes: harnesses that never get past checksums or magic bytes; no sanitizers so memory errors pass silently; flaky, stateful harnesses; crashes left unfixed; nobody reading coverage.
- Controls: structure-aware harnesses or dictionaries, sanitizer builds, deterministic targets, a crash ownership process with service levels, coverage review per release.
- Choose it first when: the product ships C or C++ parsers, handles files, media or network protocols from untrusted sources, or a single memory corruption bug would be critical.
Worked scenarios
- Document processing service in C++: a team runs static analysis and receives 1,400 warnings, mostly pointer arithmetic in the PDF and image decoders. They write three libFuzzer harnesses with AddressSanitizer for the decoders. Within the first batch runs the fuzzer reports heap overflows in two decoders, each with a reproducer. Coverage shows one decoder module unreached; its static warnings move to the top of the triage queue and a new harness is scheduled.
- Java payments API: the main risks are injection, deserialisation and authorisation. Taint-tracking static analysis on every pull request is the primary control, with secret detection alongside. Fuzzing is limited to the one custom message parser that reads partner files, and API-level testing covers runtime behaviour.
Detection and measurement
- Attack surface fuzz coverage: percentage of attack surface components with at least one harness, and line coverage achieved within them.
- Static finding precision: share of triaged static findings confirmed as true positives, per rule; retire or tune rules below an agreed threshold.
- Time to fix: median days from fuzz crash or confirmed static finding to merged fix, by severity.
- Regression protection: percentage of fixed crashes and confirmed static findings with a regression test in the suite.
- Escaped defects by class: security bugs found after release (by testers, bug bounty or incidents) mapped to whether static analysis or fuzzing should have caught them. This is the metric that tells you where to shift effort.
Common failure patterns
- Buying one and calling it done: a static scanner rarely proves a parser heap overflow, and a fuzzer never reports a hardcoded key.
- Gating on every static rule from day one: blocked pull requests and noisy findings lead to blanket suppressions, which removes the tool's value.
- Fuzzing without sanitizers: many memory errors corrupt silently and never crash, so the fuzzer reports nothing.
- Never reading coverage: a fuzzer stuck at the input validation layer runs for months finding nothing, and the quiet result is mistaken for safety.
- No owner for crashes and findings: results pile up in dashboards; both tools need a triage rota and fix service levels like any other vulnerability source.
- Ignoring what neither finds: authentication, access control and cryptography design flaws need threat modelling, secure code review and penetration testing.
Framework mapping
| Framework | Reference | Static analysis | Fuzzing |
|---|---|---|---|
| NIST SP 800-53 Rev. 5 | SA-11 Developer Testing and Evaluation | SA-11(1) Static Code Analysis | SA-11(8) Dynamic Code Analysis, which describes fuzz testing |
| NIST SP 800-53 Rev. 5 | SA-15 Development Process, Standards, and Tools | Tool selection and configuration | Tool selection and configuration |
| NIST SSDF (SP 800-218) | PW.7 and PW.8 | PW.7 Review and/or analyse human-readable code | PW.8 Test executable code |
| NISTIR 8397 | Minimum verification techniques | Code scanner and secret heuristics (Sec. 2.3, 2.4) | Run a fuzzer (Sec. 2.9) |
| NIST CSF 2.0 | PR.PS-06, ID.RA-01 | Secure development practice; vulnerabilities identified | Secure development practice; vulnerabilities identified |
| CIS Controls v8.1 | 16.12 Implement Code-Level Security Checks | Yes | Yes |
| ISO/IEC 27001:2022 Annex A | A.8.28 Secure coding; A.8.29 Security testing in development and acceptance | A.8.28 and A.8.29 | A.8.29 |
See the NIST Secure Software Development Framework (SSDF, SP 800-218) Guide for the wider practice set.
Practitioner checklist
- List attack surface components that parse untrusted input and mark each as a fuzzing candidate or static-only.
- Run static analysis on every repository with a curated rule set and a baseline; gate pull requests on high confidence rules only.
- Add secret detection alongside code scanning; fuzzing will not find credentials.
- Write a harness with sanitizers for each top-priority parser or decoder in memory-unsafe code.
- Run short fuzzing on pull requests and longer batch fuzzing nightly, sharing one corpus.
- Review fuzzing coverage each release and use unreached attack surface code to prioritise static triage and new harnesses.
- Turn every fixed crash and confirmed static finding into a regression test or rule.
- Assign owners and fix service levels for both result streams and track precision, time to fix and escaped defects.
- Cover authentication, access control and cryptography with design review and manual testing, since neither tool does.
Standards and references
- NIST: IR 8397 Guidelines on Minimum Standards for Developer Verification of Software
- NIST: SP 800-218 Secure Software Development Framework Version 1.1
- NIST: SP 800-53 Rev. 5 Security and Privacy Controls
- OWASP: Source Code Analysis Tools
- Google: OSS-Fuzz documentation
- Google: ClusterFuzzLite documentation
- LLVM: libFuzzer, a library for coverage-guided fuzz testing
- GitHub: CodeQL, About data flow analysis
Related NHI Mgmt Group resources: Fuzzing Guide · SAST vs DAST · SAST Triage Guide · Application Security Guide · Secure Software Development Lifecycle (SSDLC) Guide