Statik Analiz
static-analysis difficulty: orta
Statik analiz, örneği çalıştırmadan format, sembol, string ve kontrol akışını çıkarır. Packed örnekte önce packer tespiti; aksi halde Ghidra/IDA’da fonksiyon haritası ve şüpheli API kullanımı.
Ön koşullar
Section titled “Ön koşullar”- Örnek hash’lendi ve izole kopyada- file, strings, rabin2/objdump, DIE veya pe-sieve/yara- Ghidra veya IDA (veya Binary Ninja); .NET için dnSpy/ILSpyİş akışı
Section titled “İş akışı”-
Triage —
file, boyut, imza, bölüm isimleri. -
Packer — DIE / entropy; yüksek entropy → unpack gerekebilir.
-
Strings & imports — URL, path, crypto, process injection API.
-
Decompiler — giriş noktası, WinMain/
main, şüpheli dallar. -
Notlar — adres + bulgu; dinamik doğrulama listesi çıkar.
Hızlı triage
Section titled “Hızlı triage”file ./sample.binsha256sum ./sample.binstrings -a -n 8 ./sample.bin | head -n 200strings -a -e l ./sample.bin | head -n 100rabin2 -I ./sample.binrabin2 -i ./sample.binobjdump -x ./sample.bin | headPacking tespiti
Section titled “Packing tespiti”İşaretler:- Bölüm adları UPX0/UPK/… veya anlamsız isimler- Çok az import (LoadLibrary/GetProcAddress döngüsü)- Yüksek entropy (.text veya overlay)- Entry point packer stub’ında# Detect It Easy CLI varsadiec ./sample.bin# radare2 entropy ipucurabin2 -z ./sample.bin | headUPX ise çoğu zaman:
upx -d -o sample_unpacked.bin ./sample.binCustom packer’da Unpacking iş akışına geç.
Imports — ne aranır
Section titled “Imports — ne aranır”| API ailesi | İpucu |
|---|---|
| VirtualAlloc / VirtualProtect | Shellcode / decrypt stub |
| CreateRemoteThread / NtMapViewOfSection | Injection |
| WinHttp / InternetOpen | C2 / download |
| CryptDecrypt / BCrypt | Runtime decrypt |
| IsDebuggerPresent / NtQueryInformationProcess | Anti-debug |
| ptrace / prctl (ELF) | Anti-debug / sandbox |
rabin2 -i ./sample.bin | rg -i "VirtualAlloc|WinHttp|ptrace|LoadLibrary"Ghidra / IDA — genel bakış
Section titled “Ghidra / IDA — genel bakış”Ghidra:1. New project → Import → Analyze (default analyzers)2. Symbol Tree → Imports / Exports3. Listing + Decompile; XREF ile string’den koda git4. Bookmarks ile C2 / crypto fonksiyonlarını işaretleIDA:1. Auto-analysis bitince Imports penceresi2. Shift+F12 strings; XREF (x)3. F5 decompiler (Hex-Rays varsa)4. Graph view ile dallanmastrings · filtreli arama
embedded toolGenerated command
strings -a -n 6 ./sample.bin | rg -i 'http'http, .onion, api., password, token gibi kalıplarla tekrarla.
strings · filtreli arama
Section titled “strings · filtreli arama”strings -a -n 6 ./sample.bin | rg -i 'http'strings -a -n 6 ./sample.bin | rg -i 'password|token|apikey|Bearer'Zincir
Section titled “Zincir”file + DIE → UPX değil, az import → strings’te URL yok (şifreli) → dinamik: breakpoint VirtualAlloc → dump → tekrar Ghidra