Unquoted service paths are a classic Windows privilege escalation vector. When a service path contains spaces and isn't enclosed in quotes, Windows searches for executables in a predictable order. Place a malicious binary in the right spot, and it runs as SYSTEM when the service starts.
Think of it like a GPS giving ambiguous directions: "Go to Main Street Coffee Shop". Should you go to Main Street, or Main Street Coffee Shop? Windows has the same confusion - and we can exploit it.
Why It Works
Windows CreateProcess API interprets spaces as argument separators unless paths are quoted. It tries each interpretation until it finds an executable or runs out of options.
Understanding the Vulnerability
Why Third-Party Apps Are Vulnerable
Finding Unquoted Paths
PowerUp Automation
Checking Directory Writability
Check All Locations
Check every directory in the path, not just the first one. Often the parent directory of the service folder is writable even when Program Files root isn't.
Exploitation
Alternative Payloads
Anti-Virus Detection
msfvenom payloads are often detected by AV. Consider obfuscation, custom compilation, or using the add-user approach which is less flagged than reverse shells.
Triggering the Exploit
Complete Attack Walkthrough
Exploitation Methodology
Unquoted Path Exploitation
1
Findwmic query for unquoted paths with spaces
2
VerifyConfirm service runs as SYSTEM
3
Check Dirsicacls on each directory in path
4
Determine NameWork out what .exe filename to use
5
PayloadCreate malicious executable
6
PlaceCopy to writable location
7
TriggerRestart service or wait for reboot
Knowledge Check
Challenges
Key Takeaways
- Unquoted paths with spaces = Windows searches multiple locations
- Focus on third-party software, not Windows services
- Check ALL directories in the path for write access
- Filename must match what Windows would search for
- Service must run as LocalSystem for SYSTEM privileges
- Need to restart service or wait for reboot to trigger