The blog explains reflective DLL loading, a malware technique that executes a DLL directly from a process’s memory without writing it to disk. Unlike Windows’ `LoadLibrary`, reflective loading reduces exposure to file-based antivirus scanning and makes incident response and reverse engineering more difficult.
The technique begins by obtaining the DLL bytes, either by embedding them in a program or downloading them from a remote server. Downloading provides flexibility and allows attackers to remove or replace the payload, although embedding makes extraction from a static binary easier. The loader allocates memory based on the DLL’s `SizeOfImage` and preferred `ImageBase`, copies the PE headers and sections into the allocated region, applies relocation fixes if the DLL is loaded at a different address, and resolves imported libraries and functions. It then locates and calls the DLL’s entry point, commonly `DllMain`.
Reflective loading can also be adapted for remote-process injection, although the article focuses on loading into the current process. Attackers benefit because the payload may not appear in the process’s loaded-module list. Instead, it can resemble an ordinary memory allocation, though simplistic implementations may expose suspicious read-write-execute (RWX) permissions.
The article demonstrates implementations in C and C#. The example downloads a DLL generated to launch Calculator, stores it in memory, reflectively loads it, and executes it. The author notes that remote hosting can hinder forensic recovery because servers may remove the payload quickly, leaving memory capture as the primary investigative option.
Article timeline
Build this article’s timeline
Extract dated events, key actors, and open questions using the same timeline analysis available in Signal.
Comments
Login to view and post comments.