คลัง
forensics

Volatility

Volatility เป็น framework วิเคราะห์ memory dump ยอดนิยมที่สุด ทำงานด้วย plugin จำนวนมากดึง process, network, registry, malware จาก dump บทนี้ลงลึก Vol2 vs Vol3, การระบุ profile, plugin หลักทุกตัว (process/network/malware/credential/registry), การดึงไฟล์, และ workflow CTF (เนื้อหาเพื่อการศึกษา/ฝึกใน lab/CTF)

IntermediateAdvanced#volatility#forensics#memory#plugins#vol3#vol2#ctf

1. Vol2 vs Vol3

Volatility มีสองเวอร์ชันที่ต่างกันมาก: Vol2 (Python 2, ต้องระบุ --profile เอง, plugin เยอะสุด, โจทย์เก่าออกแบบกับตัวนี้) และ Vol3 (Python 3, ตรวจ OS อัตโนมัติ ไม่ต้อง profile, syntax ต่าง, เร็วกว่า) — ควรรู้ทั้งสองเพราะโจทย์ CTF เก่าๆ มักอ้างอิง Vol2

เนื้อหานี้เพื่อการศึกษาในงาน forensics ที่ถูกต้อง (CTF, lab) เท่านั้น

2. ระบุ OS/profile (ขั้นแรกเสมอ)

หา profile/OS ก่อน
# Vol3 — ตรวจอัตโนมัติ
vol -f dump.raw windows.info          # ยืนยันว่าเป็น Windows + build
vol -f dump.raw banners.Banners       # Linux: หา kernel banner

# Vol2 — ต้องหา profile ก่อน
volatility -f dump.raw imageinfo       # แนะนำ profile (เช่น Win7SP1x64)
# ใช้ profile นั้นกับทุกคำสั่งถัดไป
Vol3 ไม่ต้อง profile (ตรวจเอง); Vol2 ต้อง imageinfo หา profile แล้วใส่ --profile ทุกคำสั่ง

3. Volatility 3 — plugin หลัก

Vol3 plugins (Windows)
# Process
vol -f dump.raw windows.pslist        # process list
vol -f dump.raw windows.pstree        # process tree (parent-child)
vol -f dump.raw windows.psscan        # scan (เจอ process ที่ซ่อน/terminated)
vol -f dump.raw windows.cmdline       # command line ของแต่ละ process

# Network
vol -f dump.raw windows.netscan       # connections + listening
vol -f dump.raw windows.netstat

# Malware / injection
vol -f dump.raw windows.malfind       # injected code (RWX regions)
vol -f dump.raw windows.dlllist --pid 1234

# Files
vol -f dump.raw windows.filescan      # ไฟล์ใน memory
vol -f dump.raw windows.dumpfiles --virtaddr 0x... # ดึงไฟล์ออก

# Credentials / Registry
vol -f dump.raw windows.hashdump      # NTLM hashes
vol -f dump.raw windows.registry.hivelist
vol -f dump.raw windows.registry.printkey --key "Software\..."

# Linux
vol -f dump.raw linux.pslist
vol -f dump.raw linux.bash            # bash history!
psscan เจอ process ที่ pslist ไม่เห็น (ซ่อน/ตาย); malfind หา injected code; linux.bash = command history

4. Volatility 2 — plugin หลัก

Vol2 plugins (ต้องมี --profile)
P="--profile=Win7SP1x64"        # จาก imageinfo
volatility -f dump.raw $P pslist
volatility -f dump.raw $P pstree
volatility -f dump.raw $P psscan
volatility -f dump.raw $P cmdscan      # console command history
volatility -f dump.raw $P consoles     # console output
volatility -f dump.raw $P netscan
volatility -f dump.raw $P malfind
volatility -f dump.raw $P hashdump
volatility -f dump.raw $P dumpfiles -Q 0x... -D out/
volatility -f dump.raw $P hivelist
volatility -f dump.raw $P clipboard    # clipboard content
cmdscan/consoles เป็น Vol2 ที่ดูคำสั่งที่พิมพ์ + output; clipboard มักมี flag ในโจทย์ CTF

5. Workflow CTF

  1. 1ระบุ OS/profile (windows.info / imageinfo)
  2. 2pslist/pstree หา process น่าสงสัย (ชื่อแปลก, parent ผิด)
  3. 3cmdline/cmdscan — ดูคำสั่งที่รัน (มักมีใบ้/flag)
  4. 4netscan — การเชื่อมต่อ; malfind — injected code
  5. 5filescan + dumpfiles — ดึงไฟล์ที่น่าสนใจ
  6. 6เฉพาะเรื่อง: hashdump, clipboard, registry printkey ตามโจทย์

