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"]
  4maturity = "production"
  5updated_date = "2024/05/21"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Identifies registry write modifications to enable Remote Desktop Protocol (RDP) access. This could be indicative of
 11adversary lateral movement preparation.
 12"""
 13from = "now-9m"
 14index = ["logs-endpoint.events.registry-*", "winlogbeat-*", "logs-windows.sysmon_operational-*", "endgame-*"]
 15language = "eql"
 16license = "Elastic License v2"
 17name = "RDP Enabled via Registry"
 18note = """## Triage and analysis
 19
 20### Investigating RDP Enabled via Registry
 21
 22Microsoft Remote Desktop Protocol (RDP) is a proprietary Microsoft protocol that enables remote connections to other computers, typically over TCP port 3389.
 23
 24Attackers can use RDP to conduct their actions interactively. Ransomware operators frequently use RDP to access victim servers, often using privileged accounts.
 25
 26This 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.
 27
 28#### Possible investigation steps
 29
 30- Identify the user account that performed the action and whether it should perform this kind of action.
 31- Contact the user to check if they are aware of the operation.
 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- Investigate other alerts associated with the user/host during the past 48 hours.
 34- Check whether it makes sense to enable RDP to this host, given its role in the environment.
 35- Check if the host is directly exposed to the internet.
 36- Check whether privileged accounts accessed the host shortly after the modification.
 37- Review network events within a short timespan of this alert for incoming RDP connection attempts.
 38
 39### False positive analysis
 40
 41- 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.
 42
 43### Response and remediation
 44
 45- Initiate the incident response process based on the outcome of the triage.
 46- If RDP is needed, make sure to secure it using firewall rules:
 47  - Allowlist RDP traffic to specific trusted hosts.
 48  - Restrict RDP logins to authorized non-administrator accounts, where possible.
 49- Isolate the involved hosts to prevent further post-compromise behavior.
 50- Review the privileges assigned to the involved users to ensure that the least privilege principle is being followed.
 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"""
 54risk_score = 47
 55rule_id = "58aa72ca-d968-4f34-b9f7-bea51d75eb50"
 56setup = """## Setup
 57
 58If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
 59events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
 60Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
 61`event.ingested` to @timestamp.
 62For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
 63"""
 64severity = "medium"
 65tags = [
 66    "Domain: Endpoint",
 67    "OS: Windows",
 68    "Use Case: Threat Detection",
 69    "Tactic: Lateral Movement",
 70    "Tactic: Defense Evasion",
 71    "Resources: Investigation Guide",
 72    "Data Source: Elastic Endgame",
 73    "Data Source: Elastic Defend",
 74    "Data Source: Sysmon",
 75]
 76timestamp_override = "event.ingested"
 77type = "eql"
 78
 79query = '''
 80registry where host.os.type == "windows" and 
 81 event.type in ("creation", "change") and
 82  registry.path : "HKLM\\SYSTEM\\*ControlSet*\\Control\\Terminal Server\\fDenyTSConnections" and
 83  registry.data.strings : ("0", "0x00000000") and
 84  not process.executable : ("?:\\Windows\\System32\\SystemPropertiesRemote.exe", 
 85                            "?:\\Windows\\System32\\SystemPropertiesComputerName.exe", 
 86                            "?:\\Windows\\System32\\SystemPropertiesAdvanced.exe", 
 87                            "?:\\Windows\\System32\\SystemSettingsAdminFlows.exe", 
 88                            "?:\\Windows\\WinSxS\\*\\TiWorker.exe", 
 89                            "?:\\Windows\\system32\\svchost.exe")
 90'''
 91
 92
 93[[rule.threat]]
 94framework = "MITRE ATT&CK"
 95[[rule.threat.technique]]
 96id = "T1021"
 97name = "Remote Services"
 98reference = "https://attack.mitre.org/techniques/T1021/"
 99[[rule.threat.technique.subtechnique]]
100id = "T1021.001"
101name = "Remote Desktop Protocol"
102reference = "https://attack.mitre.org/techniques/T1021/001/"
103
104
105
106[rule.threat.tactic]
107id = "TA0008"
108name = "Lateral Movement"
109reference = "https://attack.mitre.org/tactics/TA0008/"
110[[rule.threat]]
111framework = "MITRE ATT&CK"
112[[rule.threat.technique]]
113id = "T1112"
114name = "Modify Registry"
115reference = "https://attack.mitre.org/techniques/T1112/"
116
117
118[rule.threat.tactic]
119id = "TA0005"
120name = "Defense Evasion"
121reference = "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