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
Query · yara_l
events:
$reg.metadata.event_type = "REGISTRY_MODIFICATION"
(
(
(
strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\control\\terminal server\\") or
strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\windows nt\\terminal services\\")
) and
re.regex($reg.target.registry.registry_key, `\\Shadow$`) nocase and
(
$reg.target.registry.registry_value_data = "DWORD (0x00000001)" nocase or
$reg.target.registry.registry_value_data = "DWORD (0x00000002)" nocase or
$reg.target.registry.registry_value_data = "DWORD (0x00000003)" nocase or
$reg.target.registry.registry_value_data = "DWORD (0x00000004)" nocase
)
)
or
(
(
strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\control\\terminal server\\") or
strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\windows nt\\terminal services\\")
) and
(
re.regex($reg.target.registry.registry_key, `\\DisableRemoteDesktopAntiAlias$`) nocase or
re.regex($reg.target.registry.registry_key, `\\DisableSecuritySettings$`) nocase or
re.regex($reg.target.registry.registry_key, `\\fAllowUnsolicited$`) nocase or
re.regex($reg.target.registry.registry_key, `\\fAllowUnsolicitedFullControl$`) nocase
) and
$reg.target.registry.registry_value_data = "DWORD (0x00000001)" nocase
)
or
(
strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\control\\terminal server\\initialprogram") or
strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\control\\terminal server\\winstations\\rdp-tcp\\initialprogram") or
strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\services\\termservice\\parameters\\servicedll") or
strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\windows nt\\terminal services\\initialprogram")
)
)
$reg.principal.hostname = $hostname
match:
$hostname over 5m
outcome:
//example usage of specifying test user and hostname to adjust risk score
$risk_score = max(if($reg.principal.user.userid = "user" and $reg.principal.hostname = "hostname", 0, 15))
$principal_hostname = array_distinct($reg.principal.hostname)
$principal_process_pid = array_distinct($reg.principal.process.pid)
$principal_process_file_full_path = array_distinct($reg.principal.process.file.full_path)
$principal_process_product_specific_process_id = array_distinct($reg.principal.process.product_specific_process_id)
$principal_user_userid = array_distinct($reg.principal.user.userid)
$target_registry_key = array_distinct($reg.target.registry.registry_key)
$target_registry_value_data = array_distinct($reg.target.registry.registry_value_data)
$log_type = array_distinct(strings.concat($reg.metadata.log_type,"/",$reg.metadata.product_event_type))
condition:
$reg