Lesson 6 of 10
Memory Forensics
Memory forensics (RAM analysis) is one of the most powerful forensic techniques - RAM contains running processes, network connections, decrypted data, encryption keys, and malware that never touches disk. Volatility is the industry-standard framework.
Capturing Memory
# Memory capture - must be done BEFORE shutdown (volatile!)
# Linux memory capture
# Using LiME (Linux Memory Extractor) kernel module
sudo insmod lime.ko "path=/secure-storage/memory.lime format=lime"
# Using AVML (Microsoft Azure VMAccess Linux)
./avml memory.raw
# Windows memory capture
# WinPmem (open source):
winpmem-4.0.0.exe memory.raw
# DumpIt (commercial, widely accepted in forensics):
DumpIt.exe /OUTPUT memory.raw
# Virtualized environments - hottest for forensics:
# VMware: Suspend VM → .vmem file is memory dump
# VirtualBox: vboxmanage debugvm "VM Name" dumpguestcore --filename memory.elf
# Hypervisor memory: Most accurate - no AV interference, instant
# Verify integrity
sha256sum memory.raw > memory.raw.sha256Volatility 3 Analysis
# Volatility 3 - memory forensics framework
pip install volatility3
# Identify OS profile automatically
vol.py -f memory.raw windows.info
# Process listing (compare against disk-based autoruns)
vol.py -f memory.raw windows.pslist # Standard process list
vol.py -f memory.raw windows.pstree # Process tree (parent-child)
vol.py -f memory.raw windows.psscan # Scan for processes (finds hidden/terminated)
# Detect code injection / process hollowing
vol.py -f memory.raw windows.malfind # Find injected code in processes
# Output shows: process, address, hex dump of injected code
# Look for: MZ header injected in unexpected memory region
# Network connections
vol.py -f memory.raw windows.netstat # Active and recently closed connections
# Shows: PID, local addr:port, remote addr:port, state, process name
# Registry hives in memory (passwords, configurations)
vol.py -f memory.raw windows.registry.hivelist
vol.py -f memory.raw windows.registry.userassist # Recently executed programs
# Extract credentials from LSASS memory
vol.py -f memory.raw windows.lsadump # SAM database (hashed passwords)
# Equivalent to Mimikatz's sekurlsa::logonpasswords
# Detect rootkits (DKOM - Direct Kernel Object Manipulation)
vol.py -f memory.raw windows.pslist > pslist.txt
vol.py -f memory.raw windows.psscan > psscan.txt
diff pslist.txt psscan.txt
# Processes in psscan but NOT pslist → DKOM rootkit hiding processes!
# DLL analysis - find injected/suspicious DLLs in processes
vol.py -f memory.raw windows.dlllist --pid 1234 # DLLs loaded by PID 1234Common Mistakes
- Waiting too long to capture memory - encryption keys for ransomware, credentials in LSASS, and C2 connections all live only in RAM. Capture memory as the very first step before any other action
- Not capturing memory from all affected systems - if the attacker moved laterally, each compromised host may have different artifacts and different phases of the attack
- Using vol.py 2.x profiles on modern systems - Volatility 3 is profile-free and works directly with modern Windows/Linux memory; Volatility 2 requires manual profile matching which is error-prone
Tip
Tip
Practice Memory Forensics in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
The foundational security model: Confidentiality (privacy), Integrity (trust), and Availability (uptime).
Practice Task
Note
Practice Task - (1) Write a working example of Memory Forensics from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Quick Quiz
Common Mistake
Warning
A common mistake with Memory Forensics is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready cybersecurity code.
Key Takeaways
- Memory forensics (RAM analysis) is one of the most powerful forensic techniques - RAM contains running processes, network connections, decrypted data, encryption keys, and malware that never touches disk.
- Waiting too long to capture memory - encryption keys for ransomware, credentials in LSASS, and C2 connections all live only in RAM. Capture memory as the very first step before any other action
- Not capturing memory from all affected systems - if the attacker moved laterally, each compromised host may have different artifacts and different phases of the attack
- Using vol.py 2.x profiles on modern systems - Volatility 3 is profile-free and works directly with modern Windows/Linux memory; Volatility 2 requires manual profile matching which is error-prone
Finished this lesson?