Skip to content
Threat Feed
medium advisory

Detection of PowerShell Remote Session Establishment

Adversaries utilize the New-PSSession cmdlet to establish remote PowerShell sessions for lateral movement and command execution within Windows environments.

PowerShell is a standard administrative tool that is frequently abused by threat actors to perform lateral movement and remote code execution across enterprise networks. By using the New-PSSession cmdlet, attackers can establish persistent connections to remote hosts, allowing them to execute commands, stage additional malware, or exfiltrate data from compromised assets. This technique is often seen in the context of fileless attacks where malicious scripts are executed in memory. Monitoring for the creation of these sessions is critical for identifying unauthorized lateral movement and preventing the escalation of privileges within a domain environment. Defenders should focus on capturing PowerShell Script Block logs to gain visibility into the command structure and parameters used during these sessions.

Impact

Successful abuse of remote PowerShell sessions allows attackers to move laterally through an environment without the need for additional specialized tooling. This can lead to the compromise of sensitive data, domain-wide privilege escalation, and persistent access for threat actors. If left undetected, attackers can maintain control over multiple endpoints while avoiding traditional file-based detection mechanisms.

Recommendation

Prioritized actions for detection and prevention:

  • Enable PowerShell Script Block Logging (Event ID 4104) across the environment to capture full command executions.
  • Deploy the Sigma rule below to identify the use of New-PSSession with remote computer targets.
  • Baseline legitimate administrative activity to reduce noise, specifically excluding known automation service accounts or management servers.
  • Implement restrictive PowerShell constrained language mode where administrative requirements permit.

Immediate actions

Enable PowerShell Script Block Logging (Event ID 4104) across all endpoints

IT Operations 72h

Threat Hunt

Search for high volumes of New-PSSession commands originating from workstations rather than jump servers

T1059.001 medium medium confidence convert to detection

Data: Event ID 4104 logs

Detection coverage 1

Detect PowerShell Remote Session Creation

medium

Detects the use of the New-PSSession cmdlet targeting a remote computer, which may indicate lateral movement

sigma tactics: execution techniques: T1059.001 sources: ps_script, windows

Detection queries are available on the platform. Get full rules →