Windows Privilege Escalation with DLL Hijacking
Contains the details of the topic Privilege Escalation/Windows/Various/DLL Injection.
Similar to Modifiable Service Binaries but with DLLs (Dynamic Link Libraries).
We can:
Overwrite a DLL
Hijack the DLL search order
Exploit a missing DLL
Search Order
The default DLL search order used by the system depends on whether Safe DLL Search Mode
is activated. By default it is enabled.
With this mode enabled, applications search for necessary DLL files in the following sequence:
The directory from which the application is loaded.
The system directory.
The 16-bit system directory.
The Windows directory.
The current directory.
The directories that are listed in the PATH environment variable.
However, if 'Safe DLL Search Mode' is deactivated, the search order changes to:
The directory from which the application is loaded.
The current directory.
The system directory.
The 16-bit system directory.
The Windows directory
The directories that are listed in the PATH environment variable
Pinpoint a DLL
View service DLLs. See the permissions of those DLLs, whether they are editable and therefore overwritable, or whether they are missing.
Process Explorer (it also shows DLLs used for each process)
Malicious DLL
Each DLL can have an optional entry point function called DllMain
, which is executed when processes or threads attach the DLL. This function usually contains four cases called DLL_PROCESS_ATTACH
, DLL_THREAD_ATTACH
, DLL_THREAD_DETACH
, DLL_PROCESS_DETACH
.
Last updated