Mata Kuliah: Digital Forensic for Military Purposes | 3 SKS
Setelah pertemuan ini, mahasiswa mampu:
Berbeda dari analisis malware murni:
| Aspek | Analisis Malware | Forensik Malware |
|---|---|---|
| Tujuan | Memahami fungsi malware | Mendukung investigasi hukum |
| Fokus | Reverse engineering | Chain of custody & dokumentasi |
| Output | Technical report | Laporan forensik admissible |
| Standar | Best practices industri | Standar forensik & prosedur legal |
| Kategori | Aktor | Target Militer |
|---|---|---|
| Commodity | Kriminal umum | PC individu personel |
| Targeted | Kelompok terorganisir | Jaringan unit tertentu |
| APT | State-sponsored | Infrastruktur kritis pertahanan |
| Cyber Weapon | Negara | Sistem kontrol industri militer |
| Aspek | Virus | Worm |
|---|---|---|
| Host File | Memerlukan host | Standalone |
| Penyebaran | Via file terinfeksi | Self-propagating via jaringan |
| Interaksi User | Perlu menjalankan file | Otomatis tanpa interaksi |
| Artefak Disk | Modified PE files | Standalone exe di temp/system |
| Artefak Network | Minimal | Scanning activity, exploit traffic |
| Jenis | Fungsi | Indikator Forensik |
|---|---|---|
| RAT | Remote control penuh | Koneksi outbound persisten |
| Banking Trojan | Mencuri kredensial | Browser hooks, form grabbing |
| Downloader | Mengunduh payload | HTTP requests ke domain suspicious |
| Dropper | Menyimpan & execute payload | File creation di temp dirs |
| Keylogger | Merekam keystroke | Hidden log files, keyboard API hooks |
Kampanye serangan multi-stage, terkoordinasi, state-sponsored
| Metode | Deskripsi | Artefak Forensik |
|---|---|---|
| Phishing Email | Attachment/link malicious | Email headers, attachment metadata |
| Drive-by Download | Exploit browser saat browsing | Browser cache, download history |
| USB/Removable | Penyebaran via USB drive | Autorun.inf, USB registry history |
| Watering Hole | Kompromi website target | Browser history, DNS logs |
| Supply Chain | Kompromi software update | Installation logs, hash mismatch |
Langkah pertama: periksa properti dasar file
| Properti | Tool | Tujuan |
|---|---|---|
| File Hash | HashMyFiles, PEStudio | Identifikasi unik, VirusTotal lookup |
| File Type | file command, TrID | Verifikasi tipe vs ekstensi |
| File Size | Explorer, stat | Perbandingan ukuran normal |
| Timestamps | PEStudio, exiftool | Creation, compile time |
| Digital Signature | sigcheck, PEStudio | Verifikasi sertifikat |
Tool gratis untuk analisis file PE (Portable Executable) Windows
PEStudio menampilkan:
π Download: www.winitor.com
| Kategori | Contoh String | Signifikansi |
|---|---|---|
| URLs/IPs | http://evil.com/gate.php |
C2 infrastructure |
| Registry | ...\CurrentVersion\Run |
Persistence |
| API Names | CreateRemoteThread |
Code injection |
| Commands | cmd.exe /c |
Execution methods |
| Mutex | Global\MalwareMutex |
Instance control |
FireEye Labs Obfuscated String Solver β mengekstrak string biasa dan obfuscated
# Ekstraksi string dasar
floss malware_sample.exe
# Hanya string yang di-decode (obfuscated)
floss --only decoded malware_sample.exe
# Output ke file
floss malware_sample.exe > strings_output.txt
# Dengan minimum length
floss -n 8 malware_sample.exe
βββββββββββββββββββββββββββββββ
β DOS Header (MZ) β β "MZ" signature (0x4D5A)
βββββββββββββββββββββββββββββββ€
β DOS Stub β
βββββββββββββββββββββββββββββββ€
β PE Signature β β "PE\0\0" (0x50450000)
βββββββββββββββββββββββββββββββ€
β COFF File Header β β Machine type, sections
βββββββββββββββββββββββββββββββ€
β Optional Header β β Entry point, image base
βββββββββββββββββββββββββββββββ€
β Section Headers β
βββββββββββββββββββββββββββββββ€
β .text (code) β
β .data (initialized) β
β .rdata (read-only) β
β .rsrc (resources) β
βββββββββββββββββββββββββββββββ
| Entropy | Interpretasi | Contoh |
|---|---|---|
| 0 β 4 | Normal text/data | Source code, dokumen |
| 4 β 6 | Normal executable | Compiled binary |
| 6 β 7 | Compressed | ZIP, legitimate packed |
| 7 β 8 | Encrypted/Packed | Malware packed! |
| Kategori | API Functions | Indikasi |
|---|---|---|
| Process Injection | CreateRemoteThread, VirtualAllocEx |
Injeksi kode ke proses lain |
| Keylogging | SetWindowsHookEx, GetAsyncKeyState |
Pencatatan keystroke |
| Network | InternetOpen, HttpSendRequest |
Komunikasi jaringan |
| Crypto | CryptEncrypt, CryptGenKey |
Enkripsi (ransomware) |
| Anti-Debug | IsDebuggerPresent |
Deteksi analisis |
| Aspek | Static | Dynamic |
|---|---|---|
| Eksekusi | Tidak | Ya, dalam sandbox |
| Obfuscation | Sulit menembus | Bypass packing |
| Coverage | Semua kode (incl. dead) | Hanya kode yang tereksekusi |
| Tools | PEStudio, FLOSS | ProcMon, Wireshark, FakeNet |
ββββββββββββββββββββββββββββββββββββββββββββββ
β HOST MACHINE β
β ββββββββββββββββββββββββββββββββββββββββ β
β β ANALYSIS VM (Sandbox) β β
β β β β
β β [ProcMon] [ProcExp] [Wireshark] β β
β β [FakeNet] [Regshot] [Sysmon] β β
β β β β
β β [Malware Sample] β Execute here β β
β ββββββββββββββββββββββββββββββββββββββββ β
β β
β Network: Host-only / Isolated β
β Snapshot: Taken BEFORE execution β
ββββββββββββββββββββββββββββββββββββββββββββββ
β οΈ Penting: Ambil snapshot VM sebelum eksekusi malware!
Memantau file system, registry, dan process activity secara real-time
Filter yang berguna:
βββββββββββββββββββββββββββββββββββββββββββββββββ
Process Name is malware.exe β Aktivitas malware
Operation is WriteFile β File creation
Operation is RegSetValue β Registry changes
Path contains \Run β Persistence detection
Path contains \Temp β File drop location
Contoh output persistence:
Time Process Operation Path
10:45:01 malware.exe RegSetValue HKLM\...\Run\svchost
10:45:02 malware.exe CreateFile C:\Users\...\Temp\payload.exe
Contoh output FakeNet-NG:
ββββββββββββββββββββββββββββββββββββββββββββββββββ
[DNS] malware.exe query: evil-c2.com β faked
[HTTP] malware.exe GET /gate.php?id=VICTIM001
[HTTP] malware.exe POST /exfil.php (4096 bytes)
β Analisis network behavior tanpa koneksi internet nyata
| Mekanisme | Lokasi / Method | Timing |
|---|---|---|
| Registry Run | HKLM\...\Run |
User login |
| Scheduled Task | Task Scheduler | Custom trigger |
| Services | HKLM\SYSTEM\...\Services |
System boot |
| DLL Hijacking | DLL search order abuse | App launch |
| WMI Subscription | WMI repository | Event-based |
| Startup Folder | %AppData%\...\Startup |
User login |
| Registry Key | Scope |
|---|---|
HKLM\...\CurrentVersion\Run |
All users, setiap login |
HKCU\...\CurrentVersion\Run |
Current user, setiap login |
HKLM\...\RunOnce |
All users, sekali saja |
HKLM\SYSTEM\...\Services |
System boot |
...\Winlogon\Shell |
Login replacement |
...\Winlogon\Userinit |
Login initialization |
β οΈ Malware sophisticated menggunakan multiple persistence sebagai redundancy
| Tipe C2 | Deskripsi | Deteksi |
|---|---|---|
| HTTP/HTTPS | Web protocols | Proxy logs, HTTP anomali |
| DNS Tunneling | Data via DNS queries | Anomali DNS, panjang query |
| Social Media | Perintah di platform sosial | API traffic anomali |
| Custom Protocol | Protokol komunikasi khusus | Unusual port, protocol anomaly |
Contoh Beacon Pattern:
[10:00:00] GET /check?id=abc123 β 200 OK (no cmd)
[10:05:00] GET /check?id=abc123 β 200 OK (no cmd)
[10:10:00] GET /check?id=abc123 β 200 OK {cmd: upload}
[10:15:00] POST /upload (encrypted data)
[10:20:00] GET /check?id=abc123 β 200 OK (no cmd)
Jitter β Variasi interval untuk hindari deteksi:
Tanpa jitter: 300s, 300s, 300s β Mudah terdeteksi
Dengan jitter: 285s, 312s, 298s β Sulit terdeteksi
# Contoh sederhana DGA (edukasi)
def generate_domain(date, seed="malware_seed"):
date_str = date.strftime("%Y%m%d")
hash_input = f"{date_str}{seed}"
hash_result = hashlib.md5(hash_input.encode()).hexdigest()
return hash_result[:12] + ".com"
# Berbeda setiap hari!
Deteksi DGA:
Cara Kerja:
Malware β DNS Query β DNS Server β C2 Server
β
C2 Server β DNS Response β DNS Server β Malware
Contoh encoding data dalam DNS query:
Normal: www.google.com
Tunnel: SGVsbG8gV29ybGQ=.data.evil-c2.com
^^^^^^^^^^^^^^^^^^^
Base64 encoded stolen data
Deteksi DNS Tunneling:
Memory forensics kritis karena:
| Plugin | Fungsi | Deteksi |
|---|---|---|
windows.pslist |
Daftar proses | Nama proses mencurigakan |
windows.pstree |
Process tree | Parent-child anomali |
windows.malfind |
Injected code | Code injection & hollowing |
windows.cmdline |
Command line args | Command mencurigakan |
windows.netscan |
Network connections | C2 connections |
windows.svcscan |
Windows services | Malicious services |
PID PPID Name Analisis
βββββ βββββ βββββββββββββββ βββββββββββββββββββββ
748 720 services.exe β
Normal
800 748 svchost.exe β
Normal (parent: services)
1200 2840 svchost.exe β ANOMALI! (parent: explorer)
2840 1024 explorer.exe β
Normal
4500 2840 WINWORD.EXE β
Normal
4600 4500 cmd.exe β ANOMALI! (Wordβcmd)
4700 4600 powershell.exe β ANOMALI! (cmdβPS)
Attack Chain terdeteksi:
WINWORD.EXE β cmd.exe β powershell.exe = Macro malware!
| Teknik | Deskripsi | Counter-Measure |
|---|---|---|
| Packing | Kompresi/enkripsi executable | UPX unpack, manual unpack |
| Anti-Debug | IsDebuggerPresent |
Patch API return value |
| Anti-VM | Deteksi VMware/VBox | Remove VM artifacts |
| Timing Check | RDTSC, GetTickCount |
Adjust time values |
| Environment | Cek jumlah file, RAM, user activity | Buat VM realistis |
Deteksi: windows.malfind pada Volatility untuk RWX memory pages dan image mismatch
| Tipe IOC | Contoh | Durasi Validitas |
|---|---|---|
| File Hash | SHA256 malware binary | Pendek |
| IP Address | C2 server IP | Menengah |
| Domain | C2 domain name | Menengah |
| YARA Rule | Pattern matching rule | Panjang |
| TTPs | MITRE ATT&CK technique | Sangat panjang |
Knowledge base taktik dan teknik adversaries β standar de facto
| Tactic | ID | Contoh Technique |
|---|---|---|
| Initial Access | TA0001 | Phishing (T1566) |
| Execution | TA0002 | PowerShell (T1059.001) |
| Persistence | TA0003 | Registry Run Keys (T1547.001) |
| Defense Evasion | TA0005 | Process Injection (T1055) |
| C2 | TA0011 | Web Protocols (T1071.001) |
| Exfiltration | TA0010 | Over C2 Channel (T1041) |
Apakah ada pertanyaan tentang materi hari ini?
Topik diskusi:
Pertemuan 11: Forensik Malware
Ada pertanyaan?