Remote Desktop Enabled in Windows Firewall by Netsh
Identifies use of the network shell utility (netsh.exe) to enable inbound Remote Desktop Protocol (RDP) connections in the Windows Firewall.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/10/13"
3integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
4maturity = "production"
5updated_date = "2024/11/02"
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 network shell utility (netsh.exe) to enable inbound Remote Desktop Protocol (RDP) connections in
13the Windows Firewall.
14"""
15from = "now-9m"
16index = [
17 "winlogbeat-*",
18 "logs-endpoint.events.process-*",
19 "logs-windows.forwarded*",
20 "logs-windows.sysmon_operational-*",
21 "endgame-*",
22 "logs-system.security*",
23 "logs-m365_defender.event-*",
24 "logs-sentinel_one_cloud_funnel.*",
25 "logs-crowdstrike.fdr*",
26]
27language = "eql"
28license = "Elastic License v2"
29name = "Remote Desktop Enabled in Windows Firewall by Netsh"
30note = """## Triage and analysis
31
32### Investigating Remote Desktop Enabled in Windows Firewall by Netsh
33
34Microsoft Remote Desktop Protocol (RDP) is a proprietary Microsoft protocol that enables remote connections to other computers, typically over TCP port 3389.
35
36Attackers can use RDP to conduct their actions interactively. Ransomware operators frequently use RDP to access victim servers, often using privileged accounts.
37
38This rule detects the creation of a Windows Firewall inbound rule that would allow inbound RDP traffic using the `netsh.exe` utility.
39
40#### Possible investigation steps
41
42- Identify the user account that performed the action and whether it should perform this kind of action.
43- Contact the user to check if they are aware of the operation.
44- 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.
45- Investigate other alerts associated with the user/host during the past 48 hours.
46- Check whether it makes sense to enable RDP to this host, given its role in the environment.
47- Check if the host is directly exposed to the internet.
48- Check whether privileged accounts accessed the host shortly after the modification.
49- Review network events within a short timespan of this alert for incoming RDP connection attempts.
50
51### False positive analysis
52
53- The `netsh.exe` utility can be used legitimately. Check whether the user should be performing this kind of activity, whether the user is aware of it, whether RDP should be open, and whether the action exposes the environment to unnecessary risks.
54
55### Response and remediation
56
57- Initiate the incident response process based on the outcome of the triage.
58- If RDP is needed, make sure to secure it:
59 - Allowlist RDP traffic to specific trusted hosts.
60 - Restrict RDP logins to authorized non-administrator accounts, where possible.
61- Isolate the involved hosts to prevent further post-compromise behavior.
62- Review the privileges assigned to the involved users to ensure that the least privilege principle is being followed.
63- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
64- 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).
65"""
66risk_score = 47
67rule_id = "074464f9-f30d-4029-8c03-0ed237fffec7"
68severity = "medium"
69tags = [
70 "Domain: Endpoint",
71 "OS: Windows",
72 "Use Case: Threat Detection",
73 "Tactic: Defense Evasion",
74 "Resources: Investigation Guide",
75 "Data Source: Elastic Endgame",
76 "Data Source: Elastic Defend",
77 "Data Source: System",
78 "Data Source: Microsoft Defender for Endpoint",
79 "Data Source: Sysmon",
80 "Data Source: SentinelOne",
81 "Data Source: Crowdstrike",
82]
83timestamp_override = "event.ingested"
84type = "eql"
85
86query = '''
87process where host.os.type == "windows" and event.type == "start" and
88 (process.name : "netsh.exe" or ?process.pe.original_file_name == "netsh.exe") and
89 process.args : ("localport=3389", "RemoteDesktop", "group=\"remote desktop\"") and
90 process.args : ("action=allow", "enable=Yes", "enable")
91'''
92
93
94[[rule.threat]]
95framework = "MITRE ATT&CK"
96[[rule.threat.technique]]
97id = "T1562"
98name = "Impair Defenses"
99reference = "https://attack.mitre.org/techniques/T1562/"
100[[rule.threat.technique.subtechnique]]
101id = "T1562.004"
102name = "Disable or Modify System Firewall"
103reference = "https://attack.mitre.org/techniques/T1562/004/"
104
105
106
107[rule.threat.tactic]
108id = "TA0005"
109name = "Defense Evasion"
110reference = "https://attack.mitre.org/tactics/TA0005/"
Triage and analysis
Investigating Remote Desktop Enabled in Windows Firewall by Netsh
Microsoft Remote Desktop Protocol (RDP) is a proprietary Microsoft protocol that enables remote connections to other computers, typically over TCP port 3389.
Attackers can use RDP to conduct their actions interactively. Ransomware operators frequently use RDP to access victim servers, often using privileged accounts.
This rule detects the creation of a Windows Firewall inbound rule that would allow inbound RDP traffic using the netsh.exe
utility.
Possible investigation steps
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the user to check if they are aware of the operation.
- 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.
- Check whether it makes sense to enable RDP to this host, given its role in the environment.
- Check if the host is directly exposed to the internet.
- Check whether privileged accounts accessed the host shortly after the modification.
- Review network events within a short timespan of this alert for incoming RDP connection attempts.
False positive analysis
- The
netsh.exe
utility can be used legitimately. Check whether the user should be performing this kind of activity, whether the user is aware of it, whether RDP should be open, and whether the action exposes the environment to unnecessary risks.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- If RDP is needed, make sure to secure it:
- Allowlist RDP traffic to specific trusted hosts.
- Restrict RDP logins to authorized non-administrator accounts, where possible.
- Isolate the involved hosts to prevent further post-compromise behavior.
- Review the privileges assigned to the involved users to ensure that the least privilege principle is being followed.
- 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
- IIS HTTP Logging Disabled
- Suspicious CertUtil Commands
- Windows Firewall Disabled via PowerShell
- Adding Hidden File Attribute via Attrib
- Clearing Windows Console History