Potential Remote Desktop Tunneling Detected
Identifies potential use of an SSH utility to establish RDP over a reverse SSH Tunnel. This can be used by attackers to enable routing of network packets that would otherwise not reach their intended destination.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/10/14"
3integration = ["endpoint", "windows", "sentinel_one_cloud_funnel", "m365_defender"]
4maturity = "production"
5min_stack_comments = "Breaking change at 8.13.0 for SentinelOne Integration."
6min_stack_version = "8.13.0"
7updated_date = "2024/08/07"
8
9[rule]
10author = ["Elastic"]
11description = """
12Identifies potential use of an SSH utility to establish RDP over a reverse SSH Tunnel. This can be used by attackers to
13enable routing of network packets that would otherwise not reach their intended destination.
14"""
15from = "now-9m"
16index = ["logs-endpoint.events.process-*", "winlogbeat-*", "logs-windows.*", "endgame-*", "logs-system.security*", "logs-sentinel_one_cloud_funnel.*", "logs-m365_defender.event-*"]
17language = "eql"
18license = "Elastic License v2"
19name = "Potential Remote Desktop Tunneling Detected"
20note = """## Triage and analysis
21
22### Investigating Potential Remote Desktop Tunneling Detected
23
24Protocol Tunneling is a mechanism that involves explicitly encapsulating a protocol within another for various use cases, ranging from providing an outer layer of encryption (similar to a VPN) to enabling traffic that network appliances would filter to reach their destination.
25
26Attackers may tunnel Remote Desktop Protocol (RDP) traffic through other protocols like Secure Shell (SSH) to bypass network restrictions that block incoming RDP connections but may be more permissive to other protocols.
27
28This rule looks for command lines involving the `3389` port, which RDP uses by default and options commonly associated with tools that perform tunneling.
29
30#### Possible investigation steps
31
32- 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.
33- Identify the user account that performed the action and whether it should perform this kind of action.
34- Contact the account and system owners and confirm whether they are aware of this activity.
35- Investigate other alerts associated with the user/host during the past 48 hours.
36- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
37- Examine network data to determine if the host communicated with external servers using the tunnel.
38
39### False positive analysis
40
41- This activity is unlikely to happen legitimately. Benign true positives (B-TPs) can be added as exceptions if necessary.
42- Investigate the command line for the execution of programs that are unrelated to tunneling, like Remote Desktop clients.
43
44### Response and remediation
45
46- Initiate the incident response process based on the outcome of the triage.
47- Isolate the involved host to prevent further post-compromise behavior.
48- Take the necessary actions to disable the tunneling, which can be a process kill, service deletion, registry key modification, etc. Inspect the host to learn which method was used and to determine a response for the case.
49- 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.
50- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
51- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
52- 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).
53"""
54references = ["https://blog.netspi.com/how-to-access-rdp-over-a-reverse-ssh-tunnel/"]
55risk_score = 73
56rule_id = "76fd43b7-3480-4dd9-8ad7-8bd36bfad92f"
57setup = """## Setup
58
59If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
60events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
61Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
62`event.ingested` to @timestamp.
63For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
64"""
65severity = "high"
66tags = [
67 "Domain: Endpoint",
68 "OS: Windows",
69 "Use Case: Threat Detection",
70 "Tactic: Command and Control",
71 "Tactic: Lateral Movement",
72 "Resources: Investigation Guide",
73 "Data Source: Elastic Endgame",
74 "Data Source: Elastic Defend",
75 "Data Source: SentinelOne",
76 "Data Source: Microsoft Defender for Endpoint",
77 "Data Source: System",
78]
79timestamp_override = "event.ingested"
80type = "eql"
81
82query = '''
83process where host.os.type == "windows" and event.type == "start" and
84 /* RDP port and usual SSH tunneling related switches in command line */
85 process.args : "*:3389" and
86 process.args : ("-L", "-P", "-R", "-pw", "-ssh")
87'''
88
89
90[[rule.threat]]
91framework = "MITRE ATT&CK"
92[[rule.threat.technique]]
93id = "T1572"
94name = "Protocol Tunneling"
95reference = "https://attack.mitre.org/techniques/T1572/"
96
97
98[rule.threat.tactic]
99id = "TA0011"
100name = "Command and Control"
101reference = "https://attack.mitre.org/tactics/TA0011/"
102
103[[rule.threat]]
104framework = "MITRE ATT&CK"
105[[rule.threat.technique]]
106id = "T1021"
107name = "Remote Services"
108reference = "https://attack.mitre.org/techniques/T1021/"
109[[rule.threat.technique.subtechnique]]
110id = "T1021.004"
111name = "SSH"
112reference = "https://attack.mitre.org/techniques/T1021/004/"
113
114
115
116[rule.threat.tactic]
117id = "TA0008"
118name = "Lateral Movement"
119reference = "https://attack.mitre.org/tactics/TA0008/"
Triage and analysis
Investigating Potential Remote Desktop Tunneling Detected
Protocol Tunneling is a mechanism that involves explicitly encapsulating a protocol within another for various use cases, ranging from providing an outer layer of encryption (similar to a VPN) to enabling traffic that network appliances would filter to reach their destination.
Attackers may tunnel Remote Desktop Protocol (RDP) traffic through other protocols like Secure Shell (SSH) to bypass network restrictions that block incoming RDP connections but may be more permissive to other protocols.
This rule looks for command lines involving the 3389
port, which RDP uses by default and options commonly associated with tools that perform tunneling.
Possible investigation steps
- 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.
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the account and system owners and confirm whether they are aware of this activity.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
- Examine network data to determine if the host communicated with external servers using the tunnel.
False positive analysis
- This activity is unlikely to happen legitimately. Benign true positives (B-TPs) can be added as exceptions if necessary.
- Investigate the command line for the execution of programs that are unrelated to tunneling, like Remote Desktop clients.
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.
- Take the necessary actions to disable the tunneling, which can be a process kill, service deletion, registry key modification, etc. Inspect the host to learn which method was used and to determine a response for the case.
- 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.
- 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).
References
Related rules
- Suspicious ScreenConnect Client Child Process
- Potential WSUS Abuse for Lateral Movement
- Suspicious MS Outlook Child Process
- Suspicious Zoom Child Process
- System Shells via Services