| name | memory-forensics |
| description | Master memory forensics techniques including memory acquisition, process analysis, and artifact extraction using Volatility and related tools. Use when analyzing memory dumps, investigating incidents, or performing malware analysis from RAM captures. |
Memory Forensics
Comprehensive techniques for acquiring, analyzing, and extracting artifacts from memory dumps for incident response and malware analysis.
When to Use This Skill
- Performing memory analysis during incident response or breach investigation
- Extracting malware artifacts (processes, injected code, network connections) from a RAM capture
- Acquiring volatile memory from a live Windows/Linux/macOS system before shutdown
- Using Volatility 3 / Rekall to triage memory dumps
- Recovering credentials, browser sessions, or open files from process memory
Memory Acquisition
Live Acquisition Tools
Windows
# WinPmem (Recommended)
winpmem_mini_x64.exe memory.raw
# DumpIt
DumpIt.exe
# Belkasoft RAM Capturer
# GUI-based, outputs raw format
# Magnet RAM Capture
# GUI-based, outputs raw format
Linux
sudo insmod lime.ko "path=/tmp/memory.lime format=lime"
sudo dd if=/dev/mem of=memory.raw bs=1M
sudo cp /proc/kcore memory.elf
macOS
sudo ./osxpmem -o memory.raw
Virtual Machine Memory
cp vm.vmem memory.raw
vboxmanage debugvm "VMName" dumpvmcore --filename memory.elf
virsh dump <domain> memory.raw --memory-only
Detailed section: Volatility 3 Framework
Originally a 2680-byte section in this SKILL.md. Moved to references/details.md to fit Codex's 8 KB skill body cap.
Analysis Workflows
Malware Analysis Workflow
vol -f memory.raw windows.pstree > processes.txt
vol -f memory.raw windows.pslist > pslist.txt
vol -f memory.raw windows.netscan > network.txt
vol -f memory.raw windows.malfind > malfind.txt
vol -f memory.raw windows.dlllist --pid <PID>
vol -f memory.raw windows.handles --pid <PID>
vol -f memory.raw windows.pslist --pid <PID> --dump
strings -a pid.<PID>.exe > strings.txt
vol -f memory.raw windows.yarascan --yara-rules malware.yar
Incident Response Workflow
vol -f memory.raw windows.timeliner > timeline.csv
vol -f memory.raw windows.cmdline
vol -f memory.raw windows.consoles
vol -f memory.raw windows.registry.printkey \
--key "Software\Microsoft\Windows\CurrentVersion\Run"
vol -f memory.raw windows.svcscan
vol -f memory.raw windows.scheduled_tasks
vol -f memory.raw windows.filescan | grep -i "recent"
Data Structures
Windows Process Structures
typedef struct _EPROCESS {
KPROCESS Pcb;
EX_PUSH_LOCK ProcessLock;
LARGE_INTEGER CreateTime;
LARGE_INTEGER ExitTime;
LIST_ENTRY ActiveProcessLinks;
ULONG_PTR UniqueProcessId;
PEB* Peb;
} EPROCESS;
typedef struct _PEB {
BOOLEAN InheritedAddressSpace;
BOOLEAN ReadImageFileExecOptions;
BOOLEAN BeingDebugged;
PVOID ImageBaseAddress;
PPEB_LDR_DATA Ldr;
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
} PEB;
VAD (Virtual Address Descriptor)
typedef struct _MMVAD {
MMVAD_SHORT Core;
union {
ULONG LongFlags;
MMVAD_FLAGS VadFlags;
} u;
PVOID FirstPrototypePte;
PVOID LastContiguousPte;
PFILE_OBJECT FileObject;
} MMVAD;
#define PAGE_EXECUTE 0x10
#define PAGE_EXECUTE_READ 0x20
#define PAGE_EXECUTE_READWRITE 0x40
#define PAGE_EXECUTE_WRITECOPY 0x80
Detection Patterns
Process Injection Indicators
Rootkit Detection
vol -f memory.raw windows.pslist > pslist.txt
vol -f memory.raw windows.psscan > psscan.txt
diff pslist.txt psscan.txt
vol -f memory.raw windows.callbacks
vol -f memory.raw windows.ssdt
vol -f memory.raw windows.driverscan
vol -f memory.raw windows.driverirp
Credential Extraction
vol -f memory.raw windows.hashdump
vol -f memory.raw windows.lsadump
vol -f memory.raw windows.cachedump
YARA Integration
Writing Memory YARA Rules
rule Suspicious_Injection
{
meta:
description = "Detects common injection shellcode"
strings:
// Common shellcode patterns
$mz = { 4D 5A }
$shellcode1 = { 55 8B EC 83 EC } // Function prologue
$api_hash = { 68 ?? ?? ?? ?? 68 ?? ?? ?? ?? E8 } // Push hash, call
condition:
$mz at 0 or any of ($shellcode*)
}
rule Cobalt_Strike_Beacon
{
meta:
description = "Detects Cobalt Strike beacon in memory"
strings:
$config = { 00 01 00 01 00 02 }
$sleep = "sleeptime"
$beacon = "%s (admin)" wide
condition:
2 of them
}
Scanning Memory
vol -f memory.raw windows.yarascan --yara-rules rules.yar
vol -f memory.raw windows.yarascan --yara-rules rules.yar --pid 1234
vol -f memory.raw windows.yarascan --yara-rules rules.yar --kernel
String Analysis
Extracting Strings
strings -a memory.raw > all_strings.txt
strings -el memory.raw >> all_strings.txt
vol -f memory.raw windows.memmap --pid 1234 --dump
strings -a pid.1234.dmp > process_strings.txt
grep -E "(https?://|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})" all_strings.txt
FLOSS for Obfuscated Strings
floss malware.exe > floss_output.txt
floss pid.1234.dmp
Best Practices
Acquisition Best Practices
- Minimize footprint: Use lightweight acquisition tools
- Document everything: Record time, tool, and hash of capture
- Verify integrity: Hash memory dump immediately after capture
- Chain of custody: Maintain proper forensic handling
Analysis Best Practices
- Start broad: Get overview before deep diving
- Cross-reference: Use multiple plugins for same data
- Timeline correlation: Correlate memory findings with disk/network
- Document findings: Keep detailed notes and screenshots
- Validate results: Verify findings through multiple methods
Common Pitfalls
- Stale data: Memory is volatile, analyze promptly
- Incomplete dumps: Verify dump size matches expected RAM
- Symbol issues: Ensure correct symbol files for OS version
- Smear: Memory may change during acquisition
- Encryption: Some data may be encrypted in memory