It's possible to create custom services, which will run with a local or a domain account. When you have high enough privilege's, it's possible to retrieve the credentials of the service.
Configuring
For this example we have created the user noah onto the Domain Controller. The following command should be executed:
net user Noah haoNHasAStrongPassword321!@ /domain /add
Login with an Administrator account into the machine, where you want to configure the service. In our example we will configure this within WS01.
Open up cmd.exe
We're going to execute the command:
sc create <name> binPath="C:\nonexisting.exe" obj="<username>@<domain>" password="<plaintext password or NTLM hash of the user>"
The password of the service can be fake. So to make our attack a bit more fun, we're going to place the NTLM hash of the user Noah. This will enable us to make it a 'pass-the-hash' attack.
In our example we're going to execute the following command:
Execute MimiKatz. This can be done in many ways. In our example we will be hosting Invoke-mimikatz.ps1 on our attacker machine. Download mimikatz into memory using the following command and then execute MimiKatz:
The result is that our freshly created service is shown, including with username and NTLM Hash:
With the hash we can try to execute pass-the-hash attacks.