UNDERSTANDING UNQUOTED SERVICE PATH VULNERABILITIE¶
An unquoted service path vulnerability occurs when a service executable path contains folder names with spaces and lacks quotation marks around the entire path,The vulnerability arises from how Microsoft services handle executable paths. When a service path is properly quoted or contains no spaces, the service locates and runs the intended executable without issue. For instance:
BREAKING IT DOWN WITH AN EXAMPLE¶
If an attacker has write permissions in any of the directories before the actual executable location, they can create a malicious executable named after the directory in the path,When the service attempts to start, it will execute the malicious executable instead of the intended one, leading to potential compromise of the system,In order to run Service.exe, the system will interpret this path in the following order from 1 to 4.
- If C:\Program.exe is not found
C:\Program.exe
- then C:\Program Files\Common.exe would be executed
C:\Program Files\Common.exe
NOTE: If C:\Program Files\Common.exe is not found - then C:\Program Files\Common Files\Service.exe would be executed
C:\Program Files\Common Files\Service.exe
NOTE: If C:\Program Files\Common Files\Service.exe is not found - then C:\Program Files\Common Files\Service Folder\service.exe would be executed
C:\Program Files\Common Files\Service Folder\service.exe