Process Hypnosis is an advanced code injection technique that manipulates a target process's execution flow by acting as its debugger. Unlike traditional methods like CreateRemoteThread
or Process Hollowing
, it avoids suspicious API calls and memory allocation patterns, making it harder for security solutions to detect. Inspired by Carlos Garrido's research, this technique "hypnotizes" a process by freezing it during initialization, modifies its memory, and resumes execution with malicious code.
-
Debugger Attachment
Create a target process (e.g.,notepad.exe
) with theDEBUG_ONLY_THIS_PROCESS
flag usingCreateProcessW
. This freezes the process until debug events are handled. -
Event Monitoring
UseWaitForDebugEvent
to capture critical events:CREATE_PROCESS_DEBUG_EVENT
: Extract the main thread's start address.LOAD_DLL_DEBUG_EVENT
: Enumerate loaded modules withoutGetModuleHandle
.
-
Shellcode Injection
Overwrite the main thread's entry point (lpStartAddress
) with malicious shellcode viaWriteProcessMemory
. The debugger automatically bypasses memory protection checks. -
Detach & Execute
CallDebugActiveProcessStop
to unfreeze the process. Execution resumes at the modified entry point, triggering the shellcode.
- No Suspicious APIs
AvoidsVirtualAllocEx
,CreateRemoteThread
, andResumeThread
– common EDR/AV detection vectors. - No Memory Allocation
Directly hijacks the existing thread's entry point instead of allocating new memory regions. - Debugger-Powered Stealth
Leverages legitimate debugging mechanisms to evade IAT/Inline hooks. - Symbol Resolution
UsesSymFromName
(instead ofGetProcAddress
) to resolve function addresses likeNtProtectVirtualMemory
.
Author: @5mukx
Hypnotize processes, not people. ~ 5mukx