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"
  5updated_date = "2024/05/21"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Identifies use of the SysInternals tool PsExec.exe making a network connection. This could be an indication of lateral
 11movement.
 12"""
 13false_positives = [
 14    """
 15    PsExec is a dual-use tool that can be used for benign or malicious activity. It's important to baseline your
 16    environment to determine the amount of noise to expect from this tool.
 17    """,
 18]
 19from = "now-9m"
 20index = [
 21    "winlogbeat-*",
 22    "logs-endpoint.events.process-*",
 23    "logs-endpoint.events.network-*",
 24    "logs-windows.sysmon_operational-*",
 25]
 26language = "eql"
 27license = "Elastic License v2"
 28name = "PsExec Network Connection"
 29note = """## Triage and analysis
 30
 31### Investigating PsExec Network Connection
 32
 33PsExec 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.
 34
 35This 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.
 36
 37#### Possible investigation steps
 38
 39- Check if the usage of this tool complies with the organization's administration policy.
 40- 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.
 41- Investigate other alerts associated with the user/host during the past 48 hours.
 42- Identify the user account that performed the action and whether it should perform this kind of action.
 43- Identify the target computer and its role in the IT environment.
 44- Investigate what commands were run, and assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
 45
 46### False positive analysis
 47
 48- 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.
 49
 50### Response and remediation
 51
 52- Initiate the incident response process based on the outcome of the triage.
 53  - Prioritize cases involving critical servers and users.
 54- Isolate the involved hosts to prevent further post-compromise behavior.
 55- 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.
 56- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 57- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 58- Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
 59- 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).
 60"""
 61risk_score = 21
 62rule_id = "55d551c6-333b-4665-ab7e-5d14a59715ce"
 63severity = "low"
 64tags = [
 65    "Domain: Endpoint",
 66    "OS: Windows",
 67    "Use Case: Threat Detection",
 68    "Tactic: Execution",
 69    "Tactic: Lateral Movement",
 70    "Resources: Investigation Guide",
 71    "Data Source: Elastic Defend",
 72    "Data Source: Sysmon",
 73]
 74type = "eql"
 75
 76query = '''
 77sequence by process.entity_id
 78  [process where host.os.type == "windows" and process.name : "PsExec.exe" and event.type == "start" and
 79
 80   /* This flag suppresses the display of the license dialog and may
 81      indicate that psexec executed for the first time in the machine */
 82   process.args : "-accepteula" and
 83
 84   not process.executable : ("?:\\ProgramData\\Docusnap\\Discovery\\discovery\\plugins\\17\\Bin\\psexec.exe",
 85                             "?:\\Docusnap 11\\Bin\\psexec.exe",
 86                             "?:\\Program Files\\Docusnap X\\Bin\\psexec.exe",
 87                             "?:\\Program Files\\Docusnap X\\Tools\\dsDNS.exe") and
 88   not process.parent.executable : "?:\\Program Files (x86)\\Cynet\\Cynet Scanner\\CynetScanner.exe"]
 89  [network where host.os.type == "windows" and process.name : "PsExec.exe"]
 90'''
 91
 92
 93[[rule.threat]]
 94framework = "MITRE ATT&CK"
 95[[rule.threat.technique]]
 96id = "T1569"
 97name = "System Services"
 98reference = "https://attack.mitre.org/techniques/T1569/"
 99[[rule.threat.technique.subtechnique]]
100id = "T1569.002"
101name = "Service Execution"
102reference = "https://attack.mitre.org/techniques/T1569/002/"
103
104
105
106[rule.threat.tactic]
107id = "TA0002"
108name = "Execution"
109reference = "https://attack.mitre.org/tactics/TA0002/"
110[[rule.threat]]
111framework = "MITRE ATT&CK"
112[[rule.threat.technique]]
113id = "T1021"
114name = "Remote Services"
115reference = "https://attack.mitre.org/techniques/T1021/"
116[[rule.threat.technique.subtechnique]]
117id = "T1021.002"
118name = "SMB/Windows Admin Shares"
119reference = "https://attack.mitre.org/techniques/T1021/002/"
120
121
122[[rule.threat.technique]]
123id = "T1570"
124name = "Lateral Tool Transfer"
125reference = "https://attack.mitre.org/techniques/T1570/"
126
127
128[rule.threat.tactic]
129id = "TA0008"
130name = "Lateral Movement"
131reference = "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