UnixDroid

Lesson 7 of 8 · 9 min

Memory forensics with Volatility 3

Capture RAM and use Volatility 3 to find hidden processes, malicious commands and injected code.

Some malware never touches the disk. It lives only in RAM: injected into a normal process, running a PowerShell command, holding a connection open to its controller. Shut the machine down and it's gone. That's why memory forensics exists.

What RAM can reveal

  • Every running process, including ones hidden from Task Manager
  • The full command line each process was started with
  • Open network connections and which process owns them
  • Code injected into legitimate processes
  • Passwords, encryption keys and clipboard contents
  • Recently typed commands

Step 1: Capture the memory

SystemFree tools
WindowsWinPmem, Magnet RAM Capture, FTK Imager (Capture Memory)
LinuxLiME, AVML

Save the dump to an external drive, then hash it like any other evidence.

Step 2: Analyse it with Volatility 3

Volatility 3 is the standard open-source framework for memory analysis.

pipx install volatility3
vol -f memory.raw windows.info     # confirm the OS and that the dump is readable

The plugins you'll use most

PluginWhat it shows
windows.pslistRunning processes
windows.pstreeProcesses as a parent-to-child tree
windows.psscanProcesses found by scanning memory, including hidden and exited ones
windows.cmdlineThe command line of each process
windows.netscanNetwork connections and the process that owns each one
windows.malfindMemory regions that look like injected code
windows.hashdumpPassword hashes from the SAM

Linux dumps have equivalents such as linux.pslist, linux.pstree and linux.bash, which recovers typed commands from memory.

How an investigator reads a dump

1. Look at the tree. Run windows.pstree and look for strange parents. WINWORD.EXE starting powershell.exe or cmd.exe is a classic sign of a malicious macro.

2. Compare the lists. A process that shows up in psscan but not in pslist may be hiding, or may simply have exited. Check its exit time.

3. Read the command lines. Long encoded PowerShell (-enc followed by a block of base64) is almost never legitimate.

4. Follow the network. In netscan, which process is talking to an outside IP? Should that program ever touch the internet?

5. Confirm with malfind. A region marked PAGE_EXECUTE_READWRITE that starts with MZ (the header of a Windows program) inside a normal process points to injection.

vol -f memory.raw windows.pstree
vol -f memory.raw windows.cmdline --pid 4312
vol -f memory.raw windows.netscan | grep ESTABLISHED
vol -f memory.raw windows.malfind --pid 4312

Tip: Practise on public memory images before a real case. MemLabs on GitHub, CyberDefenders and TryHackMe all have free memory forensics challenges.

Disk forensics tells you what was left behind. Memory forensics tells you what was happening at that moment.

Try it yourself
  1. Install Volatility 3 on Kali: pipx install volatility3
  2. Download a practice image from the MemLabs repository on GitHub (Lab 0 or Lab 1).
  3. Run windows.info, then windows.pstree. Write down any process whose parent looks odd.
  4. Run windows.cmdline and find which programs the user had open and which files they were working with.
No Linux machine? Practise in the free online terminal

Quick check

Fill in the blank: vol -f mem.raw windows.______ finds memory regions that look like injected code.

Need a hint?

Malware + find.

Finished this lesson?

Done lessons keep your daily streak going 🔥

0 day streak

0 lessons done

best 0 days

Log in to keep your streak on every device →