hackweb
notes on hacking and technology
IT EN
main menu
user menu
you are not logged in

Process injection: running code in another process

April 8, 2025 · 1 min read · #malware #windows #injection

Injecting code into a legitimate process (explorer.exe, a browser) lets you run under its identity, inherit its privileges and blend in.

The canonical technique

h = OpenProcess(target)
p = VirtualAllocEx(h, ..., PAGE_EXECUTE_READWRITE)
WriteProcessMemory(h, p, shellcode, ...)
CreateRemoteThread(h, ..., p, ...)

Stealthier variants avoid CreateRemoteThread: APC injection (queue a function on an existing thread), thread hijacking (suspend a thread, change its context), shared-section mapping.

Defence

EDRs watch the VirtualAllocEx+WriteProcessMemory+CreateRemoteThread sequence and RWX regions. CFG, blocking unsigned code (WDAC), and Defender ASR rules reduce the surface. RWX allocations in a process are a strong indicator.


« back to home

latest posts
 
your IP address:
216.73.216.108
visitor #1
MOTD:
Every abstraction leaks somewhere.
Here we look at where.
topics