Skip to content

Lesson 08 — Memory Forensics

By the end of this lesson, you will be able to:

  • Understand the purpose of memory forensics
  • Differentiate memory forensics from disk forensics
  • Explain volatile evidence and order of volatility
  • Identify situations requiring memory acquisition
  • Understand memory acquisition techniques for Kubernetes and Amazon EKS
  • Analyze processes, threads and loaded modules from memory
  • Detect fileless malware and in-memory attacks
  • Investigate credential theft from memory
  • Identify process injection techniques
  • Correlate memory evidence with Kubernetes Audit Logs, CloudTrail and runtime telemetry
  • Maintain forensic integrity and chain of custody
  • Build an enterprise memory forensics workflow

Many modern attacks never write malware to disk.

Instead, attackers execute entirely in memory.

Examples include:

  • Fileless malware
  • Memory-resident backdoors
  • Reverse shells
  • Reflective DLL loading
  • Process injection
  • Stolen credentials
  • Encryption keys
  • Kubernetes tokens
  • Cloud credentials
  • Runtime malware

Once the Pod or worker node is restarted…

…that evidence disappears forever.

Application Exploit
Memory-Resident Malware
Credential Theft
Data Exfiltration
Container Restart
Evidence Lost

Memory is often the most valuable source of evidence during an active incident.


Memory forensics is the process of acquiring and analyzing the volatile memory (RAM) of a running system.

Unlike disk analysis, memory analysis focuses on information that exists only while the system is running.

Examples include:

  • Running processes
  • Network connections
  • Open files
  • Loaded libraries
  • Active threads
  • Credentials
  • Encryption keys
  • Shell history
  • Command execution
  • Malware
  • Injected code

Memory Investigation
├── Running Processes
├── Process Trees
├── Memory Regions
├── Loaded Libraries
├── Network Connections
├── Credentials
├── Encryption Keys
├── Shell Sessions
├── Malware
├── Injected Code
├── Runtime Metadata
├── Container Runtime
└── Worker Node Memory

Memory may contain:

  • Kubernetes Service Account tokens
  • AWS temporary credentials
  • JWT tokens
  • OAuth tokens
  • SSH keys
  • Encryption keys
  • Database passwords
  • API keys
  • Malware configuration
  • Runtime commands
  • Shell history
  • Process arguments

Many of these never appear on disk.


Memory Forensics Disk Forensics
Live system Offline system
Volatile Persistent
Running malware Stored malware
Active credentials Saved credentials
Current network connections Historical logs
Running processes Installed files
Encryption keys Encrypted files
Lost after shutdown Available after shutdown

Both investigations complement each other.


Always collect evidence based on volatility.

CPU Registers
RAM
Network Connections
Processes
Temporary Files
Disk
Cloud Logs
Backups

Memory should always be collected before shutting down the system whenever practical.


Memory acquisition should be considered when:

  • Active malware is suspected
  • Reverse shell detected
  • Cryptomining detected
  • Container escape suspected
  • Ransomware running
  • Credential theft suspected
  • In-memory malware detected
  • Process injection suspected
  • Fileless malware suspected
  • Rootkit suspected
  • Advanced persistent threat (APT) activity observed

Unlike traditional servers…

Containers are ephemeral.

Pods may restart automatically.

Worker nodes may terminate.

Auto Scaling may replace nodes.

Memory evidence disappears quickly.


Runtime Alert
Determine Need
Contain System
Acquire Memory
Hash Evidence
Preserve Original
Analyze Copy
Correlate Evidence
Root Cause
Incident Response

Possible acquisition targets include:

  • Entire RAM
  • Running processes
  • Memory regions

Specific suspicious process memory

Entire EC2 memory


Before collecting memory:

  • Is production impact acceptable?
  • Is legal approval required?
  • Is enough storage available?
  • Is acquisition tooling approved?
  • Is the system stable?
  • Is encryption enabled?
  • Is there sufficient time?

Before memory acquisition record:

  • Cluster
  • Namespace
  • Pod
  • Node
  • Instance ID
  • Process IDs
  • Runtime alerts
  • Current time
  • Investigator

Memory acquisition is generally performed on:

Amazon EC2 worker nodes.

The acquisition captures:

  • Kernel memory
  • User processes
  • Containers
  • Runtime metadata
  • Loaded drivers
  • Active network state

Containers do not have independent RAM.

