Core Dump Analysis
Binary Forensics & Crash Analysis · Defense & Forensics track
5 min read
In this module
Reading the Wreckage
When a program crashes, it leaves behind a snapshot of its final state: a core dump. For a security analyst or incident responder, that dump is a crime scene photograph — exact conditions, frozen in time, often enough to tell whether you're looking at a bug, a targeted exploit, or a hardware fault.
Generating Core Dumps on Linux
By default, many Linux systems disable core dumps or limit their size. To enable them for analysis:
# Enable core dumps for the current shell sessionulimit -c unlimited
# System-wide: configure core dump patternecho "/tmp/core.%e.%p.%t" > /proc/sys/kernel/core_pattern# %e = executable name, %p = PID, %t = timestamp
# Or use systemd-coredump (modern systemd systems)# Core dumps are stored in /var/lib/systemd/coredump/coredumpctl list # List recent core dumpscoredumpctl info PID # Show details about a specific dumpcoredumpctl debug PID # Open the dump directly in GDBA core dump contains the process's entire virtual address space at the moment of the crash: stack pages, heap pages, memory-mapped files, and shared library mappings. It also includes the register state for every thread, the signal that caused the crash, and auxiliary information about the process.
Analysing with GDB
GDB (GNU Debugger) is the primary tool for analysing core dumps on Linux:
# Load the core dump with the original binarygdb /path/to/crashed_program /path/to/core.12345
# First commands in GDB:(gdb) bt # Backtrace: show the call stack(gdb) info registers # Show register values at crash(gdb) x/20i $rip # Disassemble around the crash point(gdb) x/40gx $rsp # Examine the stack(gdb) info threads # List all threads(gdb) thread 2 # Switch to thread 2(gdb) bt # Backtrace for thread 2The backtrace is the most important first step. It shows you which function crashed, who called it, and the full call chain. With debug symbols, you can see source file names and line numbers. Without symbols, you work with raw addresses and must correlate them with disassembly.
A core dump without symbols is like a crime scene without labels. You can see the data but cannot easily interpret it. Always obtain the exact symbol files (debug packages or .pdb files) for the crashed binary and its libraries. On Linux, use debuginfod or install -dbgsym packages. On Windows, configure the Microsoft Symbol Server in WinDbg.
Windows Minidumps and Full Dumps
Windows uses the MiniDumpWriteDump API to generate crash dumps. There are several dump types:
Minidumps (.dmp, typically 64 KB - 256 KB) capture the essentials: crashing thread stack, register state, loaded module list, and exception record. They are small enough to send over email and sufficient for most crash diagnosis.
Full dumps capture the entire process address space, equivalent to Linux core dumps. They are much larger but allow complete post-mortem analysis of all memory contents.
WinDbg is the standard tool for Windows dump analysis:
# Load a dump filewindbg -z crash.dmp
# First commands in WinDbg:!analyze -v # Automatic analysis - often identifies the bug class.ecxr # Switch to the exception context (crash point)k # Show call stackr # Show registers.formats @rip # Show RIP in multiple formatsdd @rsp L20 # Dump stack contentslm # List loaded modulesExtracting Crash Context
Beyond the basic backtrace, a thorough core dump analysis examines:
Register state: What address was being accessed? If RIP points to unmapped memory like 0x4141414141414141, exploitation is the obvious read. If it points to a valid instruction and the fault was on a memory operand, look at what address the instruction tried to reach.
Stack contents: Walk the stack manually — return addresses, local variables, function arguments. Repeating byte patterns or recognisable shellcode are obvious signals of overflow.
Heap state: For heap corruption, examine the chunks around the faulting address. Mangled free list pointers and invalid chunk sizes indicate corruption. Freed chunks that still carry pointers to the crashed object's type suggest use-after-free.
Signal information: On Linux, the signal tells a story. SIGSEGV means invalid memory access. SIGABRT means the program called abort() — a security check fired (stack canary, heap corruption detection, assertion). SIGBUS means misaligned access or an unmapped region of a memory-mapped file.
Crash Triage for Security
Not every crash is a security vulnerability. Crash triage determines whether a crash is exploitable:
- Null pointer dereferences: Usually not exploitable (on modern systems with null page protection). The crash address is near zero, and the attacker cannot map memory at that address.
- Controlled EIP/RIP: If the instruction pointer contains attacker-controlled data, the crash is almost certainly exploitable.
- Write to controlled address: If the crash is a write operation and the destination address is attacker-controlled, you have at least a write-where. It becomes a full arbitrary write (write-what-where) if the value written is controlled too.
- Read from controlled address: An arbitrary read that can be used as an information leak.
- Abort from security check: The security check worked, but the underlying bug may be exploitable if the check can be bypassed.
Tools like Microsoft's !exploitable WinDbg extension and GDB's exploitable plugin automatically classify crashes as "EXPLOITABLE," "PROBABLY_EXPLOITABLE," "PROBABLY_NOT_EXPLOITABLE," or "UNKNOWN" (the same buckets used in Crash Analysis & Triage) based on heuristics like whether the crash involves controlled instruction pointers, write-what-where conditions, or heap corruption. These tools are useful for processing large numbers of fuzzer-found crashes.