disable_internal_tools_or_feature_in_registry


Description

Detects registry modifications that change features of internal Windows tools (malware like Agent Tesla uses this technique)

Query · yara_l

events:
    $reg.metadata.event_type = "REGISTRY_MODIFICATION"
    (
        (
            (
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\DisableCMD$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\NoControlPanel$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\NoRun$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\StartMenuLogOff$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\DisableChangePassword$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\DisableLockWorkstation$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\DisableRegistryTools$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\DisableTaskmgr$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\NoDispBackgroundPage$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\NoDispCPL$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer\\DisableNotificationCenter$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Policies\\Microsoft\\Windows\\System\\DisableCMD$`) nocase
            ) and
            $reg.target.registry.registry_value_data = "DWORD (0x00000001)" nocase
        )
        or
        (
            (
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\ConsentPromptBehaviorAdmin$`) nocase or
                re.regex($reg.target.registry.registry_key, `Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\InactivityTimeoutSecs$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\shutdownwithoutlogon$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\PushNotifications\\ToastEnabled$`) nocase or
                re.regex($reg.target.registry.registry_key, `SYSTEM\\CurrentControlSet\\Control\\Storage\\Write Protection$`) nocase or
                re.regex($reg.target.registry.registry_key, `SYSTEM\\CurrentControlSet\\Control\\StorageDevicePolicies\\WriteProtect$`) nocase
            ) and
            $reg.target.registry.registry_value_data = "DWORD (0x00000000)" nocase
        )
    )
    $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
Raw source disable_internal_tools_or_feature_in_registry · YARA-L
Esc
Published by chronicle/detection-rules ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
rule disable_internal_tools_or_feature_in_registry {

  meta:
    author = "frack113, Nasreddine Bencherchali (Nextron Systems), CrimpSec"
    description = "Detects registry modifications that change features of internal Windows tools (malware like Agent Tesla uses this technique)"
    reference = "https://github.com/SigmaHQ/sigma/blob/master/rules/windows/registry/registry_set/registry_set_disable_function_user.yml"
    license = "https://github.com/SigmaHQ/Detection-Rule-License/blob/main/LICENSE.Detection.Rules.md"
    rule_name = "Disable Internal Tools or Feature in Registry"
    rule_id = "mr_5840c962-0e51-47e6-9941-d143ebaae00d"
    sigma_uuid = "e2482f8d-3443-4237-b906-cc145d87a076"
    sigma_status = "test"
    tactic = "TA0005"
    technique = "T1112"
    type = "Detection"
    data_source = "Windows Registry"
    platform = "Windows"
    severity = "Medium"
    priority = "Medium"
    false_positives = "Legitimate admin script"

  events:
    $reg.metadata.event_type = "REGISTRY_MODIFICATION"
    (
        (
            (
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\DisableCMD$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\NoControlPanel$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\NoRun$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\StartMenuLogOff$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\DisableChangePassword$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\DisableLockWorkstation$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\DisableRegistryTools$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\DisableTaskmgr$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\NoDispBackgroundPage$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\NoDispCPL$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer\\DisableNotificationCenter$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Policies\\Microsoft\\Windows\\System\\DisableCMD$`) nocase
            ) and
            $reg.target.registry.registry_value_data = "DWORD (0x00000001)" nocase
        )
        or
        (
            (
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\ConsentPromptBehaviorAdmin$`) nocase or
                re.regex($reg.target.registry.registry_key, `Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\InactivityTimeoutSecs$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\shutdownwithoutlogon$`) nocase or
                re.regex($reg.target.registry.registry_key, `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\PushNotifications\\ToastEnabled$`) nocase or
                re.regex($reg.target.registry.registry_key, `SYSTEM\\CurrentControlSet\\Control\\Storage\\Write Protection$`) nocase or
                re.regex($reg.target.registry.registry_key, `SYSTEM\\CurrentControlSet\\Control\\StorageDevicePolicies\\WriteProtect$`) nocase
            ) and
            $reg.target.registry.registry_value_data = "DWORD (0x00000000)" nocase
        )
    )
    $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
}

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.