Detection rule
RDP Sensitive Settings Changed
Overview
Detects tampering of RDP Terminal Service/Server sensitive settings. Such as allowing unauthorized users access to a system via the 'fAllowUnsolicited' or enabling RDP via 'fDenyTSConnections', etc. Below is a list of registry keys/values that are monitored by this rule: - Shadow: Used to enable Remote Desktop shadowing, which allows an administrator to view or control a user's session. - DisableRemoteDesktopAntiAlias: Disables anti-aliasing for remote desktop sessions. - DisableSecuritySettings: Disables certain security settings for Remote Desktop connections. - fAllowUnsolicited: Allows unsolicited remote assistance offers. - fAllowUnsolicitedFullControl: Allows unsolicited remote assistance offers with full control. - InitialProgram: Specifies a program to run automatically when a user logs on to a remote computer. - ServiceDll: Used in RDP hijacking techniques to specify a custom DLL to be loaded by the Terminal Services service. - SecurityLayer: Specifies the security layer used for RDP connections.
- Rule id
3f6b7b62-61aa-45db-96bd-9c31b36b653c- ATT&CK techniques
- T1112 Modify Registry
- Severity
- High
- Confidence
- Low
- Origin
- SigmaHQ (community)
- SigmaHQ status
test- Used in defense packs
- The Gentlemen, Akira, safepay, everest
Validation
- ExperimentalSyntax checked only. Not yet tested on events.
- Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
- SIEM-validatedRun in a real SIEM, with a recorded result.
2 of 2 positive test events matched; 4 of 4 near-miss events were correctly ignored. Community rule reused unmodified from SigmaHQ. OffSet7 converted it and tested it on synthetic events.
Detection logic and queries
Queries are shown exactly as generated. Test them in your environment before you deploy them.
Sigma
Sigma (YAML) · 3f6b7b62-61aa-45db-96bd-9c31b36b653c
title: RDP Sensitive Settings Changed
id: 3f6b7b62-61aa-45db-96bd-9c31b36b653c
related:
- id: 171b67e1-74b4-460e-8d55-b331f3e32d67
type: obsolete
- id: 41904ebe-d56c-4904-b9ad-7a77bdf154b3
type: obsolete
- id: a2863fbc-d5cb-48d5-83fb-d976d4b1743b
type: similar
status: test
description: |
Detects tampering of RDP Terminal Service/Server sensitive settings.
Such as allowing unauthorized users access to a system via the 'fAllowUnsolicited' or enabling RDP via 'fDenyTSConnections', etc.
Below is a list of registry keys/values that are monitored by this rule:
- Shadow: Used to enable Remote Desktop shadowing, which allows an administrator to view or control a user's session.
- DisableRemoteDesktopAntiAlias: Disables anti-aliasing for remote desktop sessions.
- DisableSecuritySettings: Disables certain security settings for Remote Desktop connections.
- fAllowUnsolicited: Allows unsolicited remote assistance offers.
- fAllowUnsolicitedFullControl: Allows unsolicited remote assistance offers with full control.
- InitialProgram: Specifies a program to run automatically when a user logs on to a remote computer.
- ServiceDll: Used in RDP hijacking techniques to specify a custom DLL to be loaded by the Terminal Services service.
- SecurityLayer: Specifies the security layer used for RDP connections.
references:
- http://etutorials.org/Microsoft+Products/microsoft+windows+server+2003+terminal+services/Chapter+6+Registry/Registry+Keys+for+Terminal+Services/ # Contains description for most of the keys mentioned here (check it out if you want more information)
- http://woshub.com/rds-shadow-how-to-connect-to-a-user-session-in-windows-server-2012-r2/ # Related to the Shadow RPD technique
- https://admx.help/HKLM/SOFTWARE/Policies/Microsoft/Windows%20NT/Terminal%20Services # Contains description for most of the keys mentioned here (check it out if you want more information)
- https://bazaar.abuse.ch/sample/6f3aa9362d72e806490a8abce245331030d1ab5ac77e400dd475748236a6cc81/
- https://blog.sekoia.io/darkgate-internals/
- https://blog.talosintelligence.com/understanding-the-phobos-affiliate-structure/
- https://github.com/redcanaryco/atomic-red-team/blob/02c7d02fe1f1feb0fc7944550408ea8224273994/atomics/T1112/T1112.md#atomic-test-63---disable-remote-desktop-anti-alias-setting-through-registry
- https://github.com/redcanaryco/atomic-red-team/blob/02c7d02fe1f1feb0fc7944550408ea8224273994/atomics/T1112/T1112.md#atomic-test-64---disable-remote-desktop-security-settings-through-registry
- https://github.com/redcanaryco/atomic-red-team/blob/dd526047b8c399c312fee47d1e6fb531164da54d/atomics/T1112/T1112.yaml#L790
- https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-terminalservices-rdp-winstationextensions-securitylayer
- https://threathunterplaybook.com/hunts/windows/190407-RegModEnableRDPConnections/notebook.html
- https://twitter.com/SagieSec/status/1469001618863624194?t=HRf0eA0W1YYzkTSHb-Ky1A&s=03 # Related to the Shadow RPD technique
- https://web.archive.org/web/20200929062532/https://blog.menasec.net/2019/02/threat-hunting-rdp-hijacking-via.html # Related to RDP hijacking via the "ServiceDll" key
- https://www.trendmicro.com/en_us/research/25/i/unmasking-the-gentlemen-ransomware.html
author: Samir Bousseaden, David ANDRE, Roberto Rodriguez @Cyb3rWard0g, Nasreddine Bencherchali
date: 2022-08-06
modified: 2026-11-12
tags:
- attack.persistence
- attack.defense-impairment
- attack.t1112
logsource:
category: registry_set
product: windows
detection:
selection_ts_shadow:
TargetObject|contains:
- '\Control\Terminal Server\'
- '\Windows NT\Terminal Services\'
TargetObject|endswith: '\Shadow'
Details:
- 'DWORD (0x00000001)' # Full Control with user’s permission
- 'DWORD (0x00000002)' # Full Control without user’s permission
- 'DWORD (0x00000003)' # View Session with user’s permission
- 'DWORD (0x00000004)' # View Session without user’s permission
selection_ts_key:
TargetObject|contains:
- '\Control\Terminal Server\'
- '\Windows NT\Terminal Services\'
TargetObject|endswith:
- '\DisableRemoteDesktopAntiAlias' # Disable anti-aliasing for remote desktop (DarkGate malware)
- '\DisableSecuritySettings' # Disable security settings, allowing access to programs/entire desktop (DarkGate malware)
- '\fAllowUnsolicited' # Allow unsolicited remote assistance offers
- '\fAllowUnsolicitedFullControl'
Details: 'DWORD (0x00000001)'
selection_ts_tamper_only:
# Any changes to these keys should be suspicious and looked at
- TargetObject|contains:
- '\Control\Terminal Server\InitialProgram' # This value can be set to specify a program to run automatically when a user logs on to a remote computer.
- '\Control\Terminal Server\WinStations\RDP-Tcp\InitialProgram' # This value can be set to specify a program to run automatically when a user logs on to a remote computer.
- '\Terminal Server\WinStations\RDP-Tcp\SecurityLayer'
- '\Windows NT\Terminal Services\InitialProgram' # This value can be set to specify a program to run automatically when a user logs on to a remote computer.
- TargetObject|endswith: '\services\TermService\Parameters\ServiceDll' # RDP hijacking
filter_main_securitylayer_tls:
TargetObject|endswith: '\SecurityLayer'
Details: 'DWORD (0x00000002)' # TLS Enabled
filter_main_termsrv_dll:
TargetObject|endswith: '\services\TermService\Parameters\ServiceDll'
Details:
- '%%SystemRoot%%\System32\termsrv.dll'
- '%%SystemRoot%%\SysWOW64\termsrv.dll'
- '%%windir%%\System32\termsrv.dll'
- '%%windir%%\SysWOW64\termsrv.dll'
- '%SystemRoot%\System32\termsrv.dll'
- '%SystemRoot%\SysWOW64\termsrv.dll'
- '%windir%\System32\termsrv.dll'
- '%windir%\SysWOW64\termsrv.dll'
- 'C:\Windows\System32\termsrv.dll'
- 'C:\Windows\SysWOW64\termsrv.dll'
filter_main_initialprog_empty:
TargetObject|contains:
- '\Control\Terminal Server\InitialProgram'
- '\Control\Terminal Server\WinStations\RDP-Tcp\InitialProgram'
- '\Windows NT\Terminal Services\InitialProgram'
Details:
- '(Empty)'
- ''
filter_optional_container_worker:
Image|startswith:
- 'C:\Windows\System32\'
- 'C:\Windows\SysWOW64\'
- 'C:\Windows\WinSxS\'
Image|endswith: '\containerworker.exe'
TargetObject|contains: '\Windows\Containers\Layers\'
condition: 1 of selection_ts_* and not 1 of filter_main_* and not 1 of filter_optional_*
falsepositives:
- Some of the keys mentioned here could be modified by an administrator while setting group policy (it should be investigated either way)
level: high
simulation:
- type: atomic-red-team
name: Disable Remote Desktop Anti-Alias Setting Through Registry
technique: T1112
atomic_guid: 61d35188-f113-4334-8245-8c6556d43909
- type: atomic-red-team
name: Disable Remote Desktop Security Settings Through Registry
technique: T1112
atomic_guid: 4b81bcfa-fb0a-45e9-90c2-e3efe5160140QRadar CRE
Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.
- Rule name
OffSet7: RDP Sensitive Settings Changed- Rule type
- Event rule (Local)
- Log source types
- Microsoft Windows Security Event Log DSM: Sysmon EID 13 (registry value set)
Building blocks
BB:OffSet7:RDP Sensitive Settings Changed:selection_ts_shadow(match)All test lines must match (AND).Process Name / Target Process Name / Object Namecontains:\Control\Terminal Server\,\Windows NT\Terminal Services\Process Name / Target Process Name / Object Nameends with:\Shadow- custom property needed:
Detailsis equal to (case-insensitive):DWORD (0x00000001),DWORD (0x00000002),DWORD (0x00000003),DWORD (0x00000004)No QRadar property mapped for "Details": create a custom event property (regex or JSON) on the DSM first.
BB:OffSet7:RDP Sensitive Settings Changed:selection_ts_key(match)All test lines must match (AND).Process Name / Target Process Name / Object Namecontains:\Control\Terminal Server\,\Windows NT\Terminal Services\Process Name / Target Process Name / Object Nameends with:\DisableRemoteDesktopAntiAlias,\DisableSecuritySettings,\fAllowUnsolicited,\fAllowUnsolicitedFullControl- custom property needed:
Detailsis equal to (case-insensitive):DWORD (0x00000001)No QRadar property mapped for "Details": create a custom event property (regex or JSON) on the DSM first.
BB:OffSet7:RDP Sensitive Settings Changed:selection_ts_tamper_only(match)Any of the groups matches (OR): build one BB per group and a parent BB "when an event matches any of" them.Process Name / Target Process Name / Object Namecontains:\Control\Terminal Server\InitialProgram,\Control\Terminal Server\WinStations\RDP-Tcp\InitialProgram,\Terminal Server\WinStations\RDP-Tcp\SecurityLayer,\Windows NT\Terminal Services\InitialProgramProcess Name / Target Process Name / Object Nameends with:\services\TermService\Parameters\ServiceDll
BB:OffSet7:RDP Sensitive Settings Changed:filter_main_securitylayer_tls(exclusion)All test lines must match (AND).Process Name / Target Process Name / Object Nameends with:\SecurityLayer- custom property needed:
Detailsis equal to (case-insensitive):DWORD (0x00000002)No QRadar property mapped for "Details": create a custom event property (regex or JSON) on the DSM first.
BB:OffSet7:RDP Sensitive Settings Changed:filter_main_termsrv_dll(exclusion)All test lines must match (AND).Process Name / Target Process Name / Object Nameends with:\services\TermService\Parameters\ServiceDll- custom property needed:
Detailsis equal to (case-insensitive):%%SystemRoot%%\System32\termsrv.dll,%%SystemRoot%%\SysWOW64\termsrv.dll,%%windir%%\System32\termsrv.dll,%%windir%%\SysWOW64\termsrv.dll,%SystemRoot%\System32\termsrv.dll,%SystemRoot%\SysWOW64\termsrv.dll,%windir%\System32\termsrv.dll,%windir%\SysWOW64\termsrv.dll,C:\Windows\System32\termsrv.dll,C:\Windows\SysWOW64\termsrv.dllNo QRadar property mapped for "Details": create a custom event property (regex or JSON) on the DSM first.
BB:OffSet7:RDP Sensitive Settings Changed:filter_main_initialprog_empty(exclusion)All test lines must match (AND).Process Name / Target Process Name / Object Namecontains:\Control\Terminal Server\InitialProgram,\Control\Terminal Server\WinStations\RDP-Tcp\InitialProgram,\Windows NT\Terminal Services\InitialProgram- custom property needed:
Detailsis equal to (case-insensitive):(Empty)No QRadar property mapped for "Details": create a custom event property (regex or JSON) on the DSM first.
BB:OffSet7:RDP Sensitive Settings Changed:filter_optional_container_worker(exclusion)All test lines must match (AND).Process Path / Process Namestarts with:C:\Windows\System32\,C:\Windows\SysWOW64\,C:\Windows\WinSxS\Process Path / Process Nameends with:\containerworker.exeProcess Name / Target Process Name / Object Namecontains:\Windows\Containers\Layers\
Main rule, option A (building blocks)
- when the event(s) were detected by one or more of these log source types:
Microsoft Windows Security Event Log DSM: Sysmon EID 13 (registry value set) - when an event matches the condition built from these building blocks:
(ANY of [BB:OffSet7:RDP Sensitive Settings Changed:selection_ts_shadow, BB:OffSet7:RDP Sensitive Settings Changed:selection_ts_key, BB:OffSet7:RDP Sensitive Settings Changed:selection_ts_tamper_only]) AND NOT (ANY of [BB:OffSet7:RDP Sensitive Settings Changed:filter_main_securitylayer_tls, BB:OffSet7:RDP Sensitive Settings Changed:filter_main_termsrv_dll, BB:OffSet7:RDP Sensitive Settings Changed:filter_main_initialprog_empty]) AND NOT (ANY of [BB:OffSet7:RDP Sensitive Settings Changed:filter_optional_container_worker])
Main rule, option B (AQL filter test)
Not available: the AQL conversion failed for this rule.
Rule response
- Severity 7, credibility 6, relevance 7
- Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
- Respond no more than once per 30 minutes per Log Source (tune per environment)
Limitations
- AQL conversion failed (field 'Details' is not supported); only the building-block design is available.
- QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.
Splunk
Splunk SPLSearch
Search for Splunk with Windows/Sysmon field names. A scheduled search or ES correlation search also needs a schedule, time range, throttling and an adaptive response, set in your environment.
(((TargetObject IN ("*\\Control\\Terminal Server\\*", "*\\Windows NT\\Terminal Services\\*")) TargetObject="*\\Shadow" (Details IN ("DWORD (0x00000001)", "DWORD (0x00000002)", "DWORD (0x00000003)", "DWORD (0x00000004)"))) OR ((TargetObject IN ("*\\Control\\Terminal Server\\*", "*\\Windows NT\\Terminal Services\\*")) (TargetObject IN ("*\\DisableRemoteDesktopAntiAlias", "*\\DisableSecuritySettings", "*\\fAllowUnsolicited", "*\\fAllowUnsolicitedFullControl")) Details="DWORD (0x00000001)") OR TargetObject IN ("*\\Control\\Terminal Server\\InitialProgram*", "*\\Control\\Terminal Server\\WinStations\\RDP-Tcp\\InitialProgram*", "*\\Terminal Server\\WinStations\\RDP-Tcp\\SecurityLayer*", "*\\Windows NT\\Terminal Services\\InitialProgram*") OR TargetObject="*\\services\\TermService\\Parameters\\ServiceDll") NOT ((TargetObject="*\\SecurityLayer" Details="DWORD (0x00000002)") OR (TargetObject="*\\services\\TermService\\Parameters\\ServiceDll" (Details IN ("%%SystemRoot%%\\System32\\termsrv.dll", "%%SystemRoot%%\\SysWOW64\\termsrv.dll", "%%windir%%\\System32\\termsrv.dll", "%%windir%%\\SysWOW64\\termsrv.dll", "%SystemRoot%\\System32\\termsrv.dll", "%SystemRoot%\\SysWOW64\\termsrv.dll", "%windir%\\System32\\termsrv.dll", "%windir%\\SysWOW64\\termsrv.dll", "C:\\Windows\\System32\\termsrv.dll", "C:\\Windows\\SysWOW64\\termsrv.dll"))) OR ((TargetObject IN ("*\\Control\\Terminal Server\\InitialProgram*", "*\\Control\\Terminal Server\\WinStations\\RDP-Tcp\\InitialProgram*", "*\\Windows NT\\Terminal Services\\InitialProgram*")) (Details IN ("(Empty)", "")))) NOT ((Image IN ("C:\\Windows\\System32\\*", "C:\\Windows\\SysWOW64\\*", "C:\\Windows\\WinSxS\\*")) Image="*\\containerworker.exe" TargetObject="*\\Windows\\Containers\\Layers\\*")Splunk savedsearches.conf stanzaScheduled search template
Template stanza. Review schedule, alert actions and index/sourcetype for your environment before enabling.
[default]
dispatch.earliest_time = -30d
dispatch.latest_time = now
[RDP Sensitive Settings Changed]
description = Detects tampering of RDP Terminal Service/Server sensitive settings.Such as allowing unauthorized users access to a system via the 'fAllowUnsolicited' or enabling RDP via 'fDenyTSConnections', etc.Below is a list of registry keys/values that are monitored by this rule:- Shadow: Used to enable Remote Desktop shadowing, which allows an administrator to view or control a user's session.- DisableRemoteDesktopAntiAlias: Disables anti-aliasing for remote desktop sessions.- DisableSecuritySettings: Disables certain security settings for Remote Desktop connections.- fAllowUnsolicited: Allows unsolicited remote assistance offers.- fAllowUnsolicitedFullControl: Allows unsolicited remote assistance offers with full control.- InitialProgram: Specifies a program to run automatically when a user logs on to a remote computer.- ServiceDll: Used in RDP hijacking techniques to specify a custom DLL to be loaded by the Terminal Services service.- SecurityLayer: Specifies the security layer used for RDP connections.
search = (((TargetObject IN ("*\\Control\\Terminal Server\\*", "*\\Windows NT\\Terminal Services\\*")) TargetObject="*\\Shadow" (Details IN ("DWORD (0x00000001)", "DWORD (0x00000002)", "DWORD (0x00000003)", "DWORD (0x00000004)"))) OR ((TargetObject IN ("*\\Control\\Terminal Server\\*", "*\\Windows NT\\Terminal Services\\*")) (TargetObject IN ("*\\DisableRemoteDesktopAntiAlias", "*\\DisableSecuritySettings", "*\\fAllowUnsolicited", "*\\fAllowUnsolicitedFullControl")) Details="DWORD (0x00000001)") OR TargetObject IN ("*\\Control\\Terminal Server\\InitialProgram*", "*\\Control\\Terminal Server\\WinStations\\RDP-Tcp\\InitialProgram*", "*\\Terminal Server\\WinStations\\RDP-Tcp\\SecurityLayer*", "*\\Windows NT\\Terminal Services\\InitialProgram*") OR TargetObject="*\\services\\TermService\\Parameters\\ServiceDll") NOT ((TargetObject="*\\SecurityLayer" Details="DWORD (0x00000002)") OR (TargetObject="*\\services\\TermService\\Parameters\\ServiceDll" (Details IN ("%%SystemRoot%%\\System32\\termsrv.dll", "%%SystemRoot%%\\SysWOW64\\termsrv.dll", "%%windir%%\\System32\\termsrv.dll", "%%windir%%\\SysWOW64\\termsrv.dll", "%SystemRoot%\\System32\\termsrv.dll", "%SystemRoot%\\SysWOW64\\termsrv.dll", "%windir%\\System32\\termsrv.dll", "%windir%\\SysWOW64\\termsrv.dll", "C:\\Windows\\System32\\termsrv.dll", "C:\\Windows\\SysWOW64\\termsrv.dll"))) OR ((TargetObject IN ("*\\Control\\Terminal Server\\InitialProgram*", "*\\Control\\Terminal Server\\WinStations\\RDP-Tcp\\InitialProgram*", "*\\Windows NT\\Terminal Services\\InitialProgram*")) (Details IN ("(Empty)", "")))) NOT ((Image IN ("C:\\Windows\\System32\\*", "C:\\Windows\\SysWOW64\\*", "C:\\Windows\\WinSxS\\*")) Image="*\\containerworker.exe" TargetObject="*\\Windows\\Containers\\Layers\\*")Microsoft Sentinel
Microsoft Sentinel KQL (ASIM)Hunting query
Hunting query over ASIM-normalized tables. An analytics rule also needs a schedule, entity mapping and alert grouping.
imRegistry
| where (((RegistryKey contains "\\Control\\Terminal Server\\" or RegistryKey contains "\\Windows NT\\Terminal Services\\") and RegistryKey endswith "\\Shadow" and (RegistryValueData in~ ("DWORD (0x00000001)", "DWORD (0x00000002)", "DWORD (0x00000003)", "DWORD (0x00000004)"))) or ((RegistryKey contains "\\Control\\Terminal Server\\" or RegistryKey contains "\\Windows NT\\Terminal Services\\") and (RegistryKey endswith "\\DisableRemoteDesktopAntiAlias" or RegistryKey endswith "\\DisableSecuritySettings" or RegistryKey endswith "\\fAllowUnsolicited" or RegistryKey endswith "\\fAllowUnsolicitedFullControl") and RegistryValueData =~ "DWORD (0x00000001)") or ((RegistryKey contains "\\Control\\Terminal Server\\InitialProgram" or RegistryKey contains "\\Control\\Terminal Server\\WinStations\\RDP-Tcp\\InitialProgram" or RegistryKey contains "\\Terminal Server\\WinStations\\RDP-Tcp\\SecurityLayer" or RegistryKey contains "\\Windows NT\\Terminal Services\\InitialProgram") or RegistryKey endswith "\\services\\TermService\\Parameters\\ServiceDll")) and (not(((RegistryKey endswith "\\SecurityLayer" and RegistryValueData =~ "DWORD (0x00000002)") or (RegistryKey endswith "\\services\\TermService\\Parameters\\ServiceDll" and (RegistryValueData in~ ("%%SystemRoot%%\\System32\\termsrv.dll", "%%SystemRoot%%\\SysWOW64\\termsrv.dll", "%%windir%%\\System32\\termsrv.dll", "%%windir%%\\SysWOW64\\termsrv.dll", "%SystemRoot%\\System32\\termsrv.dll", "%SystemRoot%\\SysWOW64\\termsrv.dll", "%windir%\\System32\\termsrv.dll", "%windir%\\SysWOW64\\termsrv.dll", "C:\\Windows\\System32\\termsrv.dll", "C:\\Windows\\SysWOW64\\termsrv.dll"))) or ((RegistryKey contains "\\Control\\Terminal Server\\InitialProgram" or RegistryKey contains "\\Control\\Terminal Server\\WinStations\\RDP-Tcp\\InitialProgram" or RegistryKey contains "\\Windows NT\\Terminal Services\\InitialProgram") and (RegistryValueData in~ ("(Empty)", "")))))) and (not(((ActingProcessName startswith "C:\\Windows\\System32\\" or ActingProcessName startswith "C:\\Windows\\SysWOW64\\" or ActingProcessName startswith "C:\\Windows\\WinSxS\\") and ActingProcessName endswith "\\containerworker.exe" and RegistryKey contains "\\Windows\\Containers\\Layers\\")))Defender XDR
Microsoft Defender XDR KQLHunting query
Advanced hunting query. A custom detection rule also needs a frequency, impacted entities and actions.
DeviceRegistryEvents
| where (((RegistryKey contains "\\Control\\Terminal Server\\" or RegistryKey contains "\\Windows NT\\Terminal Services\\") and RegistryKey endswith "\\Shadow" and (RegistryValueData in~ ("DWORD (0x00000001)", "DWORD (0x00000002)", "DWORD (0x00000003)", "DWORD (0x00000004)"))) or ((RegistryKey contains "\\Control\\Terminal Server\\" or RegistryKey contains "\\Windows NT\\Terminal Services\\") and (RegistryKey endswith "\\DisableRemoteDesktopAntiAlias" or RegistryKey endswith "\\DisableSecuritySettings" or RegistryKey endswith "\\fAllowUnsolicited" or RegistryKey endswith "\\fAllowUnsolicitedFullControl") and RegistryValueData =~ "DWORD (0x00000001)") or ((RegistryKey contains "\\Control\\Terminal Server\\InitialProgram" or RegistryKey contains "\\Control\\Terminal Server\\WinStations\\RDP-Tcp\\InitialProgram" or RegistryKey contains "\\Terminal Server\\WinStations\\RDP-Tcp\\SecurityLayer" or RegistryKey contains "\\Windows NT\\Terminal Services\\InitialProgram") or RegistryKey endswith "\\services\\TermService\\Parameters\\ServiceDll")) and (not(((RegistryKey endswith "\\SecurityLayer" and RegistryValueData =~ "DWORD (0x00000002)") or (RegistryKey endswith "\\services\\TermService\\Parameters\\ServiceDll" and (RegistryValueData in~ ("%%SystemRoot%%\\System32\\termsrv.dll", "%%SystemRoot%%\\SysWOW64\\termsrv.dll", "%%windir%%\\System32\\termsrv.dll", "%%windir%%\\SysWOW64\\termsrv.dll", "%SystemRoot%\\System32\\termsrv.dll", "%SystemRoot%\\SysWOW64\\termsrv.dll", "%windir%\\System32\\termsrv.dll", "%windir%\\SysWOW64\\termsrv.dll", "C:\\Windows\\System32\\termsrv.dll", "C:\\Windows\\SysWOW64\\termsrv.dll"))) or ((RegistryKey contains "\\Control\\Terminal Server\\InitialProgram" or RegistryKey contains "\\Control\\Terminal Server\\WinStations\\RDP-Tcp\\InitialProgram" or RegistryKey contains "\\Windows NT\\Terminal Services\\InitialProgram") and (RegistryValueData in~ ("(Empty)", "")))))) and (not(((InitiatingProcessFolderPath startswith "C:\\Windows\\System32\\" or InitiatingProcessFolderPath startswith "C:\\Windows\\SysWOW64\\" or InitiatingProcessFolderPath startswith "C:\\Windows\\WinSxS\\") and InitiatingProcessFolderPath endswith "\\containerworker.exe" and RegistryKey contains "\\Windows\\Containers\\Layers\\")))Elastic
Elastic Lucene (ECS)Hunting query
Lucene query over ECS fields (Winlogbeat/Elastic Agent Windows mappings). A detection rule also needs an index pattern, schedule and actions.
(((registry.path:(*\\Control\\Terminal\ Server\\* OR *\\Windows\ NT\\Terminal\ Services\\*)) AND registry.path:*\\Shadow AND (registry.data.strings:("DWORD \(0x00000001\)" OR "DWORD \(0x00000002\)" OR "DWORD \(0x00000003\)" OR "DWORD \(0x00000004\)"))) OR ((registry.path:(*\\Control\\Terminal\ Server\\* OR *\\Windows\ NT\\Terminal\ Services\\*)) AND (registry.path:(*\\DisableRemoteDesktopAntiAlias OR *\\DisableSecuritySettings OR *\\fAllowUnsolicited OR *\\fAllowUnsolicitedFullControl)) AND registry.data.strings:"DWORD \(0x00000001\)") OR ((registry.path:(*\\Control\\Terminal\ Server\\InitialProgram* OR *\\Control\\Terminal\ Server\\WinStations\\RDP\-Tcp\\InitialProgram* OR *\\Terminal\ Server\\WinStations\\RDP\-Tcp\\SecurityLayer* OR *\\Windows\ NT\\Terminal\ Services\\InitialProgram*)) OR registry.path:*\\services\\TermService\\Parameters\\ServiceDll)) AND (NOT ((registry.path:*\\SecurityLayer AND registry.data.strings:"DWORD \(0x00000002\)") OR (registry.path:*\\services\\TermService\\Parameters\\ServiceDll AND (registry.data.strings:(%%SystemRoot%%\\System32\\termsrv.dll OR %%SystemRoot%%\\SysWOW64\\termsrv.dll OR %%windir%%\\System32\\termsrv.dll OR %%windir%%\\SysWOW64\\termsrv.dll OR %SystemRoot%\\System32\\termsrv.dll OR %SystemRoot%\\SysWOW64\\termsrv.dll OR %windir%\\System32\\termsrv.dll OR %windir%\\SysWOW64\\termsrv.dll OR C\:\\Windows\\System32\\termsrv.dll OR C\:\\Windows\\SysWOW64\\termsrv.dll))) OR ((registry.path:(*\\Control\\Terminal\ Server\\InitialProgram* OR *\\Control\\Terminal\ Server\\WinStations\\RDP\-Tcp\\InitialProgram* OR *\\Windows\ NT\\Terminal\ Services\\InitialProgram*)) AND (registry.data.strings:(\(Empty\) OR ""))))) AND (NOT ((process.executable:(C\:\\Windows\\System32\\* OR C\:\\Windows\\SysWOW64\\* OR C\:\\Windows\\WinSxS\\*)) AND process.executable:*\\containerworker.exe AND registry.path:*\\Windows\\Containers\\Layers\\*))Elastic EQL (ECS)Hunting query
EQL query over ECS fields. Usable in an Elastic Security EQL rule after review; index pattern and schedule are set per environment.
any where (((registry.path like~ ("*\\Control\\Terminal Server\\*", "*\\Windows NT\\Terminal Services\\*")) and registry.path:"*\\Shadow" and (registry.data.strings like~ ("DWORD (0x00000001)", "DWORD (0x00000002)", "DWORD (0x00000003)", "DWORD (0x00000004)"))) or ((registry.path like~ ("*\\Control\\Terminal Server\\*", "*\\Windows NT\\Terminal Services\\*")) and (registry.path like~ ("*\\DisableRemoteDesktopAntiAlias", "*\\DisableSecuritySettings", "*\\fAllowUnsolicited", "*\\fAllowUnsolicitedFullControl")) and registry.data.strings:"DWORD (0x00000001)") or ((registry.path like~ ("*\\Control\\Terminal Server\\InitialProgram*", "*\\Control\\Terminal Server\\WinStations\\RDP-Tcp\\InitialProgram*", "*\\Terminal Server\\WinStations\\RDP-Tcp\\SecurityLayer*", "*\\Windows NT\\Terminal Services\\InitialProgram*")) or registry.path:"*\\services\\TermService\\Parameters\\ServiceDll")) and (not ((registry.path:"*\\SecurityLayer" and registry.data.strings:"DWORD (0x00000002)") or (registry.path:"*\\services\\TermService\\Parameters\\ServiceDll" and (registry.data.strings like~ ("%%SystemRoot%%\\System32\\termsrv.dll", "%%SystemRoot%%\\SysWOW64\\termsrv.dll", "%%windir%%\\System32\\termsrv.dll", "%%windir%%\\SysWOW64\\termsrv.dll", "%SystemRoot%\\System32\\termsrv.dll", "%SystemRoot%\\SysWOW64\\termsrv.dll", "%windir%\\System32\\termsrv.dll", "%windir%\\SysWOW64\\termsrv.dll", "C:\\Windows\\System32\\termsrv.dll", "C:\\Windows\\SysWOW64\\termsrv.dll"))) or ((registry.path like~ ("*\\Control\\Terminal Server\\InitialProgram*", "*\\Control\\Terminal Server\\WinStations\\RDP-Tcp\\InitialProgram*", "*\\Windows NT\\Terminal Services\\InitialProgram*")) and (registry.data.strings like~ ("(Empty)", ""))))) and (not ((process.executable like~ ("C:\\Windows\\System32\\*", "C:\\Windows\\SysWOW64\\*", "C:\\Windows\\WinSxS\\*")) and process.executable:"*\\containerworker.exe" and registry.path:"*\\Windows\\Containers\\Layers\\*"))Elastic ES|QL (ECS)Hunting query
ES|QL query over ECS fields; the FROM clause uses * and must be narrowed to your indices.
from * metadata _id, _index, _version | where ((registry.path like "*\\\\Control\\\\Terminal Server\\\\*" or registry.path like "*\\\\Windows NT\\\\Terminal Services\\\\*") and ends_with(registry.path, "\\Shadow") and (registry.data.strings in ("DWORD (0x00000001)", "DWORD (0x00000002)", "DWORD (0x00000003)", "DWORD (0x00000004)")) or (registry.path like "*\\\\Control\\\\Terminal Server\\\\*" or registry.path like "*\\\\Windows NT\\\\Terminal Services\\\\*") and (ends_with(registry.path, "\\DisableRemoteDesktopAntiAlias") or ends_with(registry.path, "\\DisableSecuritySettings") or ends_with(registry.path, "\\fAllowUnsolicited") or ends_with(registry.path, "\\fAllowUnsolicitedFullControl")) and registry.data.strings=="DWORD (0x00000001)" or registry.path like "*\\\\Control\\\\Terminal Server\\\\InitialProgram*" or registry.path like "*\\\\Control\\\\Terminal Server\\\\WinStations\\\\RDP-Tcp\\\\InitialProgram*" or registry.path like "*\\\\Terminal Server\\\\WinStations\\\\RDP-Tcp\\\\SecurityLayer*" or registry.path like "*\\\\Windows NT\\\\Terminal Services\\\\InitialProgram*" or ends_with(registry.path, "\\services\\TermService\\Parameters\\ServiceDll")) and not (ends_with(registry.path, "\\SecurityLayer") and registry.data.strings=="DWORD (0x00000002)" or ends_with(registry.path, "\\services\\TermService\\Parameters\\ServiceDll") and (registry.data.strings in ("%%SystemRoot%%\\System32\\termsrv.dll", "%%SystemRoot%%\\SysWOW64\\termsrv.dll", "%%windir%%\\System32\\termsrv.dll", "%%windir%%\\SysWOW64\\termsrv.dll", "%SystemRoot%\\System32\\termsrv.dll", "%SystemRoot%\\SysWOW64\\termsrv.dll", "%windir%\\System32\\termsrv.dll", "%windir%\\SysWOW64\\termsrv.dll", "C:\\Windows\\System32\\termsrv.dll", "C:\\Windows\\SysWOW64\\termsrv.dll")) or (registry.path like "*\\\\Control\\\\Terminal Server\\\\InitialProgram*" or registry.path like "*\\\\Control\\\\Terminal Server\\\\WinStations\\\\RDP-Tcp\\\\InitialProgram*" or registry.path like "*\\\\Windows NT\\\\Terminal Services\\\\InitialProgram*") and (registry.data.strings in ("(Empty)", ""))) and not ((starts_with(process.executable, "C:\\Windows\\System32\\") or starts_with(process.executable, "C:\\Windows\\SysWOW64\\") or starts_with(process.executable, "C:\\Windows\\WinSxS\\")) and ends_with(process.executable, "\\containerworker.exe") and registry.path like "*\\\\Windows\\\\Containers\\\\Layers\\\\*")No working conversion: IBM QRadar AQL (hunting query) (QRadar AQL backend has no property mapping for field "Details")
Required telemetry
- Log source
product: windows · category: registry_set- Fields used
DetailsImageTargetObject
False positives
- Some of the keys mentioned here could be modified by an administrator while setting group policy (it should be investigated either way)
Investigation and response
No OffSet7 investigation guidance has been written for this rule yet. Start from the false positives above and the ATT&CK technique pages.
References
- https://admx.help/HKLM/SOFTWARE/Policies/Microsoft/Windows%20NT/Terminal%20Services
- https://bazaar.abuse.ch/sample/6f3aa9362d72e806490a8abce245331030d1ab5ac77e400dd475748236a6cc81/
- https://blog.sekoia.io/darkgate-internals/
- https://blog.talosintelligence.com/understanding-the-phobos-affiliate-structure/
- https://github.com/redcanaryco/atomic-red-team/blob/02c7d02fe1f1feb0fc7944550408ea8224273994/atomics/T1112/T1112.md#atomic-test-63---disable-remote-desktop-anti-alias-setting-through-registry
- https://github.com/redcanaryco/atomic-red-team/blob/02c7d02fe1f1feb0fc7944550408ea8224273994/atomics/T1112/T1112.md#atomic-test-64---disable-remote-desktop-security-settings-through-registry
- https://github.com/redcanaryco/atomic-red-team/blob/dd526047b8c399c312fee47d1e6fb531164da54d/atomics/T1112/T1112.yaml#L790
- https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-terminalservices-rdp-winstationextensions-securitylayer
- https://threathunterplaybook.com/hunts/windows/190407-RegModEnableRDPConnections/notebook.html
- https://twitter.com/SagieSec/status/1469001618863624194?t=HRf0eA0W1YYzkTSHb-Ky1A&s=03
- https://web.archive.org/web/20200929062532/https://blog.menasec.net/2019/02/threat-hunting-rdp-hijacking-via.html
- https://www.trendmicro.com/en_us/research/25/i/unmasking-the-gentlemen-ransomware.html
Author and attribution
- Author
- Samir Bousseaden, David ANDRE, Roberto Rodriguez @Cyb3rWard0g, Nasreddine Bencherchali
- Source
- SigmaHQ ·
rules/windows/registry/registry_set/registry_set_terminal_server_tampering.yml - Upstream commit
9688134317a2- Licence
- Detection Rule License (DRL) 1.1
Version history
- Version 1Imported from SigmaHQ
- OffSet7 build · SigmaHQ
9688134317a2