Detection rules › Elastic

Registry Run Key Prefixed with Asterisk

Source
github.com/elastic/protections-artifacts

Run and RunOnce registry keys cause programs to run each time that a user logs on. By default, these keys are ignored when the computer is started in Safe Mode. The value name of RunOnce keys can be prefixed with an asterisk (*) to force the program to run even in Safe Mode. Attackers have been observed in the wild using this technique to execute ransomware in Safe Mode.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Run and RunOnce registry keys cause programs to run each time that a user logs on. By default, these keys are ignored
when the computer is started in Safe Mode. The value name of RunOnce keys can be prefixed with an asterisk (*) to force
the program to run even in Safe Mode. Attackers have been observed in the wild using this technique to execute
ransomware in Safe Mode.
"""
id = "94d35931-5c48-49ed-8c18-d601c4f8aeaa"
license = "Elastic License v2"
name = "Registry Run Key Prefixed with Asterisk"
os_list = ["windows"]
reference = [
    "https://docs.microsoft.com/en-us/windows/win32/setupapi/run-and-runonce-registry-keys",
    "https://thedfirreport.com/2021/03/29/sodinokibi-aka-revil-ransomware/",
]
version = "1.0.36"

query = '''
registry where registry.data.strings != null and
    user.id : ("S-1-5-21*", "S-1-12-*") and
    registry.path : (
      "*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
      "*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
      "*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\*",
      "*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
      "*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
      "*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
      "*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*"
    ) and
  startswith(registry.value, "*") and
  /* Issue #318 */
  not (process.name : "Lmi_*.exe" and registry.value : "*LogMeInRescue*") and
  not (process.name : "G2AC_LauncherCustomer.exe" and registry.value : "*GoToAssist*") and
  not (process.name : "G2AC_SessionControl.exe" and registry.value : "*GoToAssist") and
  not (process.code_signature.subject_name == "GoTo Technologies USA, LLC" and process.code_signature.trusted == true) and
  not process.executable :
           ("?:\\Windows\\System32\\mmc.exe",
            "?:\\WINDOWS\\system32\\rstrui.exe",
            "?:\\Program Files (x86)\\*.exe",
            "?:\\WINDOWS\\System32\\dllhost.exe",
            "?:\\Windows\\System32\\msiexec.exe",
            "?:\\Program Files\\*.exe")
'''

min_endpoint_version = "8.0.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[[threat.technique.subtechnique]]
id = "T1547.001"
name = "Registry Run Keys / Startup Folder"
reference = "https://attack.mitre.org/techniques/T1547/001/"



[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

[internal]
min_endpoint_version = "8.0.0"

Stages and Predicates

Stage 1: registry

registry where registry.data.strings != null and
    user.id : ("S-1-5-21*", "S-1-12-*") and
    registry.path : (
      "*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
      "*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
      "*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\*",
      "*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
      "*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
      "*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
      "*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*"
    ) and
  startswith(registry.value, "*") and
  not (process.name : "Lmi_*.exe" and registry.value : "*LogMeInRescue*") and
  not (process.name : "G2AC_LauncherCustomer.exe" and registry.value : "*GoToAssist*") and
  not (process.name : "G2AC_SessionControl.exe" and registry.value : "*GoToAssist") and
  not (process.code_signature.subject_name == "GoTo Technologies USA, LLC" and process.code_signature.trusted == true) and
  not process.executable :
           ("?:\\Windows\\System32\\mmc.exe",
            "?:\\WINDOWS\\system32\\rstrui.exe",
            "?:\\Program Files (x86)\\*.exe",
            "?:\\WINDOWS\\System32\\dllhost.exe",
            "?:\\Windows\\System32\\msiexec.exe",
            "?:\\Program Files\\*.exe")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_nameeqGoTo Technologies USA, LLCexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"GoTo Technologies USA, LLC"
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.nameeqG2AC_LauncherCustomer.exeexcludes:process.name field:"process.name" value:"G2AC_LauncherCustomer.exe"
registry.valuematchGoToAssistexcludes:registry.value field:"registry.value" value:"GoToAssist"
process.nameeqG2AC_SessionControl.exeexcludes:process.name field:"process.name" value:"G2AC_SessionControl.exe"
registry.valueends_withGoToAssistexcludes:registry.value field:"registry.value" value:"GoToAssist"
process.namewildcardLmi_*.exeexcludes:process.name field:"process.name" value:"Lmi_*.exe"
registry.valuematchLogMeInRescueexcludes:registry.value field:"registry.value" value:"LogMeInRescue"
process.executablewildcard?:\Windows\System32\mmc.exe, ?:\WINDOWS\system32\rstrui.exe, ?:\Program Files (x86)\*.exe, ?:\WINDOWS\System32\dllhost.exe, ?:\Windows\System32\msiexec.exe, ?:\Program Files\*.exeexcludes:process.executable

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
registry.data.stringsis_not_null
  • (no value, null check)
field:"Details" kind:is_not_null
registry.pathwildcard
  • *\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run\* corpus 3 (elastic 3)
  • *\Software\Microsoft\Windows\CurrentVersion\RunOnceEx\* corpus 2 (elastic 2)
  • *\Software\Microsoft\Windows\CurrentVersion\RunOnce\* corpus 2 (elastic 2)
  • *\Software\Microsoft\Windows\CurrentVersion\Run\* corpus 3 (elastic 3)
  • *\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run\* corpus 3 (elastic 3)
  • *\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\RunOnce\* corpus 2 (elastic 2)
  • *\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run\* corpus 3 (elastic 3)
field:"TargetObject" kind:wildcard
registry.valuestarts_with
  • *
field:"registry_value_name" kind:starts_with value:"*"
user.idwildcard
  • S-1-12-* corpus 46 (elastic 46)
  • S-1-5-21* corpus 47 (elastic 47)
field:"user.id" kind:wildcard