Hijack Execution Flow (T1574)
Using the trust of a legitimate application to launch our malware.
1. DLL Hijacking (DLL Search Order)
When legit.exe needs library.dll, Windows searches in a specific order:
- The directory
legit.exeis in. - System32.
- System Path.
Attack:
- Find a privileged app that tries to load a missing DLL (e.g.,
cscapi.dll). - Place our malicious
cscapi.dllin the application's folder. - Restart the app. It loads our DLL as System.
2. Unquoted Service Paths
If a service path contains spaces and is unquoted:
C:\Program Files\Vulnerable App\service.exe
Windows tries to execute in this order:
C:\Program.exeC:\Program Files\Vulnerable.exeC:\Program Files\Vulnerable App\service.exe
Attack:
- Drop a binary named
Program.exeorVulnerable.exein the path. - When the service starts (System), it runs our file.
3. Services Registry Permissions
If the ACL on a Service's Registry Key (HKLM\SYSTEM\CurrentControlSet\Services\VulnService) allows "Write":
- Change
ImagePathtoC:\Temp\malware.exe. - Stop/Start the service.
- You are now System.