For detection engineers (blue team)

← maldev README · docs/index

Every technique here has been measured against EDR / Defender / event logs. This page lists the artifacts each leaves behind, where to look, and which D3FEND counter-technique applies. Use it to write detections, plan red-team exercises, or harden endpoints.

TL;DR

[!TIP] If your goal is "what should I monitor first", focus on the noisy / very-noisy rows in the Detection Difficulty table below. Those are the techniques where the trade-off is worst for the attacker — easiest wins for the defender.

Detection difficulty matrix

Every package is annotated with a Detection level field in its doc.go. Buckets:

BucketOperator can hide it?Defender notes
very-quietYes — zero artifacts above noiseIn-process, common syscalls only. Detection requires per-process behavioural ML.
quietMostlyMinimal trace, no event log. Maybe one transient registry/file artifact.
moderateSometimesDistinguishable syscall pattern; volume-based detection works.
noisyNo without effortETW provider, event log entry, cross-process activity.
very-noisyNoSignature-detected by Defender or EDR; specific API hooks watched.

cmd/docgen (Phase 3 of the doc refactor) produces a flat table of all public packages by detection level. Until then, see each package's doc.go.

Per-area detection guidance

Syscalls — win/syscall

StanceTelemetry leftDetection vector
MethodWinAPIStandard CRT callNone — looks like any benign program
MethodNativeAPIntdll!Nt* direct callFrequency-based: a process making 200+ NT calls/sec is unusual
MethodDirectsyscall instruction inside loaded moduleEDR call-stack walking detects RIP not in ntdll. D3-PCM (Process Code Modification)
MethodIndirectsyscall instruction inside ntdll (jumped to from caller via heap stub)Hard to detect from user-mode. Heap stub page is RW↔RX-cycled per call — VirtualProtect rate may be a heuristic. Kernel-mode ETW (TI events) sees the issuing thread. D3-PSM (Process Spawn Monitoring)
MethodIndirectAsmSame end-effect as MethodIndirect but stub lives in implant .text (Go-asm, fixed RVA)No VirtualProtect heuristic. YARA on the asm stub bytes still possible — morph or strip. D3-PSM

[!NOTE] ETW Threat Intelligence provider (Microsoft-Windows-Threat-Intelligence) emits EVENT_TI_NTPROTECT and EVENT_TI_NTALLOCATEVIRTUAL regardless of whether the call came from ntdll or a direct syscall instruction. Subscribing to TI events is the single best detection investment for this area.

AMSI / ETW patching — evasion/amsi, evasion/etw

ArtifactWhere
3-byte patch in amsi.dll!AmsiScanBuffer (31 C0 C3)Memory scan of amsi.dll RX section after process load
4-byte patch in ntdll.dll!EtwEventWrite{,Ex,Full,String,Transfer} (48 33 C0 C3)Memory scan of ntdll.dll RX
NtProtectVirtualMemory call switching RX → RWX → RX on amsi/ntdllETW TI / EDR call-stack inspection
Reduced AMSI scan rate from PowerShell hostPowerShell Microsoft.PowerShell.AMSI provider drops to zero

Hunt query (KQL pseudo-code):

DeviceImageLoadEvents
| where FileName == "amsi.dll"
| join DeviceProcessEvents on InitiatingProcessId
| project ProcessName, AmsiBytes = read 3 bytes at AmsiScanBuffer offset
| where AmsiBytes != original_bytes

D3FEND counters: D3-PSM (Process Spawn Monitoring), D3-PMC (Process Module Code Manipulation Detection). Hardening: **AMSI Provider DLL pinned

  • signed**.

ntdll unhooking — evasion/unhook

ArtifactWhere
NtCreateSection/NtMapViewOfSection call sequence opening a fresh ntdll.dll from diskProcess memory access pattern
Original syscall stubs 4C 8B D1 B8 … re-written over EDR-hooked onesRX-page scan; compares running ntdll bytes against on-disk

Hunt: memory-scan ntdll RX section for stubs that diverge from on-disk bytes after the EDR's hook installer ran.

Sleep masking — evasion/sleepmask

ArtifactWhere
Process thread stack XOR-encrypted during sleepKernel thread-stack walking detects high-entropy stack regions
ROP chain (StrategyEkko)EDR call-stack heuristics — return addresses on stack don't match valid call sites
Timer queue API spike (StrategyTimerQueue)RtlCreateTimer, WaitForSingleObject patterns

