Course contentsShow
← Security
Lesson 1392 of 3,05228. Application Security - TestingFree lesson

Sanitizers and Crash Detection

Understand AddressSanitizer, MemorySanitizer, and UndefinedBehaviorSanitizer for detecting memory corruption during fuzzing.

Sanitizers and Crash Detection

What you'll learn: How specialized tools can detect memory corruption and undefined behavior during fuzzing that would otherwise silently corrupt your application.

The Problem with Silent Corruption

When you're fuzzing an application (lessons 1385-1391), crashes are easy to spot—the program stops. But many security vulnerabilities don't cause immediate crashes. Memory corruption might write to the wrong address, use uninitialized memory, or trigger undefined behavior that only manifests under specific conditions. These "silent failures" are security time bombs.

What Are Sanitizers?

Sanitizers are compiler-based instrumentation tools that add runtime checks to detect bugs as they happen, even if they wouldn't normally crash. Think of them as smoke detectors—they alert you to danger before the fire spreads.

AddressSanitizer (ASan)

Detects memory errors like buffer overflows, use-after-free, and memory leaks. When your fuzzer generates input that writes one byte past an array, ASan immediately halts execution and reports the exact location.

MemorySanitizer (MSan)

Catches reads from uninitialized memory. If your code reads a variable before assigning it a value, MSan detects the taint and reports it, preventing unpredictable behavior.

UndefinedBehaviorSanitizer (UBSan)

Identifies undefined behavior like integer overflow, null pointer dereferences, or misaligned memory access—conditions that the C/C++ standards leave unspecified but attackers can exploit.

How They Work Together

During fuzzing, you compile your code with sanitizer flags. As the fuzzer throws millions of inputs at your application, sanitizers monitor every memory operation. When they detect a violation, they generate detailed reports showing the exact bug location and call stack—turning near-invisible vulnerabilities into actionable findings.

Key Takeaway: Sanitizers transform silent security vulnerabilities into loud, detectable crashes during fuzzing, dramatically improving your ability to find and fix memory corruption issues before attackers do.