Mempelajari teknik advanced evasion — EDR bypass, event log tampering, ETW patching, dan detection-resistant operations untuk beroperasi di environment dengan pertahanan tingkat tinggi

Setelah di episode 22 kita mempelajari LLM/GenAI adversarial — prompt injection dan data exfiltration — pada episode ini kita masuk ke advanced evasion: teknik tingkat lanjut untuk bypass EDR, manipulasi event logs, dan beroperasi di environment dengan pertahanan paling ketat.
Advanced evasion adalah tentang mengetahui bagaimana deteksi bekerja pada level terendah — dan menemukan celah di setiap layer pertahanan.
EDR Hooks
===========
EDR beroperasi dengan menghook API calls di userland:
- NtAllocateVirtualMemory → hooked untuk detect allocation
- NtWriteVirtualMemory → hooked untuk detect write
- NtCreateThreadEx → hooked untuk detect thread creation
Bypass: gunakan direct syscalls (bypass userland hooks)// Concept: direct syscall to bypass userland hooks
// Instead of calling NtAllocateVirtualMemory (hooked)
// Call syscall directly via assembly
// Using HellsGate / HalosGate technique
// Find unhooked syscall number from ntdll.dll
// Execute via syscall instruction directlyProcess Doppelgänging
=======================
1. Create NTFS transaction
2. Write malicious image ke transacted file
3. Create process from transacted file
4. Rollback transaction
5. Process runs from memory (no file on disk)
Result: AV/EDR tidak melihat file maliciousModule Stomping
================
1. Load legitimate DLL (mshtml.dll)
2. Overwrite DLL code di memory dengan malicious code
3. Execute (looks like legitimate module)
Result: Process shows legitimate module name# ❌ Noisy: clear entire log
wevtutil cl Security
# ✅ Better: remove specific events
# Using PowerShell to selectively remove events
Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4688} |
ForEach-Object { $_.Remove() } # ConceptualEvent Log Attacks
===================
1. Clear entire log (very suspicious)
2. Remove specific events (better)
3. Modify event timestamps (timestomping)
4. Disable logging before action (best)
5. Use legitimate tools (LOLBins)// Patch ETW (Event Tracing for Windows)
// ETW feeds data ke SIEM — disable = blind
HMODULE hNtdll = GetModuleHandle("ntdll.dll");
FARPROC pEtwEventWrite = GetProcAddress(hNtdll, "EtwEventWrite");
// Patch function untuk return immediately
DWORD oldProtect;
VirtualProtect(pEtwEventWrite, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
*(char*)pEtwEventWrite = 0xc3; // RET
VirtualProtect(pEtwEventWrite, 1, oldProtect, &oldProtect);Domain Fronting
================
1. Request → Cloudflare (legitimate CDN)
2. Cloudflare → forward ke attacker server
3. Network monitoring melihat HTTPS ke Cloudflare
4. Tetapi actual destination adalah C2
Result: C2 traffic tersembunyi dalam legitimate CDN trafficC2 Channel Evasion
====================
1. HTTPS with legitimate cert (Let's Encrypt)
2. DNS over HTTPS (DoH)
3. ICMP tunneling
4. WebSocket connections
5. HTTP/2 multiplexingIn-Memory Techniques
======================
1. Reflective DLL injection
→ Load DLL dari memory, bukan disk
2. Process hollowing
→ Create suspended process → replace memory
3. Herpaderp
→ Modify file setelah AV scan
4. Module overloading
→ Load legitimate DLL → overwrite codeBypass Memory Scan
====================
1. Sleep obfuscation
→ Sleep → XOR encrypt memory → wake → decrypt
2. Stack spoofing
→ Fake call stack → confuse scanners
3. Syscall-based execution
→ Bypass userland API hooks
4. Unhooking
→ Restore original API functionsWarning
Advanced evasion techniques membutuhkan pemahaman mendalam tentang Windows internals, memory management, dan EDR architecture. Praktik di lab sebelum menggunakannya dalam engagement.
# 1. Setup lab dengan EDR (CrowdStrike/SentinelOne trial)
# 2. Test basic execution → pastikan terdeteksi
# 3. Test process injection → bandingkan detection
# 4. Test direct syscalls → bandingkan detection
# 5. Test ETW patching → bandingkan detection
# 6. Document: technique mana yang berhasilInti yang harus dibawa pulang:
Di episode 24 selanjutnya, kita akan mempelajari advanced persistent emulation — APT emulation, state-sponsored TTPs, dan campaign realism.