D3FEND: D3-PSEP (Process Self-Modification). Hardening: kernel thread-stack walking on a 5–30 second cadence.

Injection — inject

Per-method telemetry (excerpt; full table per technique page):

MethodETW TI eventsDetection difficulty
MethodCreateThreadEVENT_TI_NTCREATETHREADvery-noisy
MethodCreateRemoteThreadEVENT_TI_NTCREATETHREADEX cross-processvery-noisy
MethodEarlyBirdAPCEVENT_TI_NTQUEUEAPCTHREAD + suspended processnoisy
MethodSectionMapNtCreateSection + NtMapViewOfSection(EXECUTE)quiet
MethodPhantomDLLNtCreateSection(SEC_IMAGE) from a non-existent on-disk pathvery-quiet
MethodKernelCallbackTableKernelCallbackTable write to PEBvery-quiet (rare in legit)
MethodModuleStompRX-page write to a loaded modulequiet
MethodThreadHijackNtSuspendThread + NtSetContextThread cross-processnoisy

See docs/techniques/injection/ for the per-method artifact list.

Credential access — credentials/*

PackageTelemetry
credentials/lsassdumpOpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, …, lsass.exe PID) from non-system context
credentials/sekurlsaNone standalone — operates on a dump file
credentials/samdumpLive mode: reg.exe save HKLM\SAM …. Offline: file read of registry hive
credentials/goldenticketLsaCallAuthenticationPackage(KerbSubmitTicketMessage, …) — visible in TI provider

Hardening: Credential Guard (LSASS in VTL1) defeats lsassdump write/read; Protected Process Light (PPL) requires the BYOVD unprotect path which is itself detectable via signed-driver provenance events (Sysmon Event 6).

Persistence — persistence/*

MechanismEvent logSysmon equivalent
Registry Run/RunOncenone built-inEvent 12 / 13 (registry write)
Startup folder LNKnoneEvent 11 (file create)
Scheduled Task (COM)TaskScheduler-Operational 4698Event 4698
Windows Service installSystem log 7045Event 4697
Local account creationSecurity 4720

D3FEND: D3-RAPA (Resource Access Pattern Analysis), D3-PFV (Persistent File Volume Inspection).

Cleanup — cleanup/*

The most-overlooked area for blue. Cleanup deliberately removes artifacts the rest of the chain would have left.

TechniqueWhat it erasesWhat it leaves
cleanup/selfdeleteImplant binary on diskNTFS $Bitmap change, $LogFile entry, ADS rename log
cleanup/timestompFile timestamp recency$STANDARD_INFORMATION updated; $FILE_NAME MFT timestamps unchanged (forensic disparity)
cleanup/wipe (memory.WipeAndFree)Sensitive bytes in process memoryNtFreeVirtualMemory call
cleanup/adsStream existenceNTFS $Data:streamname MFT entry remains visible to MFT-aware tooling
cleanup/bsodAll in-memory stateCrash dump (if configured)

Forensic detection: MFT inconsistency between $STANDARD_INFORMATION and $FILE_NAME timestamps is the canonical timestomp tell.

Hardening recommendations

  1. Enable ETW Threat Intelligence provider and ship its events to your SIEM. Single highest-leverage signal for this entire library.
  2. Credential Guard + LSASS in PPL (kernel RunAsPPL=1).
  3. WDAC / AppLocker with publisher allow-list — defeats Donut-loaded PE shellcode if PE policy applies (depends on AMSI integration).
  4. Sysmon with SwiftOnSecurity baseline covers most artifact categories above.
  5. Driver block-list policy — Microsoft's vulnerable driver block list includes RTCore64; enable it.

Hunt repository (placeholder)

[!NOTE] A docs/hunts/ directory with Sigma rules and KQL queries per technique is on the Phase 5 roadmap. Until then, the per-technique "OPSEC & Detection" sections (mandatory by doc-conventions) carry the hunt-relevant artefacts.

Where to next

  • Researcher path — same techniques explained from the attacker design angle.
  • Operator path — see how the chain composes; useful for red-team / purple-team coordination.
  • MITRE map — full ATT&CK / D3FEND reconciliation.
  • docs/techniques/ — drill into any specific technique.