Potential Command Shell via NetCat
Identifies potential attempt to execute via a reverse shell using the netcat utility to execute Windows commands using the default interpreters like Cmd.exe and Powershell.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2025/10/14"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2025/10/14"
6
7
8[rule]
9author = ["Elastic"]
10description = """
11Identifies potential attempt to execute via a reverse shell using the netcat utility to execute Windows commands using
12the default interpreters like Cmd.exe and Powershell.
13"""
14from = "now-9m"
15index = ["logs-endpoint.events.process-*"]
16language = "eql"
17license = "Elastic License v2"
18name = "Potential Command Shell via NetCat"
19note = """## Triage and analysis
20
21### Investigating Potential Command Shell via NetCat
22
23Attackers may abuse the NetCat utility to execute commands remotely using the builtin Windows Command Shell interpreters.
24
25#### Possible investigation steps
26
27- Verify if the user is authorized to use the Netcat utility.
28- Investigate the process execution chain (parent process tree) and how the netcat binary was dropped.
29- Review the network connections made by the parent process and check their reputation.
30- Investiguate all child processes spawned by the Cmd or Powershell instance.
31- Examine the host for other alerts within the same period.
32
33### False positive analysis
34
35- IT Support or system amdinistrator authorized activity using NetCat.
36
37### Response and remediation
38
39- Initiate the incident response process based on the outcome of the triage.
40- Isolate the involved host to prevent further post-compromise behavior.
41- If the triage identified malware, search the environment for additional compromised hosts.
42 - Implement temporary network rules, procedures, and segmentation to contain the malware.
43 - Stop suspicious processes.
44 - Immediately block the identified indicators of compromise (IoCs).
45 - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
46- Remove and block malicious artifacts identified during triage.
47- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
48- 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.
49- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
50- 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).
51"""
52risk_score = 73
53rule_id = "9c0f61fa-abf4-4b11-8d9d-5978c09182dd"
54severity = "high"
55tags = [
56 "Domain: Endpoint",
57 "OS: Windows",
58 "Use Case: Threat Detection",
59 "Tactic: Execution",
60 "Resources: Investigation Guide",
61 "Data Source: Elastic Defend"
62]
63timestamp_override = "event.ingested"
64type = "eql"
65
66query = '''
67process where host.os.type == "windows" and event.type == "start" and
68process.name : ("cmd.exe", "powershell.exe") and process.parent.args : "-e" and
69 (
70 (process.parent.args_count == 5 and process.parent.command_line regex~ """.*[0-9]{1,3}(\.[0-9]{1,3}){3}.*""") or
71 (process.parent.args : "-*l*" and process.parent.args : "-*p*" and process.parent.args : ("cmd.exe", "powershell.exe"))
72 )
73'''
74
75
76[[rule.threat]]
77framework = "MITRE ATT&CK"
78[[rule.threat.technique]]
79id = "T1059"
80name = "Command and Scripting Interpreter"
81reference = "https://attack.mitre.org/techniques/T1059/"
82[[rule.threat.technique.subtechnique]]
83id = "T1059.001"
84name = "PowerShell"
85reference = "https://attack.mitre.org/techniques/T1059/001/"
86
87[[rule.threat.technique.subtechnique]]
88id = "T1059.003"
89name = "Windows Command Shell"
90reference = "https://attack.mitre.org/techniques/T1059/003/"
91
92
93[rule.threat.tactic]
94id = "TA0002"
95name = "Execution"
96reference = "https://attack.mitre.org/tactics/TA0002/"
Triage and analysis
Investigating Potential Command Shell via NetCat
Attackers may abuse the NetCat utility to execute commands remotely using the builtin Windows Command Shell interpreters.
Possible investigation steps
- Verify if the user is authorized to use the Netcat utility.
- Investigate the process execution chain (parent process tree) and how the netcat binary was dropped.
- Review the network connections made by the parent process and check their reputation.
- Investiguate all child processes spawned by the Cmd or Powershell instance.
- Examine the host for other alerts within the same period.
False positive analysis
- IT Support or system amdinistrator authorized activity using NetCat.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- 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.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- 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
- Potential Privilege Escalation via Service ImagePath Modification
- Suspicious PowerShell Engine ImageLoad
- Suspicious Windows Powershell Arguments
- Web Shell Detection: Script Process Child of Common Web Processes
- Clearing Windows Console History