Improper file permissions on service executable
- Check Running services
- Verify improper file permissions on service executable file (use icacls to check)
- Replace the service executable binary with malicious exe
- Try to restart the service
- May be reboot the windows if cannot restart the service. Verify permissions first
// check if service auto restart on reboot
wmic service where caption="Serviio" get name, caption, state, startmode
// check if we have privilege to shut down system
whoami /priv
// reboot
shutdown /r /t 0
Leveraging Unquoted Service Paths
- Enumerate Services
- Check if any of the high privilege service has spaces in path and the path is unquoted
- Check if we have permission to write to any of the folder in the path
- Let say we have a service stored in a path such as
C:\Program Files\My Program\My Service\service.exe
. If the service path is stored unquoted, whenever Windows starts the service, it will attempt to run an executable from the following paths:C:\Program.exe C:\Program Files\My.exe C:\Program Files\My Program\My.exe C:\Program Files\My Program\My service\service.exe
- If we can write, place the malicious binary to shortest path and restart the service(or reboot machine).
Windows Kernel Vulnerabilities
- Enumerate drivers (
driverquery /v
) - Look for third party drivers installed such as USBPcap
- Search for known kernel/driver exploits
- Cross-verify the driver version. Should be exact match.