Service Exploits
NB: You have to be able to start/stop a service to exploit
Insecure Service Properties
Find the vulnerable service
Confirm access to the service
Check configuration
Check service state
Payload
Set service path to location of shell on victim
Start nc listener
Restart the service
Unquoted Service Paths
Useful when ability to write to the directory is present but can't overwrite files in the main directory
Abuses the way Windows looks for executable, for example
C:\Program Files\Service\Cool Service\svc.exe
C:\Program.exe
C:\Program Files\Service.exe
C:\Program FIles\Service\Cool.exe
Create an executable named appropriately and place in appropriate directory
Find vulnerability
Or use wmic
You need
Path to .exe that does not contain quotes
Write permissions to any prior folder in the tree
Confirm service access for your user
Check write permission to existing binary paths
If you have a writeable directory, name the reverse shell payload the $FolderName.exe
Put it in the directory
Start nc listener
Restart the service
Weak Registry Permissions
If ACL on a registry object is misconfigured, we could modify it even if we can't from the system normally
winpeas will find all of these
Verify
or
Check if you have permission to start and stop the service
Check the registry values for services
With permissions this can be overwritten and made to point to rev.exe payload
Start nc listener
Restart the service
Insecure Service Executables
If the .exe itself can be modified, can just replace it with our own msfvenom payload, renamed
Validate access
Confirm access to start/stop
Backup or rename original .exe
Overwrite or replace the backed-up .exe
Start nc listener
Restart the service
DLL Hijacking
Some programs require libraries loaded (DLLS)
If it contains an absolute path, or if the DLL is missing, and we have write access to the directory, we can essentially do the same as replacing the .exe itself to exploit
winpeas usually finds these
Check access to start/stop
Check the service
To be very sure, you can copy the service to a VM and check it with procmon to ensure the PATH, however, running the .exe from the location where the dll is located is usually enough. If you have GUI access it's easier to sus this out locally
Create a dll reverse shell
Copy into the folder with the path
Stop and start the service
Last updated