Evasion techniques

← maldev README · docs/index

In-process and on-host primitives that disable, blind, restore, or hide the defensive surface so subsequent injection / collection / post-ex code runs unobserved. Every package in this area accepts a *wsyscall.Caller and composes via evasion.ApplyAll or evasion/preset recipes.

TL;DR

flowchart LR
    A[unhook ntdll] --> B[patch AMSI]
    B --> C[patch ETW]
    C --> D[harden process<br>ACG / BlockDLLs / CET]
    D --> E[sleepmask between callbacks]

The "operator's first 100 ms" — restore clean syscall stubs, blind the two main monitoring channels, harden the process against future hooks, mask payload memory during sleep.

Packages

PackageTech pageDetectionOne-liner
evasion/acgacg-blockdlls.mdquietArbitrary Code Guard — block dynamic-code allocation in own process
evasion/amsiamsi-bypass.mdnoisyPatch AmsiScanBuffer / AmsiOpenSession for "always clean" verdicts
evasion/blockdllsacg-blockdlls.mdquietMicrosoft-only DLL signature requirement
evasion/callstackcallstack-spoof.mdquietCall-stack spoof primitives — fake return addresses for syscalls
evasion/cetcet.mdnoisyIntel CET shadow-stack opt-out + ENDBR64 marker for APC paths
evasion/etwetw-patching.mdmoderatePatch ntdll ETW write helpers with xor rax,rax; ret
evasion/hookinline-hook.mdquietInstall your own inline hooks (probe, group, remote, bridge)
evasion/hook/bridgeinline-hook.mdquietIPC bridge — out-of-process hook controller
evasion/hook/shellcodeinline-hook.mdquietx64 trampoline / prologue-steal generator
evasion/kcallbackkernel-callback-removal.mdvery-noisyEnumerate / remove kernel callback registrations (BYOVD-pluggable)
evasion/presetpreset.mdvariesCurated Minimal / Stealth / Aggressive Technique bundles
evasion/sleepmasksleep-mask.mdquietEncrypt payload memory during sleep with EKKO / Foliage / Inline strategies
evasion/stealthopenstealthopen.mdquietNTFS Object-ID file access — bypass path-based EDR file hooks
evasion/unhookntdll-unhooking.mdnoisyRestore ntdll.dll syscall stubs from disk or fresh child process

Cross-categorised pages currently living here (packages live elsewhere):

PageActual packageNote
../recon/anti-analysis.mdrecon/antidebug, recon/antivmmoved to recon/ — debugger + VM detection
../kernel/byovd-rtcore64.mdkernel/driver/rtcore64moved to kernel/ — BYOVD primitive used by kcallback + lsassdump
../recon/dll-hijack.mdrecon/dllhijackmoved to recon/ — discovery is recon, exploitation is evasion
../process/fakecmd.mdprocess/tamper/fakecmdPEB CommandLine spoof — moved to process/
../process/hideprocess.mdprocess/tamper/hideprocessNtQSI patch to hide PIDs — moved to process/
../recon/hw-breakpoints.mdrecon/hwbpmoved to recon/ — DR0–DR7 inspection
../process/phant0m.mdprocess/tamper/phant0mEventLog svchost thread kill — moved to process/
ppid-spoofing.mdc2/shell (PPIDSpoofer)spawn-time parent PID spoof
../recon/sandbox.mdrecon/sandboxmoved to recon/ — multi-factor orchestrator
../recon/timing.mdrecon/timingmoved to recon/ — time-based evasion

Quick decision tree

You want to…Use
…blind PowerShell / .NET AMSI scanningamsi.PatchAll
…blind ETW for the current processetw.PatchAll
…restore EDR-hooked syscall stubs before patchingunhook.FullUnhook or unhook.CommonClassic
…make memory scanners blind during sleepsleepmask
…ship a single "do everything sane" recipepreset.Stealth()
…read a sensitive file path without leaving a path-based eventstealthopen
…survive Win11+CET-enforced hosts on APC pathscet.Wrap or cet.Disable
…spoof call-stack return addresses for stealth syscallscallstack.SpoofCall
…remove a kernel callback (PsSetLoadImageNotifyRoutine etc.)kcallback (requires BYOVD reader)

MITRE ATT&CK

T-IDNamePackagesD3FEND counter
T1027Obfuscated Files or Informationevasion/sleepmaskD3-PMA
T1036Masqueradingevasion/callstack, evasion/stealthopenD3-PSA
T1497Virtualization/Sandbox Evasionrecon/sandbox, recon/antivm, recon/timingD3-PSA, D3-PMA
T1562.001Impair Defenses: Disable or Modify Toolsevasion/{amsi,etw,unhook,acg,blockdlls,cet,kcallback,preset}D3-PMC, D3-PSA
T1562.002Impair Defenses: Disable Windows Event Loggingprocess/tamper/phant0mD3-RAPA
T1574.012Hijack Execution Flow: COR_PROFILERevasion/hook (inline hook scaffold)D3-PMC
T1622Debugger Evasionrecon/antidebug, recon/hwbpD3-PSA

See also