They share the worker node kernel.

Container memory analysis focuses on:

  • Process memory
  • Namespaces
  • cgroups
  • Runtime metadata

Record:

Terminal window
date
hostname
uptime
who
w
ps aux
ss -plant

These commands preserve volatile context before acquisition.


The acquired memory dump should include:

Running Processes
+
Threads
+
Memory Pages
+
Open Files
+
Network State
+
Kernel Structures

Common enterprise tools include:

  • LiME (Linux Memory Extractor)
  • AVML
  • Volatility-compatible acquisition tools
  • Commercial EDR tools
  • Hypervisor snapshots (where supported)

Use only organization-approved tools.


Immediately calculate:

Terminal window
sha256sum memory.raw

Record:

  • SHA256
  • File size
  • Collection time
  • Collector
  • Host

Original Memory Dump
Read-only Storage
Working Copy
Analysis

Never analyze the original evidence.


Memory Dump
Identify OS
Enumerate Processes
Review Network Connections
Review Loaded Modules
Search Credentials
Identify Malware
Timeline Reconstruction

Memory allows investigators to recover:

  • Running processes
  • Hidden processes
  • Parent-child relationships
  • Threads
  • Command lines

Questions:

  • Which process started first?
  • Which process spawned malware?
  • Which process injected code?

Attackers may hide processes from normal operating-system utilities.

Memory analysis can reveal:

  • Hidden malware
  • DKOM manipulation
  • Rootkits
  • Process unlinking

Review:

  • Suspicious threads
  • Injected threads
  • Remote threads
  • Thread start addresses

Unexpected threads may indicate code injection.


Common techniques include:

  • DLL Injection
  • Reflective loading
  • Process hollowing
  • Memory patching
  • Shared memory injection

Memory analysis can reveal injected code.


Review:

  • Shared libraries
  • Kernel modules
  • Unexpected modules
  • Unsigned modules

Unexpected modules may indicate:

  • Rootkits
  • Malware
  • Persistence

Review memory pages for:

  • Executable regions
  • Writable executable pages
  • Injected shellcode
  • Suspicious permissions

Memory may reveal:

  • Reverse shells
  • Downloaders
  • Encoded payloads
  • Exploit shellcode

that never existed on disk.


Memory often contains:

  • Kubernetes Service Account tokens
  • AWS STS credentials
  • JWT tokens
  • OAuth tokens
  • Database passwords
  • API keys
  • Kerberos tickets
  • TLS session keys

Investigate carefully while protecting sensitive data.


Look for:

  • Service Account tokens
  • kubeconfig data
  • Bearer tokens
  • Kubernetes API requests

Possible artifacts include:

  • Access Key IDs
  • Temporary STS credentials
  • IAM role sessions
  • Session tokens

Correlate with CloudTrail.


Memory often stores:

  • Secrets
  • Tokens
  • Passwords
  • API keys

Do not expose these values in investigation reports.


Memory reveals:

  • Active TCP sessions
  • UDP sockets
  • Listening ports
  • Reverse shells
  • C2 channels

Correlate with:

  • VPC Flow Logs
  • DNS Logs
  • GuardDuty

Recover:

  • Cached domains
  • DNS requests
  • Resolver information

Look for:

  • Command-and-control domains
  • Newly registered domains
  • DGA activity

Memory analysis may reveal:

  • Malware configuration
  • Injected code
  • Encryption keys
  • Process relationships
  • Network destinations
  • Persistence

Fileless attacks execute entirely in RAM.

Examples include:

  • Reflective loading
  • Shellcode
  • PowerShell-like in-memory execution
  • Memory-only payloads

Disk analysis alone cannot detect these.


Memory may reveal:

  • Hidden processes
  • Hidden drivers
  • Hidden modules
  • Kernel patches
  • Hooked system calls

Correlate memory findings with:

  • Falco alerts
  • GuardDuty Runtime Monitoring
  • Kubernetes Audit Logs
  • CloudTrail
  • CloudWatch Logs
  • VPC Flow Logs

Example:

10:01 Exploit
10:02 Reverse Shell
10:03 Malware Loaded
10:04 AWS Token Access
10:05 Secrets Retrieved
10:06 External Connection

Examples include:

  • Hidden processes
  • Injected code
  • Reverse shell
  • Unusual modules
  • Suspicious memory pages
  • Credential artifacts
  • Network sessions
  • Rootkits

