PsExec Network Connection

Identifies use of the SysInternals tool PsExec.exe making a network connection. This could be an indication of lateral movement.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2020/02/18"
  3integration = ["endpoint", "windows"]
  4maturity = "production"
  5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
  6min_stack_version = "8.3.0"
  7updated_date = "2024/04/08"
  8
  9[rule]
 10author = ["Elastic"]
 11description = """
 12Identifies use of the SysInternals tool PsExec.exe making a network connection. This could be an indication of lateral
 13movement.
 14"""
 15false_positives = [
 16    """
 17    PsExec is a dual-use tool that can be used for benign or malicious activity. It's important to baseline your
 18    environment to determine the amount of noise to expect from this tool.
 19    """,
 20]
 21from = "now-9m"
 22index = ["winlogbeat-*", "logs-endpoint.events.process-*", "logs-endpoint.events.network-*", "logs-windows.sysmon_operational-*"]
 23language = "eql"
 24license = "Elastic License v2"
 25name = "PsExec Network Connection"
 26note = """## Triage and analysis
 27
 28### Investigating PsExec Network Connection
 29
 30PsExec is a remote administration tool that enables the execution of commands with both regular and SYSTEM privileges on Windows systems. Microsoft develops it as part of the Sysinternals Suite. Although commonly used by administrators, PsExec is frequently used by attackers to enable lateral movement and execute commands as SYSTEM to disable defenses and bypass security protections.
 31
 32This rule identifies PsExec execution by looking for the creation of `PsExec.exe`, the default name for the utility, followed by a network connection done by the process.
 33
 34#### Possible investigation steps
 35
 36- Check if the usage of this tool complies with the organization's administration policy.
 37- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
 38- Investigate other alerts associated with the user/host during the past 48 hours.
 39- Identify the user account that performed the action and whether it should perform this kind of action.
 40- Identify the target computer and its role in the IT environment.
 41- Investigate what commands were run, and assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
 42
 43### False positive analysis
 44
 45- This mechanism can be used legitimately. As long as the analyst did not identify suspicious activity related to the user or involved hosts, and the tool is allowed by the organization's policy, such alerts can be dismissed.
 46
 47### Response and remediation
 48
 49- Initiate the incident response process based on the outcome of the triage.
 50  - Prioritize cases involving critical servers and users.
 51- Isolate the involved hosts to prevent further post-compromise behavior.
 52- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
 53- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 54- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 55- Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
 56- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
 57"""
 58risk_score = 21
 59rule_id = "55d551c6-333b-4665-ab7e-5d14a59715ce"
 60severity = "low"
 61tags = ["Domain: Endpoint", "OS: Windows", "Use Case: Threat Detection", "Tactic: Execution", "Tactic: Lateral Movement", "Resources: Investigation Guide", "Data Source: Elastic Defend", "Data Source: Sysmon"]
 62type = "eql"
 63
 64query = '''
 65sequence by process.entity_id
 66  [process where host.os.type == "windows" and process.name : "PsExec.exe" and event.type == "start" and
 67
 68   /* This flag suppresses the display of the license dialog and may
 69      indicate that psexec executed for the first time in the machine */
 70   process.args : "-accepteula" and
 71
 72   not process.executable : ("?:\\ProgramData\\Docusnap\\Discovery\\discovery\\plugins\\17\\Bin\\psexec.exe",
 73                             "?:\\Docusnap 11\\Bin\\psexec.exe",
 74                             "?:\\Program Files\\Docusnap X\\Bin\\psexec.exe",
 75                             "?:\\Program Files\\Docusnap X\\Tools\\dsDNS.exe") and
 76   not process.parent.executable : "?:\\Program Files (x86)\\Cynet\\Cynet Scanner\\CynetScanner.exe"]
 77  [network where host.os.type == "windows" and process.name : "PsExec.exe"]
 78'''
 79
 80
 81[[rule.threat]]
 82framework = "MITRE ATT&CK"
 83[[rule.threat.technique]]
 84id = "T1569"
 85name = "System Services"
 86reference = "https://attack.mitre.org/techniques/T1569/"
 87[[rule.threat.technique.subtechnique]]
 88id = "T1569.002"
 89name = "Service Execution"
 90reference = "https://attack.mitre.org/techniques/T1569/002/"
 91
 92
 93
 94[rule.threat.tactic]
 95id = "TA0002"
 96name = "Execution"
 97reference = "https://attack.mitre.org/tactics/TA0002/"
 98[[rule.threat]]
 99framework = "MITRE ATT&CK"
100
101[[rule.threat.technique]]
102id = "T1021"
103name = "Remote Services"
104reference = "https://attack.mitre.org/techniques/T1021/"
105
106[[rule.threat.technique.subtechnique]]
107id = "T1021.002"
108name = "SMB/Windows Admin Shares"
109reference = "https://attack.mitre.org/techniques/T1021/002/"
110
111[[rule.threat.technique]]
112id = "T1570"
113name = "Lateral Tool Transfer"
114reference = "https://attack.mitre.org/techniques/T1570/"
115
116[rule.threat.tactic]
117id = "TA0008"
118name = "Lateral Movement"
119reference = "https://attack.mitre.org/tactics/TA0008/"

Triage and analysis

Investigating PsExec Network Connection

PsExec is a remote administration tool that enables the execution of commands with both regular and SYSTEM privileges on Windows systems. Microsoft develops it as part of the Sysinternals Suite. Although commonly used by administrators, PsExec is frequently used by attackers to enable lateral movement and execute commands as SYSTEM to disable defenses and bypass security protections.

This rule identifies PsExec execution by looking for the creation of PsExec.exe, the default name for the utility, followed by a network connection done by the process.

Possible investigation steps

  • Check if the usage of this tool complies with the organization's administration policy.
  • Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
  • Investigate other alerts associated with the user/host during the past 48 hours.
  • Identify the user account that performed the action and whether it should perform this kind of action.
  • Identify the target computer and its role in the IT environment.
  • Investigate what commands were run, and assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.

False positive analysis

  • This mechanism can be used legitimately. As long as the analyst did not identify suspicious activity related to the user or involved hosts, and the tool is allowed by the organization's policy, such alerts can be dismissed.

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
    • Prioritize cases involving critical servers and users.
  • Isolate the involved hosts to prevent further post-compromise behavior.
  • Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
  • Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
  • Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).

Related rules

to-top