RDP Enabled via Registry

Identifies registry write modifications to enable Remote Desktop Protocol (RDP) access. This could be indicative of adversary lateral movement preparation.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2020/11/25"
  3integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel"]
  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 registry write modifications to enable Remote Desktop Protocol (RDP) access. This could be indicative of
 13adversary lateral movement preparation.
 14"""
 15from = "now-9m"
 16index = ["logs-endpoint.events.registry-*", "winlogbeat-*", "logs-windows.sysmon_operational-*", "endgame-*", "logs-m365_defender.event-*", "logs-sentinel_one_cloud_funnel.*"]
 17language = "eql"
 18license = "Elastic License v2"
 19name = "RDP Enabled via Registry"
 20note = """## Triage and analysis
 21
 22### Investigating RDP Enabled via Registry
 23
 24Microsoft Remote Desktop Protocol (RDP) is a proprietary Microsoft protocol that enables remote connections to other computers, typically over TCP port 3389.
 25
 26Attackers can use RDP to conduct their actions interactively. Ransomware operators frequently use RDP to access victim servers, often using privileged accounts.
 27
 28This rule detects modification of the fDenyTSConnections registry key to the value `0`, which specifies that remote desktop connections are enabled. Attackers can abuse remote registry, use psexec, etc., to enable RDP and move laterally.
 29
 30#### Possible investigation steps
 31
 32- Identify the user account that performed the action and whether it should perform this kind of action.
 33- Contact the user to check if they are aware of the operation.
 34- 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.
 35- Investigate other alerts associated with the user/host during the past 48 hours.
 36- Check whether it makes sense to enable RDP to this host, given its role in the environment.
 37- Check if the host is directly exposed to the internet.
 38- Check whether privileged accounts accessed the host shortly after the modification.
 39- Review network events within a short timespan of this alert for incoming RDP connection attempts.
 40
 41### False positive analysis
 42
 43- This mechanism can be used legitimately. Check whether the user should be performing this kind of activity, whether they are aware of it, whether RDP should be open, and whether the action exposes the environment to unnecessary risks.
 44
 45### Response and remediation
 46
 47- Initiate the incident response process based on the outcome of the triage.
 48- If RDP is needed, make sure to secure it using firewall rules:
 49  - Allowlist RDP traffic to specific trusted hosts.
 50  - Restrict RDP logins to authorized non-administrator accounts, where possible.
 51- Isolate the involved hosts to prevent further post-compromise behavior.
 52- Review the privileges assigned to the involved users to ensure that the least privilege principle is being followed.
 53- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 54- 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).
 55"""
 56risk_score = 47
 57rule_id = "58aa72ca-d968-4f34-b9f7-bea51d75eb50"
 58severity = "medium"
 59tags = [
 60    "Domain: Endpoint",
 61    "OS: Windows",
 62    "Use Case: Threat Detection",
 63    "Tactic: Lateral Movement",
 64    "Tactic: Defense Evasion",
 65    "Resources: Investigation Guide",
 66    "Data Source: Elastic Endgame",
 67    "Data Source: Elastic Defend",
 68    "Data Source: Sysmon",
 69    "Data Source: Microsoft Defender for Endpoint",
 70    "Data Source: SentinelOne",
 71]
 72timestamp_override = "event.ingested"
 73type = "eql"
 74
 75query = '''
 76registry where host.os.type == "windows" and event.type == "change" and
 77  registry.path : (
 78    "HKLM\\SYSTEM\\*ControlSet*\\Control\\Terminal Server\\fDenyTSConnections",
 79    "\\REGISTRY\\MACHINE\\SYSTEM\\*ControlSet*\\Control\\Terminal Server\\fDenyTSConnections",
 80    "MACHINE\\*ControlSet*\\Control\\Terminal Server\\fDenyTSConnections"
 81  ) and
 82  registry.data.strings : ("0", "0x00000000") and
 83  not process.executable : ("?:\\Windows\\System32\\SystemPropertiesRemote.exe", 
 84                            "?:\\Windows\\System32\\SystemPropertiesComputerName.exe", 
 85                            "?:\\Windows\\System32\\SystemPropertiesAdvanced.exe", 
 86                            "?:\\Windows\\System32\\SystemSettingsAdminFlows.exe", 
 87                            "?:\\Windows\\WinSxS\\*\\TiWorker.exe", 
 88                            "?:\\Windows\\system32\\svchost.exe")
 89'''
 90
 91
 92[[rule.threat]]
 93framework = "MITRE ATT&CK"
 94[[rule.threat.technique]]
 95id = "T1021"
 96name = "Remote Services"
 97reference = "https://attack.mitre.org/techniques/T1021/"
 98[[rule.threat.technique.subtechnique]]
 99id = "T1021.001"
100name = "Remote Desktop Protocol"
101reference = "https://attack.mitre.org/techniques/T1021/001/"
102
103
104
105[rule.threat.tactic]
106id = "TA0008"
107name = "Lateral Movement"
108reference = "https://attack.mitre.org/tactics/TA0008/"
109[[rule.threat]]
110framework = "MITRE ATT&CK"
111[[rule.threat.technique]]
112id = "T1112"
113name = "Modify Registry"
114reference = "https://attack.mitre.org/techniques/T1112/"
115
116
117[rule.threat.tactic]
118id = "TA0005"
119name = "Defense Evasion"
120reference = "https://attack.mitre.org/tactics/TA0005/"

Triage and analysis

Investigating RDP Enabled via Registry

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 modification of the fDenyTSConnections registry key to the value 0, which specifies that remote desktop connections are enabled. Attackers can abuse remote registry, use psexec, etc., to enable RDP and move laterally.

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

  • This mechanism can be used legitimately. Check whether the user should be performing this kind of activity, whether they are 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 using firewall rules:
    • 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

to-top