Lesson 3 of 9 · 25m
Handles, DLLs, and Process Injection
Understand object handles, DLL loading, and common injection mechanics well enough to recognize abuse without memorizing malware names.
Windows is an object system under the polish. Processes, threads, files, registry keys, events, mutexes, sections, and tokens are represented as kernel objects, and user-mode code reaches them through handles. That detail matters because nearly every serious intrusion eventually crosses a process boundary: opening another process, reading its memory, writing code into it, hijacking a thread, or loading a DLL.
Handles describe capability across boundaries
A handle is not a pointer. It is a reference in a process-specific handle table, with access rights attached. When malware calls OpenProcess, the requested access mask determines what it can do next:
PROCESS_QUERY_INFORMATION inspect; PROCESS_VM_READ read memory; PROCESS_VM_WRITE write memory
PROCESS_CREATE_THREAD create remote threads; PROCESS_ALL_ACCESS broad control, noisy and suspiciousA legitimate management tool may request broad access. A random Office process doing it is different. Context beats signatures.
DLL loading is useful and dangerous
Dynamic-link libraries are the normal extension model for Windows software. They are also a durable abuse surface because the loader is complex and trusts search-order details operators often misunderstand:
rundll32.exe example.dll,ExportedFunction
regsvr32.exe payload.dllrundll32.exe and regsvr32.exe are signed Microsoft binaries. That is precisely why attackers like them. The interesting question is not whether the host binary is trusted; it is what DLL path, export, and parent process are involved.
Classic injection is a sequence
The textbook remote-thread pattern is simple enough to remember:
OpenProcess(target) -> VirtualAllocEx -> WriteProcessMemory -> CreateRemoteThreadReal tradecraft varies: thread hijacking, APC injection, process hollowing, module stomping, reflective loading, and direct syscalls. Do not collect names like trading cards. Ask what primitive the attacker needed: memory allocation, memory write, execution redirection, or credential access.
Sideloading abuses trust in packaging
Many applications load DLLs from their own directory before system locations. If an attacker drops a signed legitimate executable beside a malicious DLL with an expected name, the executable may load the attacker-controlled dependency. The executable's signature stays valid, which makes shallow allowlisting look healthier than it is.
C:/Users/victim/AppData/Local/Updater/app.exe signed and legitimate
C:/Users/victim/AppData/Local/Updater/version.dll attacker-controlledModern mitigations reduce some of this, but installers, portable applications, and user-writable program directories keep the pattern alive.
What defenders should capture
Before terminating a suspicious process, capture parentage, command line, loaded modules, network connections, open handles, signer status, memory regions, and thread start addresses where your tooling allows. Sysinternals tools are still foundational:
handle64.exe -p 4242 & listdlls64.exe 4242 & procexp64.exeField notes
PROCESS_ALL_ACCESSis noisy because developers use it lazily, not because only attackers use it.- Unsigned does not mean malicious; Microsoft-signed does not mean benign. Behavior binds the evidence together.
- Injection into
explorer.exe, browsers, or system processes often aims for stealth, persistence, or credential access. - User-writable directories beside signed executables are high-value sideloading locations.
- Memory evidence decays fast. Process creation logs explain origin; memory explains what happened next.
Was this lesson helpful?