Remote Administration
Every remote administration protocol is simultaneously a lateral movement protocol. WinRM, RDP, WMI, and DCOM are the same channels defenders use and attackers abuse. The difference is in the credentials, the source, and the behavior pattern.
During an incident response engagement, the IR team reviews domain controller logs for a two-week window. They find hundreds of Event ID 4624 logon type 3 (network logon) events to a finance server — but the source account is a domain administrator account that belongs to one of the company's IT staff. The IT staff member says they never logged into the finance server. The logs show connections from that admin's workstation. The workstation was compromised three weeks earlier. The attacker had the admin's credentials and was using them via WinRM to run commands on the finance server, mining data — the activity was buried in legitimate admin traffic because the authentication events looked identical.
This chapter explains how each remote administration channel works, what it looks like in logs, and how to distinguish attacker lateral movement from administrator activity.
WinRM and PowerShell Remoting
WinRM (Windows Remote Management) is Microsoft's implementation of the WS-Management protocol, used by PowerShell Remoting, Server Manager, and various management tools. It listens on TCP 5985 (HTTP) and TCP 5986 (HTTPS) and is the primary mechanism for running PowerShell commands on remote machines.
WinRM Authentication and Session Flow
══════════════════════════════════════════════════════════════════════
PowerShell: Invoke-Command -ComputerName server01 -ScriptBlock {...}
│
▼
Client side: WinRM client
─────────────────────────────────────────────────────────────────
1. TCP connection to server01:5985 (HTTP)
2. Negotiate authentication protocol:
• Kerberos (preferred on domain — uses TGT to get service ticket)
• NTLM (fallback — presents NT hash challenge-response)
• CredSSP (delegates full credentials to remote — risky)
3. Authentication complete → WS-Management session established
Server side: WinRM listener (WS-Management service)
─────────────────────────────────────────────────────────────────
4. Receives connection on port 5985
5. Authenticates user → creates access token
6. Spawns wsmprovhost.exe (WinRM Provider Host)
• Runs PowerShell in the wsmprovhost.exe process
• Executes the script block in the remote user's context
• Returns output back through the WS-Management session
Event logs generated on the server:
─────────────────────────────────────────────────────────────────
Event 4624 (Security): Logon Type 3 (Network Logon)
Account: CORP\admin_alice
Source IP: 10.1.2.100 (admin's workstation)
LogonProcess: Kerberos or NtLmSsp
Sysmon Event 1 (Process Create):
Image: C:\Windows\System32\wsmprovhost.exe
ParentImage: C:\Windows\System32\svchost.exe
CommandLine: wsmprovhost.exe -Embedding
User: CORP\admin_alice
| WinRM Auth Method | What's Transmitted | Security Risk |
|---|---|---|
| Kerberos | Kerberos service ticket. Password/hash never sent over the wire. | Low. Standard Kerberos authentication. Attacker needs valid TGT (or pass-the-ticket). |
| NTLM | Challenge-response using NT hash. Hash not sent; response computed from hash. | Medium. Susceptible to pass-the-hash, NTLM relay if signing not required. |
| CredSSP | Full credentials (username + plaintext password) are encrypted and forwarded to the remote machine. | High. Remote machine receives cleartext credentials. Compromise of remote = credential theft. Default for double-hop scenarios. |
| Basic | Username and password in Base64 (not encrypted). | Critical. Avoid entirely. Only useful over HTTPS (5986) but even then, avoid Basic. |
CredSSP (Credential Security Support Provider) was designed to solve the double-hop problem: when you remotely connect to server A and need server A to connect to server B on your behalf (e.g., running a script that accesses a network share), standard Kerberos delegation doesn't forward your credentials automatically. CredSSP solves this by transmitting your full credentials to server A, which can then use them to authenticate to server B. The risk: if server A is compromised, the attacker running on server A receives your plaintext credentials through the CredSSP subsystem. Attackers who have already compromised a server sometimes enable CredSSP (it's off by default for incoming connections) to harvest credentials from administrators who connect to the compromised machine.
RDP Security: Three Configurations with Different Security Profiles
Remote Desktop Protocol (RDP) operates on TCP 3389 and allows full interactive graphical sessions. Its security configuration has three distinct modes with significantly different security properties.
RDP Security Modes
══════════════════════════════════════════════════════════════════════
1. Classic (Legacy) RDP Security
─────────────────────────────────────────────────────────────────
Authentication: RDP proprietary challenge-response
Credential handling: Password transmitted after RC4 encryption
NLA: No — credentials entered after graphical session starts
Risk: Vulnerable to credential capture via MitM. Login screen
exposed to network before authentication completes.
BlueKeep (CVE-2019-0708) exploited pre-auth RDP.
2. NLA (Network Level Authentication) — Recommended
─────────────────────────────────────────────────────────────────
Authentication: Kerberos or NTLM completes BEFORE graphical session
Credential handling: Not transmitted in clear; authenticated via
CredSSP at the network level
NLA: Yes — user must authenticate before seeing the login screen
Risk: Reduces attack surface significantly — the graphical RDP
session only opens after authentication. Brute-force
still possible but costs a complete auth attempt per try.
Vulnerable to pass-the-hash since NTLM is used when
Kerberos is unavailable.
3. Restricted Admin Mode
─────────────────────────────────────────────────────────────────
Authentication: Connects with local machine credentials (no
credential forwarding to remote)
Credential handling: User's credentials NOT sent to remote machine;
remote sees the machine account, not the user
NLA: Uses NLA
Risk: Prevents credential theft on the remote machine — attacker
who compromises the remote can't steal the RDP user's
password because it was never there. BUT: enables pass-the-hash
RDP connections (an attacker with only the NT hash can RDP
to the machine in Restricted Admin mode without the password).
NLA protects against: attackers scanning for open RDP to brute-force or exploit pre-auth vulnerabilities. It moves authentication before the session begins. Restricted Admin Mode protects against: credential theft on a compromised jump server — the admin's credentials are never materialized on the remote machine. Use NLA as the baseline everywhere. Use Restricted Admin Mode for privileged access workstations and jump servers where you specifically want to prevent credential forwarding, while accepting the pass-the-hash tradeoff for that specific scenario.
WMI and DCOM as Remote Execution Vectors
WMI (Windows Management Instrumentation) and DCOM (Distributed Component Object Model) are two of the most heavily abused "legitimate" remote execution mechanisms in Windows environments. They're built-in, they generate minimal logging compared to WinRM, and they're difficult to block without affecting management tools.
WMI Remote Execution Architecture
══════════════════════════════════════════════════════════════════════
Attacker or Admin runs:
wmic /node:target_server process call create "powershell.exe -enc ..."
Flow on target machine:
─────────────────────────────────────────────────────────────────
1. DCOM connection on TCP 135 (endpoint mapper)
Endpoint mapper returns dynamic high port for WMI service
2. Authentication (NTLM or Kerberos) on the dynamic port
3. WMI service (winmgmt, in svchost.exe) receives the request
4. Creates a process via the Win32_Process class
5. Process created as the authenticated user
Event logs generated (with default auditing):
─────────────────────────────────────────────────────────────────
Event 4624: Logon Type 3 (network logon)
Event 4688: Process created (if Process Auditing enabled)
New Process: powershell.exe
Creator: svchost.exe / WmiPrvSE.exe
Sysmon events (if deployed):
─────────────────────────────────────────────────────────────────
Event 1 (Process Create):
Image: powershell.exe
ParentImage: WmiPrvSE.exe ← HIGHLY SUSPICIOUS
ParentCommandLine: C:\Windows\System32\wbem\WmiPrvSE.exe
WmiPrvSE.exe spawning child processes = WMI process creation
This is a reliable attacker indicator in most environments
(legitimate WMI management rarely needs to spawn shells)
| Remote Execution Method | Protocol / Port | Detection Indicators | Logging Without Sysmon |
|---|---|---|---|
| WinRM / PSRemoting | HTTP 5985 / HTTPS 5986 | Event 4624 logon type 3; wsmprovhost.exe process creation | Fair — logon event exists; process audit shows wsmprovhost |
| WMI | DCOM 135 + dynamic | Event 4624 logon type 3; WmiPrvSE.exe spawning child processes | Poor without Sysmon — process creation shows parent as WmiPrvSE.exe only if audit policy is correct |
| SMB / PsExec-style | TCP 445 | Event 4624 logon type 3; Service creation (Event 7045); PSEXESVC service name | Fair — service creation events are logged by default |
| RDP | TCP 3389 | Event 4624 logon type 10 (RemoteInteractive); EventID 4778 (session reconnected) | Good — dedicated logon type distinguishes RDP from network logons |
| Scheduled Task (remote) | SMB 445 + task sched RPC | Event 4624 logon type 3; Event 4698 (scheduled task created); schtasks.exe | Good — task creation events logged by default if audit policies correct |
Detecting Lateral Movement vs Legitimate Admin Traffic
The fundamental challenge of lateral movement detection is that attacker traffic looks identical to administrator traffic at the protocol level — both use valid credentials, valid protocols, and valid authentication. Detection must rely on behavioral context: what account, from what source, to what destination, at what time, doing what.
Lateral Movement Detection Signals
══════════════════════════════════════════════════════════════════════
Signal 1: Unusual Source → Destination pairs
─────────────────────────────────────────────────────────────────
Normal: Jump server 10.1.1.50 → Production servers
Anomalous: Workstation 10.2.1.100 → Production servers
(workstations don't normally administer servers)
Signal 2: Unusual account for the target
─────────────────────────────────────────────────────────────────
Normal: Domain Admin account → DC
Anomalous: Developer account → Finance server
Helpdesk account → HR database server
Signal 3: Unusual time patterns
─────────────────────────────────────────────────────────────────
Normal: Admin activity during business hours
Anomalous: Lateral movement at 2 AM from a "logged off" account
(Attacker runs on their own schedule, not the user's)
Signal 4: Process spawned from remote execution parent
─────────────────────────────────────────────────────────────────
WmiPrvSE.exe → cmd.exe / powershell.exe (WMI execution)
wsmprovhost.exe → cmd.exe / powershell.exe (WinRM execution)
services.exe → cmd.exe / powershell.exe (PsExec-style)
Signal 5: Logon type tells you the mechanism
─────────────────────────────────────────────────────────────────
Logon Type 2: Interactive (physically at keyboard)
Logon Type 3: Network (SMB, WMI, WinRM, net use)
Logon Type 4: Batch (scheduled tasks)
Logon Type 5: Service logon
Logon Type 7: Unlock (screen saver return)
Logon Type 8: NetworkCleartext (Basic auth, CredSSP delegation)
Logon Type 9: NewCredentials (runas /netonly)
Logon Type 10: RemoteInteractive (RDP)
Logon Type 11: CachedInteractive (offline domain logon)
The LOLBAS (Living Off the Land Binaries and Scripts) technique is the attacker answer to behavioral detection: instead of dropping custom malware that EDR might flag, use tools that are already installed on the machine and used by legitimate administrators. WMI is a perfect example — administrators use it for remote management, so WMI-based lateral movement blends into normal traffic. Similarly, attackers use PowerShell (legitimate admin tool), wmic.exe (legitimate admin tool), certutil.exe (used to download payloads), and reg.exe (for persistence via registry), all of which are signed Windows binaries. The detection answer is not to block these tools (that would break legitimate administration) but to detect anomalous usage: certutil.exe downloading from an external URL, reg.exe writing to Run keys from a non-admin context, WMI executing PowerShell from an unusual parent. Context matters more than the tool itself.
Q & A
1. An Event 4624 with logon type 3 fires on a production database server, source account is a domain admin, source IP is a developer workstation. How do you investigate this?
Start with timeline context. Pull the developer workstation's events around the same time: Is there evidence the actual user was working at that time (logon events, process activity)? If the workstation shows the user was logged off or the machine was sleeping, a logon type 3 from that IP is highly suspicious — it suggests an attacker using the workstation as a source. Next, look at what process on the database server initiated or responded to the connection: Sysmon Event 3 (Network Connection) on the server would show the destination port and process. Event 4624 alone doesn't tell you what was done after logon — look for subsequent process creation events (4688 or Sysmon Event 1) under that account in the minutes following the logon. Also check the logon process field in 4624: if it shows NtLmSsp (NTLM), consider whether this account should be using Kerberos (on a domain, Kerberos is preferred; fallback to NTLM for administrative connections can indicate pass-the-hash). If it shows Kerberos, the attacker had either the password or a TGT/ticket. Look for Event 4769 (Kerberos ticket request) near the same time to see if a new service ticket was requested for the database server.
2. What is "pass-the-ticket" and how does it differ from pass-the-hash?
Pass-the-hash uses a stolen NT hash to authenticate via NTLM. Pass-the-ticket uses a stolen Kerberos ticket — either a Ticket-Granting Ticket (TGT) or a service ticket — to authenticate to Kerberos-protected services without knowing the password or hash. The attacker injects the stolen ticket into their own Kerberos ticket cache (using mimikatz kerberos::ptt or similar), and Windows's Kerberos client uses it for subsequent authentications. The ticket was legitimately issued by a domain controller to the real user — so from the service's perspective, it's a valid ticket. TGTs are stored in LSASS memory for the duration of the logon session; an attacker who can read LSASS memory can extract and reuse them until they expire (typically 10 hours). Service tickets are shorter-lived but also extractable. The relevant detection difference: pass- the-hash generates NTLM authentication events; pass-the-ticket generates Kerberos events from the attacker's machine (Event 4768/4769 on the DC may show ticket requests from unexpected source IPs, and the service authentication events won't have a preceding 4624 logon on the domain controller from the expected source).
3. PsExec creates a service on the remote machine. Why is this a reliable detection signal?
PsExec (and tools that mimic its behavior) work by copying a binary to the target machine's ADMIN$ share (C:\Windows), then creating a service to execute it. This generates several detectable events: Event 4624 logon type 3 (the SMB authentication to copy the binary); Event 4697 (a service was installed in the system) or Event 7045 (a new service was installed) in the System log; Sysmon Event 11 (FileCreate) for the binary being written to Windows\ directory; Sysmon Event 1 (ProcessCreate) when the service binary executes with services.exe as parent; and Event 4624 logon type 3 again for the service's authentication. The PSEXESVC.exe binary name is the default — security-aware attackers rename it, but the service creation pattern (service created, executed once, then deleted) remains detectable. Service names with random character strings or service binaries in ADMIN$ are high-confidence lateral movement indicators. Event 7045 (new service installed) is one of the highest-signal events in Windows because legitimate service installation is infrequent and typically associated with application installs, not random remote connections.
4. Why is RDP logon type 10 important for distinguishing interactive vs remote sessions in forensics?
Logon type 10 (RemoteInteractive) is generated when a user logs on via RDP. This is distinct from logon type 2 (Interactive, physical console) and logon type 3 (Network, non-interactive like SMB/WMI). The forensic importance: logon type 10 tells you the user interacted with the machine graphically — they saw the desktop, could run applications, browse files. This is evidence of human-interactive presence, not just automated lateral movement. Combined with RDP-specific events: Event 4778 (session reconnected) and 4779 (session disconnected) show the RDP session lifecycle. Event 4648 (explicit credential logon) with the target matching an RDP-connected machine shows the credentials used to initiate the RDP session. Shadow sessions (an attacker monitoring another user's RDP session without that user knowing) generate Event 4648 and 4624 with the shadow connection's credentials, alongside the original session's events — this is detectable as two concurrent sessions on the same machine for overlapping time periods.