Reflective DLL Injection — DLLs That Load Themselves
Origin and Concept
┌──────────────────────────────────────────────────────────────────────┐
│ Comparison: LoadLibrary vs. Reflective Loading │
│ │
│ LoadLibrary (traditional): │
│ Disk → ntdll loader → Mapping → Import resolution │
│ ↳ File on disk required │
│ ↳ DLL registered in PEB (InLoadOrderModuleList) │
│ ↳ Detectable by module enumeration │
│ │
│ Reflective Loading: │
│ Raw buffer in memory → ReflectiveLoader (inside DLL) │
│ → Self mapping → Import resolution → DllMain │
│ ↳ No file on disk │
│ ↳ DLL NOT registered in PEB │
│ ↳ Invisible to EnumProcessModules and GetModuleHandle │
└──────────────────────────────────────────────────────────────────────┘Reflective DLL Structure
Implementing the ReflectiveLoader
Step 1: Locate Its Own Base
Step 2: Resolve kernel32 Addresses Without an Import Table
Step 3: Resolve GetProcAddress and LoadLibraryA by Hash
Step 4: Allocate Memory and Map Sections
The Injector Side: Injecting the Reflective DLL
Practical Applications
Detection
References
PreviousProcess Hollowing — Gutting Legitimate ProcessesNextPPID Spoofing — Forging the Process Tree
Last updated