T1038 DLL Search Order Hijacking Persistence - CraigDonkin/Infrastructure GitHub Wiki
- Requires User/Admin or SYSTEM perms
- If the DLL doesn't exist or is loaded without a fully qulified path
- Replace the dll with malicious one
- File Perms important
- Can you write to the location?
- If the DLL doesn't exist can you write to anywhere on the search order that will load the DLL
https://docs.microsoft.com/en-us/windows/desktop/Dlls/dynamic-link-library-search-order
- The directory from which the app is loaded
- The system directory
- The 16-bit system directory
- The windows directory
- The current directory
- Directories listed in the PATH environment Variable
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SafeDllSearchMode > 0
- Directory the app is loaded
- The current directory
- The system directory
- The 16-bit system directory
- The windows directory
- Directories in PATH
- Identify processes with missing DLLs
- Proc Mon
- Find-ProcessDLLHijack (PowerSploit)
- Check the folder permissions of the location of the DLL
- Can you write to here?
- icacls
- Find-PathDLLHijack (PowerSploit)
- Write the DLL
- DLL will need to be name of the one that is expected
- Write-HijackDLL (Powersploit)
- Can you write to here?
https://www.gracefulsecurity.com/privesc-dll-hijacking/ BGINFO example
https://www.fuzzysecurity.com/tutorials/16.html IKEEXT Example