Runtime Alert
Acquire Memory
Hash Evidence
Analyze Processes
Analyze Credentials
Analyze Network
Analyze Malware
Correlate Logs
Root Cause
Recovery

  • Memory image
  • SHA256 hash
  • Acquisition tool
  • Collection time
  • Process list
  • Threads
  • Open files
  • Network connections
  • Service Account tokens
  • AWS credentials
  • Secrets
  • API keys
  • Audit Logs
  • CloudTrail
  • GuardDuty
  • Falco
  • DNS Logs
  • VPC Flow Logs

Every memory image should include:

Evidence ID
Incident ID
Cluster
Node
Collector
Acquisition Tool
Collection Time
SHA256
Storage Location

Evidence lost.


May modify evidence.

Always analyze a copy.


Memory findings should always be correlated with runtime telemetry.


Evidence integrity cannot be proven.


Memory images may contain:

  • Passwords
  • Tokens
  • Customer data

Always encrypt and restrict access.


As a Cloud Security Engineer:

  • Acquire memory before shutdown whenever possible.
  • Preserve volatile evidence immediately.
  • Hash every memory image.
  • Store originals securely.
  • Analyze working copies only.
  • Correlate memory evidence with Kubernetes Audit Logs and CloudTrail.
  • Protect sensitive credential artifacts.
  • Document every acquisition step.
  • Practice memory acquisition before incidents occur.
  • Include memory forensics in enterprise incident response playbooks.

A banking organization receives a Falco alert indicating shell execution inside a production Pod.

GuardDuty Runtime Monitoring reports suspicious credential access.

The incident response team:

  1. Identifies the affected EKS worker node.
  2. Preserves runtime metadata.
  3. Acquires a full memory image from the worker node.
  4. Calculates SHA-256 hashes.
  5. Stores the original dump in encrypted evidence storage.
  6. Analyzes a working copy.
  7. Identifies a hidden malware process injected into a legitimate application.
  8. Recovers AWS STS credentials from memory.
  9. Correlates CloudTrail API activity using those credentials.
  10. Discovers attempted access to Amazon S3.
  11. Revokes credentials.
  12. Rebuilds the worker node.
  13. Rotates Kubernetes Service Account tokens.
  14. Updates runtime detection rules.

The investigation confirms that the attacker used fileless malware that never touched the disk, making memory forensics the key source of evidence.


  • Memory forensics is essential for investigating advanced Kubernetes attacks.
  • RAM contains volatile evidence that disappears after shutdown.
  • Memory analysis can reveal hidden processes, injected code and fileless malware.
  • Kubernetes Service Account tokens and AWS credentials may exist only in memory.
  • Memory findings should always be correlated with Audit Logs, CloudTrail and runtime telemetry.
  • Memory images must be hashed, protected and analyzed using working copies.
  • Enterprise incident-response plans should include memory acquisition procedures.

1. Why is memory forensics important during a Kubernetes incident?

Section titled “1. Why is memory forensics important during a Kubernetes incident?”

Answer: Memory contains volatile evidence such as running processes, credentials, injected code, network connections and fileless malware that may never exist on disk.

2. What is the difference between memory and disk forensics?

Section titled “2. What is the difference between memory and disk forensics?”

Answer: Memory forensics analyzes volatile RAM from a live system, while disk forensics examines persistent storage after acquisition.

3. Why should memory be acquired before rebooting a compromised worker node?

Section titled “3. Why should memory be acquired before rebooting a compromised worker node?”

Answer: Rebooting destroys volatile evidence including active processes, encryption keys, tokens, shell history and in-memory malware.

4. Why should investigators calculate a SHA-256 hash of a memory image?

Section titled “4. Why should investigators calculate a SHA-256 hash of a memory image?”

Answer: The hash verifies evidence integrity, proves the image has not been modified and supports chain-of-custody requirements.

5. What types of credentials may be recovered from memory?

Section titled “5. What types of credentials may be recovered from memory?”

Answer: Memory may contain Kubernetes Service Account tokens, AWS STS credentials, JWT tokens, OAuth tokens, API keys, database passwords and encryption keys.

In the next lesson, we will explore Lesson 09 — Root Cause Analysis, where you’ll learn how to reconstruct Kubernetes incidents, identify the original attack vector, determine the blast radius and document enterprise incident findings.