Memory Forensics with Volatility
Binary Forensics & Crash Analysis · Defense & Forensics track
6 min read
In this module
Analysing Live Memory
Memory forensics examines RAM to reconstruct what was happening at a specific moment. Unlike disk forensics, it captures volatile state: running processes, network connections, decrypted data, loaded malware, kernel structures that live nowhere else. Power the system off and it's gone — permanently.
Capturing Memory
Before analysis, you need a memory image. Common acquisition methods:
Live acquisition tools: LiME (Linux Memory Extractor) is a loadable kernel module that dumps physical memory to a file or over the network. On Windows, WinPmem or FTK Imager capture physical memory. On macOS, osxpmem provides similar functionality.
Virtual machine snapshots: VMware, VirtualBox, and Hyper-V can snapshot VM memory. The .vmem file (VMware) or .sav file (Hyper-V) contains the VM's physical memory and can be directly analysed.
Crash dumps: Windows kernel crash dumps (MEMORY.DMP) and hibernation files (hiberfil.sys) contain compressed memory images that can be analysed with Volatility.
# Capture Linux memory with LiMEinsmod lime.ko "path=/evidence/memory.lime format=lime"
# Capture Windows memory with WinPmemwinpmem_mini_x64.exe memory.rawVolatility Framework
Volatility is the standard open-source memory forensics framework. It parses raw memory images by understanding the data structures of the target operating system's kernel, reconstructing high-level information from low-level memory contents.
Volatility needs to know which OS the memory image came from. It uses profiles (Volatility 2) or symbol tables (Volatility 3) to interpret kernel structures correctly.
# Volatility 3 basic usage# List running processesvol -f memory.raw windows.pslist
# Detect hidden processes (cross-reference multiple sources)vol -f memory.raw windows.psscan
# List network connectionsvol -f memory.raw windows.netscan
# List loaded kernel modulesvol -f memory.raw windows.modules
# Dump a specific process's memoryvol -f memory.raw windows.memmap --pid 1234 --dumpProcess Analysis
The process list is the starting point. Volatility can enumerate processes through multiple methods:
pslist: Walks the kernel's active process list (the doubly-linked list rooted at PsActiveProcessHead). This is the same list the task manager uses. A rootkit that unlinks a process from this list makes it invisible to pslist.
psscan: Scans all of physical memory for process structures (EPROCESS on Windows, task_struct on Linux) by looking for their characteristic byte patterns. This finds processes even if they have been unlinked from the active list - a key rootkit detection technique.
Comparing pslist and psscan results exposes hidden processes: anything found by psscan but absent from pslist is worth a hard look. Check its exit time first: a process that has already exited also drops off the active list while its EPROCESS lingers in memory. One with no exit time that's missing from pslist has very likely been unlinked, a strong sign of a rootkit.
Rootkits hide processes by unlinking their EPROCESS structure from the kernel's doubly-linked process list. This technique is called DKOM (Direct Kernel Object Manipulation). The process continues to run because the scheduler uses a different data structure, but it becomes invisible to tools that walk the process list. Memory forensics defeats DKOM because it finds process structures by scanning physical memory, not by following kernel lists.
Here's what each plugin sees after a rootkit unlinks evil.exe. The rootkit points its neighbours' Flink and Blink fields past it, so pslist's walk from PsActiveProcessHead never arrives. psscan ignores the links and sweeps memory for pool-tagged EPROCESS structures, so it finds all four. One caution when you diff the two lists: psscan also turns up processes that have already exited, so check the exit time before calling a process hidden.
DLL Injection Detection
Malware frequently injects code into legitimate processes to hide its activity. Volatility can detect this through several plugins:
malfind: Scans process memory for regions that are marked as executable but are not backed by a file on disk. Legitimately loaded DLLs are file-backed; injected code typically resides in anonymous executable memory allocated with VirtualAllocEx.
dlllist vs ldrmodules: dlllist shows DLLs from the PEB's InLoadOrderModuleList. ldrmodules cross-references three different module lists in the PEB. Discrepancies between these lists indicate DLL unlinking - a technique used to hide injected DLLs.
Network Connection Analysis
Memory forensics can reconstruct network connections that were active at the time of capture:
# Windows network connectionsvol -f memory.raw windows.netscan# Shows: local address, remote address, state, PID, process name
# Linux network connectionsvol -f memory.raw linux.sockstatThis reveals C2 (command and control) connections, data exfiltration channels, and lateral movement attempts. Because the data comes from kernel structures in memory, it captures connections that network monitoring tools might have missed.
Extracting Encryption Keys
Perhaps the most striking application of memory forensics is extracting cryptographic keys. When a program decrypts data, the key must exist in memory at some point — and if you capture that memory, you have it. Common targets: TrueCrypt/VeraCrypt volume keys (found by scanning for the key schedule structure), BitLocker's FVEK stored in kernel memory, TLS session keys from browser or server processes, and WPA keys from the wpa_supplicant process.
Pull the right keys and you can decrypt volumes and network captures taken during the investigation.
Memory forensics follows the order of volatility principle: capture the most volatile evidence first. RAM contents change constantly and are lost at power-off. Disk contents are more stable but may be overwritten. RFC 3227 puts registers and cache first, then memory together with the routing table, ARP cache, process table and kernel statistics (so live network state is captured alongside RAM), then temporary file systems, then disk, then remote logs. Acquisition does mean running a tool on the live system, so keep it to one trusted imager run from your own read-only media, and save the analysis for a copy of the image: every program you run changes memory and destroys some evidence.