Detection rules › YARA-L

CurrentVersion Autorun Keys Modification

Severity
medium
Time window
5m
Match by
hostname
Author
Victor Sergeev, Daniil Yugoslavskiy, Gleb Sukhodolskiy, Timur Zinniatullin, oscd.community, Tim Shelton, frack113 (split)
Source
github.com/chronicle/detection-rules

Detects modification of autostart extensibility point (ASEP) in registry

MITRE ATT&CK coverage

References

Event coverage

Rule body yaral

/*
 * Copyright 2025 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

rule currentversion_autorun_keys_modification {

  meta:
    author = "Victor Sergeev, Daniil Yugoslavskiy, Gleb Sukhodolskiy, Timur Zinniatullin, oscd.community, Tim Shelton, frack113 (split)"
    description = "Detects modification of autostart extensibility point (ASEP) in registry"
    reference = "https://github.com/SigmaHQ/sigma/blob/master/rules/windows/registry/registry_set/registry_set_asep_reg_keys_modification_currentversion.yml"
    license = "https://github.com/SigmaHQ/Detection-Rule-License/blob/main/LICENSE.Detection.Rules.md"
    rule_name = "CurrentVersion Autorun Keys Modification"
    rule_id = "mr_711750f0-0bf3-4c89-b771-65a1ed6aad05"
    sigma_uuid = "20f0ee37-5942-4e45-b7d5-c5b5db9df5cd"
    sigma_status = "test"
    tactic = "TA0003"
    technique = "T1547.001"
    data_source = "Sysmon Windows Registry"
    platform = "Windows"
    severity = "Medium"
    priority = "Medium"
    false_positives = "Legitimate software automatically sets up autorun keys"

  events:
    $reg.metadata.event_type = "REGISTRY_MODIFICATION"
    strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\software\\microsoft\\windows\\currentversion") and
    (
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\shellserviceobjectdelayload") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\run\\") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\runonce\\") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\runonceex\\") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\runservices\\") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\runservicesonce\\") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\policies\\system\\shell") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\policies\\explorer\\run") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\group policy\\scripts\\startup") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\group policy\\scripts\\shutdown") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\group policy\\scripts\\logon") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\group policy\\scripts\\logoff") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\explorer\\shellserviceobjects") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\explorer\\shelliconoverlayidentifiers") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\explorer\\shellexecutehooks") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\explorer\\sharedtaskscheduler") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\explorer\\browser helper objects") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\authentication\\plap providers") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\authentication\\credential providers") or
        strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\authentication\\credential provider filters")
    )
    not (
        $reg.target.registry.registry_value_data = "(Empty)" or
        re.regex($reg.target.registry.registry_key, `\\NgcFirst\\ConsecutiveSwitchCount$`) nocase or
        re.regex($reg.principal.process.file.full_path, `\\AppData\\Local\\Microsoft\\OneDrive\\Update\\OneDriveSetup\.exe$`) nocase or
        re.regex($reg.principal.process.file.full_path, `\\AppData\\Roaming\\Spotify\\Spotify\.exe$`) nocase or
        re.regex($reg.principal.process.file.full_path, `\\AppData\\Local\\WebEx\\WebexHost\.exe$`) nocase or
        $reg.principal.process.file.full_path = "C:\\WINDOWS\\system32\\devicecensus.exe" nocase or
        $reg.principal.process.file.full_path = "C:\\Windows\\system32\\winsat.exe" nocase or
        $reg.principal.process.file.full_path = "C:\\Program Files\\Microsoft OneDrive\\StandaloneUpdater\\OneDriveSetup.exe" nocase or
        $reg.principal.process.file.full_path = "C:\\Program Files\\Microsoft OneDrive\\Update\\OneDriveSetup.exe" nocase or
        $reg.principal.process.file.full_path = "C:\\Program Files (x86)\\Microsoft OneDrive\\Update\\OneDriveSetup.exe" nocase or
        $reg.principal.process.file.full_path = "C:\\Program Files\\KeePass Password Safe 2\\ShInstUtil.exe" nocase or
        $reg.principal.process.file.full_path = "C:\\Program Files\\Everything\\Everything.exe" nocase or
        $reg.principal.process.file.full_path = "C:\\Program Files (x86)\\Microsoft Office\\root\\integration\\integrator.exe" nocase or
        (
            $reg.principal.process.file.full_path = "C:\\Windows\\system32\\LogonUI.exe" nocase and
            (
                strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\authentication\\credential providers\\{d6886603-9d2f-4eb2-b667-1971041fa96b}\\") or
                strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\authentication\\credential providers\\{bec09223-b018-416d-a0ac-523971b639f5}\\") or
                strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\authentication\\credential providers\\{8af662bf-65a0-4d0a-a540-a338a999d36f}\\") or
                strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\authentication\\credential providers\\{27fbdb57-b613-4af2-9d7e-4fa7a66c21ad}\\")
            )
        ) or
        (
            (
                strings.starts_with(strings.to_lower($reg.principal.process.file.full_path), "c:\\program files (x86)\\microsoft\\edgeupdate\\install\\") or
                strings.starts_with(strings.to_lower($reg.principal.process.file.full_path), "c:\\program files (x86)\\microsoft\\edgewebview\\") or
                strings.starts_with(strings.to_lower($reg.principal.process.file.full_path), "c:\\program files (x86)\\microsoft\\edge\\application\\msedge.exe")
            )
        ) or
        (
            $reg.principal.process.file.full_path = "C:\\Windows\\system32\\regsvr32.exe" nocase and
            strings.contains(strings.to_lower($reg.target.registry.registry_key), "dropboxt") and
            re.regex($reg.target.registry.registry_value_data, `A251-47B7-93E1-CDD82E34AF8B}$`) nocase
        ) or
        (
            re.regex($reg.target.registry.registry_key, `\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\Opera Browser Assistant$`) nocase and
            $reg.target.registry.registry_value_data = "C:\\Program Files\\Opera\\assistant\\browser_assistant.exe" nocase
        ) or
        (
            re.regex($reg.target.registry.registry_key, `\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\iTunesHelper$`) nocase and
            $reg.target.registry.registry_value_data = "\"C:\\Program Files\\iTunes\\iTunesHelper.exe\"" nocase
        ) or
        (
            re.regex($reg.target.registry.registry_key, `\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\zoommsirepair$`) nocase and
            $reg.target.registry.registry_value_data = "\"C:\\Program Files\\Zoom\\bin\\installer.exe\" /repair" nocase
        ) or
        (
            re.regex($reg.target.registry.registry_key, `\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\Greenshot$`) nocase and
            $reg.target.registry.registry_value_data = "C:\\Program Files\\Greenshot\\Greenshot.exe" nocase
        ) or
        (
            re.regex($reg.target.registry.registry_key, `\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\GoogleDriveFS$`) nocase and
            strings.starts_with(strings.to_lower($reg.target.registry.registry_value_data), "c:\\program files\\google\\drive file stream\\") and
            strings.contains(strings.to_lower($reg.target.registry.registry_value_data), "\\googledrivefs.exe")
        ) or
        (
            strings.contains(strings.to_lower($reg.target.registry.registry_key), "googledrive") and
            (
                $reg.target.registry.registry_value_data = "{CFE8B367-77A7-41D7-9C90-75D16D7DC6B6}" or
                $reg.target.registry.registry_value_data = "{A8E52322-8734-481D-A7E2-27B309EF8D56}" or
                $reg.target.registry.registry_value_data = "{C973DA94-CBDF-4E77-81D1-E5B794FBD146}" or
                $reg.target.registry.registry_value_data = "{51EF1569-67EE-4AD6-9646-E726C3FFC8A2}"
            )
        ) or
        (
            (
                strings.starts_with(strings.to_lower($reg.target.registry.registry_value_data), "c:\\windows\\system32\\cmd.exe /q /c rmdir /s /q \"c:\\users\\") or
                strings.starts_with(strings.to_lower($reg.target.registry.registry_value_data), "c:\\windows\\system32\\cmd.exe /q /c del /q \"c:\\users\\")
             ) and
            strings.contains(strings.to_lower($reg.target.registry.registry_value_data), "\\appdata\\local\\microsoft\\onedrive\\")
        ) or
        (
            strings.contains(strings.to_lower($reg.target.registry.registry_key), "\\microsoft\\windows\\currentversion\\runonce\\{") and
            strings.contains(strings.to_lower($reg.target.registry.registry_value_data), "\\appdata\\local\\package cache\\{") and
            strings.contains(strings.to_lower($reg.target.registry.registry_value_data), "}\\python-") and
            re.regex($reg.target.registry.registry_value_data, `\.exe" /burn\.runonce$`) nocase
        ) or
        (
            (
                strings.starts_with(strings.to_lower($reg.principal.process.file.full_path), "c:\\program files\\common files\\microsoft shared\\clicktorun\\") or
                strings.starts_with(strings.to_lower($reg.principal.process.file.full_path), "c:\\program files\\common files\\microsoft shared\\clicktorun\\updates\\")
            ) and
            re.regex($reg.principal.process.file.full_path, `\\OfficeClickToRun\.exe$`) nocase
        ) or
        $reg.principal.process.file.full_path = "C:\\Program Files\\Windows Defender\\MsMpEng.exe" nocase or
        (
            re.regex($reg.principal.process.file.full_path, `\\Microsoft\\Teams\\current\\Teams\.exe$`) nocase and
            strings.contains(strings.to_lower($reg.target.registry.registry_value_data), "\\microsoft\\teams\\update.exe --processstart ")
        ) or
        (
            $reg.principal.process.file.full_path = "C:\\Windows\\system32\\userinit.exe" nocase and
            $reg.target.registry.registry_value_data = "ctfmon.exe /n" nocase
        ) or
        (
            strings.starts_with(strings.to_lower($reg.principal.process.file.full_path), "c:\\program files\\avg\\antivirus\\setup\\") and
            (
                $reg.target.registry.registry_value_data = "\"C:\\Program Files\\AVG\\Antivirus\\AvLaunch.exe\" /gui" nocase or
                $reg.target.registry.registry_value_data = "\"C:\\Program Files (x86)\\AVG\\Antivirus\\AvLaunch.exe\" /gui" nocase or
                $reg.target.registry.registry_value_data = "{472083B0-C522-11CF-8763-00608CC02F24}" nocase
            )
        ) or
        (
            re.regex($reg.principal.process.file.full_path, `\\aurora-agent(|-64)\.exe$`) nocase and
            re.regex($reg.target.registry.registry_key, `\\Microsoft\\Windows\\CurrentVersion\\Run\\aurora-dashboard$`) nocase and
            $reg.target.registry.registry_value_data = "C:\\Program Files\\Aurora-Agent\\tools\\aurora-dashboard.exe" nocase
        ) or
        (
            re.regex($reg.target.registry.registry_key, `\\Microsoft\\Windows\\CurrentVersion\\Run\\Everything$`) nocase and
            re.regex($reg.target.registry.registry_value_data, `\\Everything\\Everything\.exe" -startup$`) nocase
        )
    )

    $reg.principal.hostname = $hostname

  match:
    $hostname over 5m

  outcome:
    //example usage of specifying test hostname to adjust risk score
    $risk_score = max(if($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 logic

Fires when at least one $reg event in the 5m window.

Events

$reg REGISTRY_MODIFICATION (13, 4657)

  • target.registry.registry_key contains "\\software\\microsoft\\windows\\currentversion"
  • target.registry.registry_key contains "\\shellserviceobjectdelayload"
  • target.registry.registry_key contains "\\run\\"
  • target.registry.registry_key contains "\\runonce\\"
  • target.registry.registry_key contains "\\runonceex\\"
  • target.registry.registry_key contains "\\runservices\\"
  • target.registry.registry_key contains "\\runservicesonce\\"
  • target.registry.registry_key contains "\\policies\\system\\shell"
  • target.registry.registry_key contains "\\policies\\explorer\\run"
  • target.registry.registry_key contains "\\group policy\\scripts\\startup"
  • target.registry.registry_key contains "\\group policy\\scripts\\shutdown"
  • target.registry.registry_key contains "\\group policy\\scripts\\logon"
  • target.registry.registry_key contains "\\group policy\\scripts\\logoff"
  • target.registry.registry_key contains "\\explorer\\shellserviceobjects"
  • target.registry.registry_key contains "\\explorer\\shelliconoverlayidentifiers"
  • target.registry.registry_key contains "\\explorer\\shellexecutehooks"
  • target.registry.registry_key contains "\\explorer\\sharedtaskscheduler"
  • target.registry.registry_key contains "\\explorer\\browser helper objects"
  • target.registry.registry_key contains "\\authentication\\plap providers"
  • target.registry.registry_key contains "\\authentication\\credential providers"
  • target.registry.registry_key contains "\\authentication\\credential provider filters"
  • target.registry.registry_value_data = "(Empty)"
  • target.registry.registry_key matches "\\NgcFirst\\ConsecutiveSwitchCount$"
  • principal.process.file.full_path matches "\\AppData\\Local\\Microsoft\\OneDrive\\Update\\OneDriveSetup\.exe$"
  • principal.process.file.full_path matches "\\AppData\\Roaming\\Spotify\\Spotify\.exe$"
  • principal.process.file.full_path matches "\\AppData\\Local\\WebEx\\WebexHost\.exe$"
  • principal.process.file.full_path = "C:\\WINDOWS\\system32\\devicecensus.exe"
  • principal.process.file.full_path = "C:\\Windows\\system32\\winsat.exe"
  • principal.process.file.full_path = "C:\\Program Files\\Microsoft OneDrive\\StandaloneUpdater\\OneDriveSetup.exe"
  • principal.process.file.full_path = "C:\\Program Files\\Microsoft OneDrive\\Update\\OneDriveSetup.exe"
  • principal.process.file.full_path = "C:\\Program Files (x86)\\Microsoft OneDrive\\Update\\OneDriveSetup.exe"
  • principal.process.file.full_path = "C:\\Program Files\\KeePass Password Safe 2\\ShInstUtil.exe"
  • principal.process.file.full_path = "C:\\Program Files\\Everything\\Everything.exe"
  • principal.process.file.full_path = "C:\\Program Files (x86)\\Microsoft Office\\root\\integration\\integrator.exe"
  • principal.process.file.full_path = "C:\\Windows\\system32\\LogonUI.exe"
  • target.registry.registry_key contains "\\authentication\\credential providers\\{d6886603-9d2f-4eb2-b667-1971041fa96b}\\"
  • target.registry.registry_key contains "\\authentication\\credential providers\\{bec09223-b018-416d-a0ac-523971b639f5}\\"
  • target.registry.registry_key contains "\\authentication\\credential providers\\{8af662bf-65a0-4d0a-a540-a338a999d36f}\\"
  • target.registry.registry_key contains "\\authentication\\credential providers\\{27fbdb57-b613-4af2-9d7e-4fa7a66c21ad}\\"
  • principal.process.file.full_path starts with "c:\\program files (x86)\\microsoft\\edgeupdate\\install\\"
  • principal.process.file.full_path starts with "c:\\program files (x86)\\microsoft\\edgewebview\\"
  • principal.process.file.full_path starts with "c:\\program files (x86)\\microsoft\\edge\\application\\msedge.exe"
  • principal.process.file.full_path = "C:\\Windows\\system32\\regsvr32.exe"
  • target.registry.registry_key contains "dropboxt"
  • target.registry.registry_value_data matches "A251-47B7-93E1-CDD82E34AF8B}$"
  • target.registry.registry_key matches "\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\Opera Browser Assistant$"
  • target.registry.registry_value_data = "C:\\Program Files\\Opera\\assistant\\browser_assistant.exe"
  • target.registry.registry_key matches "\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\iTunesHelper$"
  • target.registry.registry_value_data = "\"C:\\Program Files\\iTunes\\iTunesHelper.exe\""
  • target.registry.registry_key matches "\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\zoommsirepair$"
  • target.registry.registry_value_data = "\"C:\\Program Files\\Zoom\\bin\\installer.exe\" /repair"
  • target.registry.registry_key matches "\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\Greenshot$"
  • target.registry.registry_value_data = "C:\\Program Files\\Greenshot\\Greenshot.exe"
  • target.registry.registry_key matches "\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\GoogleDriveFS$"
  • target.registry.registry_value_data starts with "c:\\program files\\google\\drive file stream\\"
  • target.registry.registry_value_data contains "\\googledrivefs.exe"
  • target.registry.registry_key contains "googledrive"
  • target.registry.registry_value_data = "{CFE8B367-77A7-41D7-9C90-75D16D7DC6B6}" or "{A8E52322-8734-481D-A7E2-27B309EF8D56}" or "{C973DA94-CBDF-4E77-81D1-E5B794FBD146}" or "{51EF1569-67EE-4AD6-9646-E726C3FFC8A2}"
  • target.registry.registry_value_data starts with "c:\\windows\\system32\\cmd.exe /q /c rmdir /s /q \"c:\\users\\"
  • target.registry.registry_value_data starts with "c:\\windows\\system32\\cmd.exe /q /c del /q \"c:\\users\\"
  • target.registry.registry_value_data contains "\\appdata\\local\\microsoft\\onedrive\\"
  • target.registry.registry_key contains "\\microsoft\\windows\\currentversion\\runonce\\{"
  • target.registry.registry_value_data contains "\\appdata\\local\\package cache\\{"
  • target.registry.registry_value_data contains "}\\python-"
  • target.registry.registry_value_data matches "\.exe" /burn\.runonce$"
  • principal.process.file.full_path starts with "c:\\program files\\common files\\microsoft shared\\clicktorun\\"
  • principal.process.file.full_path starts with "c:\\program files\\common files\\microsoft shared\\clicktorun\\updates\\"
  • principal.process.file.full_path matches "\\OfficeClickToRun\.exe$"
  • principal.process.file.full_path = "C:\\Program Files\\Windows Defender\\MsMpEng.exe"
  • principal.process.file.full_path matches "\\Microsoft\\Teams\\current\\Teams\.exe$"
  • target.registry.registry_value_data contains "\\microsoft\\teams\\update.exe --processstart "
  • principal.process.file.full_path = "C:\\Windows\\system32\\userinit.exe"
  • target.registry.registry_value_data = "ctfmon.exe /n"
  • principal.process.file.full_path starts with "c:\\program files\\avg\\antivirus\\setup\\"
  • target.registry.registry_value_data = "\"C:\\Program Files\\AVG\\Antivirus\\AvLaunch.exe\" /gui" or "\"C:\\Program Files (x86)\\AVG\\Antivirus\\AvLaunch.exe\" /gui" or "{472083B0-C522-11CF-8763-00608CC02F24}"
  • principal.process.file.full_path matches "\\aurora-agent(|-64)\.exe$"
  • target.registry.registry_key matches "\\Microsoft\\Windows\\CurrentVersion\\Run\\aurora-dashboard$"
  • target.registry.registry_value_data = "C:\\Program Files\\Aurora-Agent\\tools\\aurora-dashboard.exe"
  • target.registry.registry_key matches "\\Microsoft\\Windows\\CurrentVersion\\Run\\Everything$"
  • target.registry.registry_value_data matches "\\Everything\\Everything\.exe" -startup$"

Correlation

Match key
$hostname (principal.hostname)
Within
5m

Outcome

Fields the detection emits on a match. $risk_score drives alerting; Chronicle surfaces the rest on the detection.

FieldExpression
risk_scoremax(if($reg.principal.hostname = "hostname", 0, 15))
principal_hostnamearray_distinct($reg.principal.hostname)
principal_process_pidarray_distinct($reg.principal.process.pid)
principal_process_file_full_patharray_distinct($reg.principal.process.file.full_path)
principal_process_product_specific_process_idarray_distinct($reg.principal.process.product_specific_process_id)
principal_user_useridarray_distinct($reg.principal.user.userid)
target_registry_keyarray_distinct($reg.target.registry.registry_key)
target_registry_value_dataarray_distinct($reg.target.registry.registry_value_data)
log_typearray_distinct(strings.concat($reg.metadata.log_type,"/",$reg.metadata.product_event_type))