Volatility — Linux RAM Forensics and Analysis
Volatility is an open-source framework for analyzing RAM dumps (memory forensics). It reconstructs running processes, open network connections, loaded kernel modules, and data fragments that never reached disk. After a reboot, all of this is gone — processes hidden by rootkits, C&C connections, in-memory passwords, decompressed malware, shell history. A RAM dump captured before reboot preserves this evidence for analysis.
How Does Volatility Work?
The analysis process consists of two main elements:
- Memory Dump: First, we need to get a “copy” of the entire contents of RAM. This can be done with tools like
LiME(Linux Memory Extractor) or by taking a snapshot of a virtual machine. - System Profile: Volatility needs to know how to interpret the raw data. Each version of the Linux kernel has a slightly different data structure in memory. A “profile” is a set of information that tells Volatility how to find processes, network connections, etc., in a dump from a specific system version (e.g.,
Linux_5_4_0-42-generic_x64).
Basic Commands (Plugins)
Volatility works based on plugins. The examples below use Volatility 2 syntax. The newer Volatility 3 has a different command-line interface (e.g., vol -f dump.raw linux.pslist) and does not use profiles. Here are some of the most important Volatility 2 plugins:
imageinfo: Tries to automatically identify the system profile from the dump. The first step in any analysis.pslist: Displays a list of processes running at the time of the dump (similar tops -ef).pstree: Shows processes in a tree format, making it easier to find parent processes.netscan: Scans for active network connections.cmdline: Shows the arguments with which a given process was launched.filescan: Tries to find open files in memory.linux_bash: Recovers the history of commands typed in the bash shell.
Practical Example
Imagine your server has been compromised. You managed to get a memory dump to a file dump.raw.
-
System Identification:
volatility -f dump.raw imageinfoVolatility suggests the profile
Linux_5_15_0-generic_x64. -
Listing Processes:
volatility -f dump.raw --profile=Linux_5_15_0-generic_x64 pslistOn the list, you notice a suspicious process
kworkerds, which looks like a typo meant to imitate the legitimatekworkerprocess. -
Checking Network Connections:
volatility -f dump.raw --profile=Linux_5_15_0-generic_x64 netscanIt turns out that the
kworkerdsprocess is maintaining an active connection to an IP address in China. -
Checking the Command Line:
volatility -f dump.raw --profile=Linux_5_15_0-generic_x64 cmdlineYou see that the process was launched with suspicious arguments:
/tmp/kworkerds -o stratum+tcp://pool.example.com:1234 -u ...- this looks like a crypto miner!
For the newer version, see the Volatility 3 article which covers the updated command-line interface and symbol table approach.