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