6. Quick Reference

  • Vol3: vol -f dump windows.info → pslist/pstree/cmdline/netscan/malfind
  • Vol2: imageinfo → --profile=X pslist/cmdscan/netscan/malfind
  • process ซ่อน: psscan (เจอที่ pslist ไม่เห็น)
  • ดึงไฟล์: dumpfiles --virtaddr/-Q
  • malware: malfind (injected RWX); creds: hashdump
  • Linux: linux.bash (history); clipboard (Vol2) มักมี flag
  • ระบุ OS/profile ก่อนเสมอ

🧭 จับมือทำทีละขั้น (มีแค่ Kali) + ถ้าติดไปไหนต่อ

สมมติเพิ่งได้ memory dump มาแล้วต้องใช้ Volatility เจาะลึก มีแค่ Kali เปล่าๆ ทำตามนี้ทีละขั้น

  1. 1เช็คไฟล์ก่อน: file dump.raw ดูว่าใช่ memory dump ไหม
  2. 2ระบุ OS: vol -f dump.raw windows.info (หรือ vol -f dump.raw banners.Banners สำหรับ Linux)
  3. 3ถ้าโจทย์เก่าใช้ Vol2: volatility -f dump.raw imageinfo หา profile ก่อนแล้วใส่ --profile=X ทุกคำสั่งถัดไป
  4. 4ดู process: vol -f dump.raw windows.pslist แล้วเทียบกับ windows.psscan (เจอที่ซ่อน/terminated)
  5. 5ดู windows.pstree เช็ค parent-child ผิดปกติ
  6. 6ดู windows.cmdline ของ process ต้องสงสัย
  7. 7เช็ค network: vol -f dump.raw windows.netscan
  8. 8หา injected code: vol -f dump.raw windows.malfind
  9. 9ดึงไฟล์ที่น่าสนใจ: vol -f dump.raw windows.dumpfiles --pid --dump-dir out/
  10. 10ถ้าโจทย์ถาม credential: vol -f dump.raw windows.hashdump
  11. 11ถ้าเป็น Linux: vol -f dump.raw linux.bash ดูประวัติคำสั่ง
ไล่ plugin ทีละตัวจนเจอหลักฐาน
ระบุ OS/profile สำเร็จไหม
✅ สำเร็จ (Vol3 auto หรือ Vol2 imageinfo ได้ profile)n2
❌ imageinfo ไม่ขึ้น/ไม่มั่นใจ profile→ ลอง kdbgscan (Vol2) หรือเดา build จาก banners.Banners (Linux)
pslist/psscan เจอ process แปลกไหม
✅ เจอ (ชื่อ/parent ผิดปกติ, psscan เห็นที่ pslist ไม่เห็น)n3
❌ ดูปกติหมดn4
cmdline ของ process นั้นมี flag/เบาะแสไหม
✅ เจอ→ จบ อ่าน flag จาก command line ตรงๆ
❌ ไม่เจอn4
malfind เจอ injected/RWX region ไหม
✅ เจอ→ dumpfiles/vaddump ดึง region นั้นวิเคราะห์ต่อ (strings/RE)
❌ ไม่เจอn5
netscan เจอ connection น่าสงสัยไหม
✅ เจอ IP/port แปลกtoPcap
❌ ไม่เจอn6
ยังไม่เจอ ลองอะไรต่อ
โจทย์ถามรหัสผ่าน/hash→ hashdump/lsadump (Windows), linux.bash (Linux history)
อยากเดินดู filesystem ใน memory ง่ายกว่า CLI→ mount ด้วย MemProcFS แล้วเดินดูเหมือน explorer
โจทย์ต้องเรียงเวลาการกระทำทั้งหมดtoTimeline
ขั้นตอน/งานเครื่องมือใน Kaliติดตั้งเพิ่ม (ถ้าไม่มี)เครื่องมือออนไลน์
ระบุ OS/profilevolatility3 (vol)pipx install volatility3-
plugin เก่า (โจทย์ legacy)volatility (vol2, python2)git clone volatility2 + python2 env-
mount memory เป็น filesystem-git clone MemProcFS (build เอง)-
วิเคราะห์ไฟล์ที่ dump ออกมาfile, strings, exiftoolapt install exiftoolvirustotal.com
crack hash ที่ hashdump ได้john, hashcat-crackstation.net, hashes.com
วิเคราะห์ pcap คู่โจทย์wireshark, tshark--
ค้น string/flag ทั่ว dumpstrings, grep-CyberChef
🚑 ถ้าตันสนิท ลองท่าถัดไป:
• netscan ชี้ไปที่ traffic น่าสงสัย มี pcap คู่โจทย์ → ไป PCAP Analysis
• ต้องเรียงเวลาจากหลายแหล่งหลักฐาน → ไป Timeline Analysis
• มี disk image คู่โจทย์เดียวกัน → ไป Disk Analysis

โน้ตของฉัน

ยังไม่มีโน้ตสำหรับหัวข้อนี้