Skip to content
Threat Feed
high advisory

Detecting Potential PowerShell Pass-the-Hash/Relay Scripts

This rule detects PowerShell scripts associated with NTLM relay or pass-the-hash tooling and SMB/NTLM negotiation artifacts, indicating potential credential access and lateral movement attempts by attackers.

This detection identifies PowerShell scripts containing artifacts indicative of NTLM relay or pass-the-hash (PtH) attacks. These techniques allow attackers to authenticate to systems without needing plaintext passwords, enabling lateral movement and privilege escalation. The rule focuses on identifying specific byte sequences and strings within PowerShell script blocks that suggest NTLM/SMB negotiation and credential access attempts. This detection helps defenders identify and respond to potential credential theft and abuse within their Windows environments. The rule is based on observed techniques used in various publicly available tools such as Invoke-TheHash, Check-LocalAdminHash, and PoshC2.

Attack Chain

  1. An attacker gains initial access to a Windows system through various means such as phishing or exploiting a vulnerability.
  2. The attacker executes a PowerShell script on the compromised system. This script could be directly executed or obfuscated to evade initial detection.
  3. The PowerShell script attempts to perform NTLM relay or pass-the-hash attacks by utilizing specific byte sequences related to NTLM/SMB negotiation, such as NTLMSSPNegotiate or 0x4e,0x54,0x4c,0x4d,0x53,0x53,0x50.
  4. The script may utilize tools like Invoke-WMIExec or Invoke-SMBExec to execute commands on remote systems using the stolen credentials.
  5. The attacker attempts to authenticate to other systems on the network using the relayed credentials or password hashes.
  6. Successful authentication allows the attacker to move laterally, accessing sensitive data or escalating privileges on other systems.
  7. The attacker may deploy additional payloads or establish persistence mechanisms for continued access.

Impact

A successful pass-the-hash or NTLM relay attack can grant an attacker unauthorized access to sensitive systems and data within the network. This can lead to data breaches, financial loss, or disruption of critical services. The impact could range from compromising a few systems to gaining domain administrator privileges, depending on the attacker’s goals and the network’s security posture. Organizations can experience significant financial and reputational damage due to data breaches and service disruptions.

Recommendation

  • Enable PowerShell Script Block Logging to capture the necessary data for this detection. Refer to the setup instructions in the rule documentation for configuration details.
  • Deploy the Sigma rule Detecting Potential PowerShell Pass-the-Hash/Relay Scripts to your SIEM and tune it based on your environment.
  • Investigate any alerts generated by this rule to determine the scope and impact of the potential attack. Refer to the triage and analysis section in the rule documentation for guidance on investigation steps.
  • Implement network segmentation and access controls to limit the impact of lateral movement.
  • Monitor authentication events (event codes 4624, 4625, 4648) for suspicious activity, such as NTLM authentication from unexpected source IPs or to unusual target systems, as described in the rule’s investigation notes.

Detection coverage 2

Detecting Potential PowerShell Pass-the-Hash/Relay Scripts

high

Detects PowerShell scripts using specific byte sequences related to NTLM/SMB negotiation, indicating potential pass-the-hash or relay attacks.

sigma tactics: credential_access techniques: T1550.002, T1555 sources: process_creation, windows

Detect PowerShell Invoke-TheHash Tool Usage

high

Detects the use of PowerShell to execute Invoke-TheHash tools.

sigma tactics: credential_access techniques: T1550.002 sources: process_creation, windows

Detection queries are kept inside the platform. Get full rules →