APC Injection — Execution via Asynchronous Procedure Call Queues
What are APCs
┌──────────────────────────────────────────────────────────────────────┐
│ APC Execution Flow │
│ │
│ Target thread in normal state: │
│ [normal execution] → [calls WaitForSingleObjectEx(bAlertable=TRUE)]│
│ │ │
│ Enters alertable wait │
│ │ │
│ Attacker queues APC: ─────────▶ QueueUserAPC(shellcode, hThread) │
│ │ │
│ Thread wakes up to execute APCs │
│ │ │
│ [executes shellcode in thread context] │
│ │ │
│ Returns to thread's normal state │
└──────────────────────────────────────────────────────────────────────┘Technique 1: Classic APC Injection
Technique 2: Early Bird APC Injection
Technique 3: NtQueueApcThread — APC via Native API
Technique 4: APC via NtQueueApcThreadEx (Special User APC — Windows 10+)
Variant Comparison
Detection
References
PreviousShellcode Obfuscation — Hiding Payloads from Static DetectionNextHeaven's Gate — Calling 64-bit Code from a 32-bit Process
Last updated