Skip to content

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ı.

- Ö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
  1. Triage — file, boyut, imza, bölüm isimleri.

  2. Packer — DIE / entropy; yüksek entropy → unpack gerekebilir.

  3. Strings & imports — URL, path, crypto, process injection API.

  4. Decompiler — giriş noktası, WinMain/main, şüpheli dallar.

  5. Notlar — adres + bulgu; dinamik doğrulama listesi çıkar.

Terminal window
file ./sample.bin
Terminal window
sha256sum ./sample.bin
Terminal window
strings -a -n 8 ./sample.bin | head -n 200
Terminal window
strings -a -e l ./sample.bin | head -n 100
Terminal window
rabin2 -I ./sample.bin
Terminal window
rabin2 -i ./sample.bin
Terminal window
objdump -x ./sample.bin | head
İş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
Terminal window
# Detect It Easy CLI varsa
diec ./sample.bin
Terminal window
# radare2 entropy ipucu
rabin2 -z ./sample.bin | head

UPX ise çoğu zaman:

Terminal window
upx -d -o sample_unpacked.bin ./sample.bin

Custom packer’da Unpacking iş akışına geç.

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
Terminal window
rabin2 -i ./sample.bin | rg -i "VirtualAlloc|WinHttp|ptrace|LoadLibrary"
Ghidra:
1. New project → Import → Analyze (default analyzers)
2. Symbol Tree → Imports / Exports
3. Listing + Decompile; XREF ile string’den koda git
4. Bookmarks ile C2 / crypto fonksiyonlarını işaretle
IDA:
1. Auto-analysis bitince Imports penceresi
2. Shift+F12 strings; XREF (x)
3. F5 decompiler (Hex-Rays varsa)
4. Graph view ile dallanma

strings · filtreli arama

embedded tool
Generated command
strings -a -n 6 ./sample.bin | rg -i 'http'

http, .onion, api., password, token gibi kalıplarla tekrarla.

Terminal window
strings -a -n 6 ./sample.bin | rg -i 'http'
Terminal window
strings -a -n 6 ./sample.bin | rg -i 'password|token|apikey|Bearer'
file + DIE → UPX değil, az import
→ strings’te URL yok (şifreli)
→ dinamik: breakpoint VirtualAlloc → dump
→ tekrar Ghidra