In this section
LX1.6 Memory Acquisition with LiME
Memory Acquisition: Capturing RAM Before It Disappears
Why Memory Is the First Priority
Memory contains evidence that exists nowhere else on the system. Decrypted TLS session data, SSH session keys, database query results in process memory, the full command history of a bash process (even if .bash_history was deleted), network connection state including the remote IP and port of every active connection, and the complete executable code of every running process — including processes that the attacker deleted from disk after launching. If a rootkit is hiding processes from ps and connections from ss, those processes and connections still exist in memory and can be found with Volatility 3.
Memory is also the most volatile evidence source. A reboot destroys it completely. A process termination destroys that process's memory. Even running commands on the system modifies memory — loading ps into memory, allocating buffers for output, and creating kernel data structures for the new process. This is why memory acquisition is Phase B in the collection sequence — before any live response commands that modify the memory state.
Pre-Compilation: Build LiME Before the Incident
# On a build machine matching the target's distribution
# Install kernel headers for the target kernel
sudo apt install linux-headers-5.15.0-91-generic
# Clone LiME
git clone https://github.com/504ensicsLabs/LiME.git
cd LiME/src
# Compile for the specific kernel
make -C /lib/modules/5.15.0-91-generic/build M=$(pwd) modules
# The output is lime-5.15.0-91-generic.ko
# Copy to your IR toolkit
cp lime.ko /path/to/toolkit/lime-5.15.0-91-generic.ko
# Repeat for each kernel version in your infrastructure
# Script this: query all servers for their kernel versions,
# compile LiME for each unique version# On the compromised system — load LiME, dump over TCP
sudo insmod /mnt/usb/lime-$(uname -r).ko "path=tcp:4444 format=lime"
# On your forensic workstation — receive the dump
nc -l -p 4444 > ~/cases/IR-2026-0402/BASTION-NGE01/memory/memory.lime
# After transfer completes — remove the module
# On the compromised system:
sudo rmmod lime
# On your workstation — hash immediately
sha256sum ~/cases/IR-2026-0402/BASTION-NGE01/memory/memory.lime \
> ~/cases/IR-2026-0402/BASTION-NGE01/memory/memory.lime.sha256# Dump to USB drive mounted on the compromised system
sudo insmod /mnt/usb/lime-$(uname -r).ko \
"path=/mnt/usb/memory.lime format=lime"
# Wait for completion (monitor with ls -la /mnt/usb/memory.lime)
# When file size stops growing, the dump is complete
# Remove the module
sudo rmmod lime
# Verify hash
sha256sum /mnt/usb/memory.lime# On the compromised system — pipe LiME output through SSH
sudo insmod /mnt/usb/lime-$(uname -r).ko "path=tcp:4444 format=lime" &
ssh forensics@workstation "nc -l -p 4444 > /cases/memory.lime"Myth: "Loading a kernel module on a compromised system invalidates the memory evidence because you modified the system."
Reality: Loading LiME modifies the system — it allocates kernel memory for the module, updates the module list, and creates entries in the kernel ring buffer. These modifications are documented, understood, and minimal compared to the evidence value of the full memory dump. Every major forensic methodology (SANS, NIST SP 800-86, ISO 27037) recognizes that volatile evidence collection inherently modifies the system, and the standard is documentation — not avoidance. An investigator who loads LiME, documents the modification, and captures 32GB of memory evidence is in a stronger forensic position than an investigator who avoids loading LiME to preserve "purity" and loses all memory evidence when the system reboots.
Try it yourself
On your forensic workstation, clone LiME: `git clone https://github.
On your forensic workstation, clone LiME: git clone https://github.com/504ensicsLabs/LiME.git. Compile it for your current kernel: cd LiME/src && make. Test the acquisition on your own machine (not a production server): sudo insmod lime.ko "path=/tmp/test-memory.lime format=lime". Wait for the dump to complete (monitor size with ls -la /tmp/test-memory.lime), then sudo rmmod lime. Hash the dump: sha256sum /tmp/test-memory.lime. You have just completed a memory acquisition. In LX12, you will analyze this dump with Volatility 3.
Beyond This Investigation
Memory acquisition is the first step of every high-severity investigation. LX12 (Linux Memory Forensics) teaches you to analyze the dumps acquired with the techniques in this subsection — extracting hidden processes, network connections, kernel modules, and bash history from memory. The quality of the memory analysis depends entirely on the quality of the acquisition — a dump that was acquired after the attacker disconnected and their processes terminated contains less evidence than a dump acquired while the attacker was still active.
Check your understanding:
1. You arrive at a compromised server running kernel 5.15.0-97-generic. Your LiME toolkit has modules for 5.15.0-88 through 5.15.0-95. What are your options? 2. Why is dumping memory to the network (path=tcp:4444) preferred over dumping to the local disk? 3. The target system has Secure Boot enabled and rejects the unsigned LiME module. What are your alternatives for capturing memory evidence? 4. You successfully acquire a memory dump. What are the first three things you record in the chain of custody log?
You have a 32GB memory dump from a compromised server. Volatility3 analysis will take approximately 4 hours. The IR lead needs a preliminary finding in 30 minutes. Do you skip memory analysis?
No — run targeted Volatility3 plugins that produce results in minutes, not the full analysis that takes hours. linux.pslist (process listing — 2 minutes) identifies suspicious processes immediately. linux.sockstat (network connections — 3 minutes) identifies active C2. linux.bash (bash history from memory — 1 minute) may capture commands the attacker executed even if they cleared .bash_history on disk. These 3 plugins produce a preliminary finding in under 10 minutes: 'Memory analysis identified [N] suspicious processes, [N] external network connections, and the following attacker commands.' The full analysis (loaded modules, rootkit detection, file extraction) continues while the preliminary finding reaches the IR lead.
Get weekly detection and investigation techniques
KQL queries, detection rules, and investigation methods — the same depth as this course, delivered every Tuesday.
No spam. Unsubscribe anytime. ~2,000 security practitioners.