18.DLL-injection
Windows API Calls (DLL Injection)
Registry (DLL Hijacking)
Process Monitoring (DLL Hijacking)
Key Concepts:
DLL Injection:
Inserting a DLL into a running process to execute arbitrary code.
Used for legitimate purposes (hot patching) and malicious activities.
LoadLibrary:
Windows API function for loading DLLs.
Can be used for remote DLL injection.
Manual Mapping:
Directly mapping DLL sections into a process's memory.
Bypasses
LoadLibrary
monitoring.
Reflective DLL Injection:
DLL loads itself from memory, minimizing host interaction.
DLL Hijacking:
Exploiting the Windows DLL search order to load a malicious DLL.
Relies on missing or weakly specified DLL paths.
DLL Proxying:
Creating a proxy DLL that loads the original DLL, modifies its functions, and returns the modified result.
Approach, Commands, Tools, and Techniques:
LoadLibrary Injection:
OpenProcess
,VirtualAllocEx
,WriteProcessMemory
,GetProcAddress
,CreateRemoteThread
(Windows API calls).
Manual Mapping:
Load DLL as raw data, map sections, inject shellcode.
Reflective DLL Injection:
ReflectiveLoader
function within the DLL.Parses PE headers, resolves imports, relocates DLL.
DLL Hijacking:
Process Explorer, PE Explorer (DLL analysis).
Process Monitor (procmon) to monitor file access.
Create malicious DLLs.
Regedit to modify the SafeDllSearchMode.
DLL Proxying:
Create a proxy DLL that loads the original DLL.
Modify the desired function within the proxy DLL.
Replace the original DLL with the proxy DLL.
Commands:
Windows API calls:
OpenProcess
,VirtualAllocEx
,WriteProcessMemory
,GetProcAddress
,CreateRemoteThread
,LoadLibrary
,FreeLibrary
.Regedit.
Process Monitor(procmon).
Tools:
Process Explorer.
PE Explorer.
Compilers (C).
Debuggers/Disassemblers.
Techniques:
Creating malicious DLLs.
Modifying DLL functions.
Monitoring process activity.
Reverse engineering.
Last updated