Detection rules › Elastic

Suspicious String Value Written to Registry Run Key

Source
github.com/elastic/protections-artifacts

Identifies when suspicious values are written to Run and RunOnce registry keys via signed binaries. Run and RunOnce registry keys cause programs to run each time that a user logs on and are often abused by adversaries to maintain persistence on an endpoint.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies when suspicious values are written to Run and RunOnce registry keys via signed binaries. Run and RunOnce
registry keys cause programs to run each time that a user logs on and are often abused by adversaries to maintain
persistence on an endpoint.
"""
id = "727db78e-e1dd-4bc0-89b0-885cd99e069e"
license = "Elastic License v2"
name = "Suspicious String Value Written to Registry Run Key"
os_list = ["windows"]
reference = ["https://docs.microsoft.com/en-us/windows/win32/setupapi/run-and-runonce-registry-keys"]
version = "1.0.43"

query = '''
registry where registry.data.strings != null and process.executable != null and
  user.id : ("S-1-5-21*", "S-1-12-*") and
  registry.path : (
      "H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
      "H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
      "H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
      "H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*") and
  not process.executable :
       ("?:\\Windows\\SysWOW64\\msiexec.exe",
	    "?:\\Windows\\system32\\msiexec.exe",
	    "C:\\Windows\\Installer\\MSI*.tmp",
	    "?:\\Windows\\SysWOW64\\Macromed\\Flash\\*.exe",
	    "?:\\Windows\\Downloaded Program Files\\*.exe",
	    "?:\\Windows\\system32\\spool\\DRIVERS\\*",
	    "?:\\Windows\\system32\\mmc.exe",
	    "?:\\Windows\\Samsung\\PanelMgr\\SSMMgr.exe",
	    "?:\\Windows\\System32\\wsl.exe",
	    "?:\\Windows\\SysWOW64\\d3con.exe",
	    "?:\\Windows\\System32\\StikyNot.exe",
	    "?:\\WINDOWS\\splwow64.exe",
	    "?:\\Program Files\\*.exe",
	    "?:\\Program Files (x86)\\*.exe",
	    "?:\\Windows\\SysWOW64\\Macromed\\Flash\\FlashUtil*_Plugin.exe",
	    "?:\\Windows\\System32\\wiawow64.exe",
	    "?:\\Windows\\SysWOW64\\NSIS.Library.RegTool.v3.{BF6A0CE1-774D-43F4-BC30-45E57E406CE1}.exe",
	    "?:\\Windows\\System32\\svchost.exe",
	    "\\Device\\Mup\\*.exe") and
  not (process.name : "cscript.exe" and registry.value : "ContingencyUninstallNXTSForCurrentUser") and
  not (process.name : "ZoomInfoContactContributor*.exe" and registry.value : "ZoomInfo Contact Contributor") and
  not (process.name : "rundll32.exe" and registry.value : ("bit4id csp store register*", "SafeDiveCertMgm")) and
  not (process.name : ("bomgar-scc.exe", "ThinkGear Connector.exe") and registry.value : ("Bomgar_Cleanup_*", "ThinkGear Connector")) and
  registry.data.strings :
            ("*rundll32*",
             "*regsvr32*",
             "*mshta*",
             "*msbuild*",
             "*RegAsm*",
             "*RegSvcs*",
             "*InstallUtil*",
             "*cscript*",
             "*wscript*",
             "*.js?",
             "*.js",
             "*.vbs?",
             "*.vbs",
             "*.vbe?",
             "*.vbe",
             "*.bat?",
             "*.bat",
             "*.url",
             "*.url?",
             "*.lnk",
             "*.lnk?",
             "*.jar",
             "*msxsl*",
             "*cmstp*",
             "*cerutil*",
             "*bitsadmin*",
             "*msiexec*",
             "*wmic*",
             "*powershell*",
             "*cmd.exe *",
             "*cmd * /c*",
             "*svchost*",
             "*lsass*",
             "*csrss*",
             "*winlogon*",
             "*Microsoft.Workflow.Compiler.exe*",
             "*VBScript.Encode*",
             "*http://*",
             "*WScript.Shell*",
             "*VBScript.Encode*",
             "*:\\Users\\Public\\*",
             "*:\\Users\\*\\Documents\\*",
             "*:\\Documents and Settings\\*",
             "*:\\Users\\*\\Pictures\\*",
             "*:\\Users\\*\\Music\\*",
             "*:\\Users\\*\\Pictures\\*",
			 "?:\\Users\\*\\Downloads\\*",
             "?:\\Users\\*\\Desktop\\*",
             "*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*",
             "\\\\*.exe",
             "*javaw.exe* -jar *") and not
    registry.data.strings :
                   ("*rundll32.exe*advpack.dll,DelNodeRunDLL32*",
                    "*LogiLDA.dll,LogiFetch*",
                    "*\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\*",
                    "*%ProgramFiles%*",
                    "*:\\Program Files\\*",
                    "*:\\Program Files (x86)\\*",
                    "*:\\Windows\\SystemApps\\*",
                    "*:\\Windows\\System32\\DriverStore\\*",
                    "*:\\WINDOWS\\Speech\\*",
                    "*:\\WINDOWS\\System32\\RtkAudUService*",
                    "*:\\WINDOWS\\system32\\SecurityHealthSystray.exe",
                    "*restartSAPinst.vbs*",
                    /* Issue #324 */
                    "*\\Windows\\Downloaded Program Files\\*",
                    "*\\Windows\\SysWOW64\\Macromed\\*",
                    "*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\*.lnk*",
                    "*\\Pictures\\*com_Internet_Download_Manager*",
                    "cmd.exe /c \"start /min /d \"C:\\Users\\*\\AppData\\Local\\PDFProSuite\" PDFProSuite . --update\"",
                    "Powershell.exe -NoProfile -ExecutionPolicy ByPass -WindowStyle Hidden -file C:\\*\\RunOnce\\Logon.ps1",
                    "powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File",
                    "\"\\\\*Desktop.lnk\"") and

    not (process.code_signature.subject_name :
          ("Solanki Piyushkumar", "Sysinternals", "NortonLifeLock Inc.", "Bomgar Corporation", "BIT4ID SRL",
           "JACK HENRY & ASSOCIATES, INC.", "Connectify (Connectify, Inc.)", "Slack Technologies, LLC",
           "Symantec Corporation", "Loom, Inc.", "NinjaOne LLC", "BeyondTrust Corporation", "Quest Software, Inc.", 
		   "PHAM KIM LONG") and
           process.code_signature.trusted == true) and

    not (registry.value : "com.squirrel.Teams.Teams" and
        registry.data.strings : "?:\\Users\\*\\AppData\\Local\\Microsoft\\Teams\\Update.exe --processStart \"Teams.exe\" --process-start-args \"--system-initiated\"")
'''

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

[[optional_actions]]
action = "rollback"
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 process.executable != null and
  user.id : ("S-1-5-21*", "S-1-12-*") and
  registry.path : (
      "H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
      "H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
      "H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
      "H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*") and
  not process.executable :
       ("?:\\Windows\\SysWOW64\\msiexec.exe",
	    "?:\\Windows\\system32\\msiexec.exe",
	    "C:\\Windows\\Installer\\MSI*.tmp",
	    "?:\\Windows\\SysWOW64\\Macromed\\Flash\\*.exe",
	    "?:\\Windows\\Downloaded Program Files\\*.exe",
	    "?:\\Windows\\system32\\spool\\DRIVERS\\*",
	    "?:\\Windows\\system32\\mmc.exe",
	    "?:\\Windows\\Samsung\\PanelMgr\\SSMMgr.exe",
	    "?:\\Windows\\System32\\wsl.exe",
	    "?:\\Windows\\SysWOW64\\d3con.exe",
	    "?:\\Windows\\System32\\StikyNot.exe",
	    "?:\\WINDOWS\\splwow64.exe",
	    "?:\\Program Files\\*.exe",
	    "?:\\Program Files (x86)\\*.exe",
	    "?:\\Windows\\SysWOW64\\Macromed\\Flash\\FlashUtil*_Plugin.exe",
	    "?:\\Windows\\System32\\wiawow64.exe",
	    "?:\\Windows\\SysWOW64\\NSIS.Library.RegTool.v3.{BF6A0CE1-774D-43F4-BC30-45E57E406CE1}.exe",
	    "?:\\Windows\\System32\\svchost.exe",
	    "\\Device\\Mup\\*.exe") and
  not (process.name : "cscript.exe" and registry.value : "ContingencyUninstallNXTSForCurrentUser") and
  not (process.name : "ZoomInfoContactContributor*.exe" and registry.value : "ZoomInfo Contact Contributor") and
  not (process.name : "rundll32.exe" and registry.value : ("bit4id csp store register*", "SafeDiveCertMgm")) and
  not (process.name : ("bomgar-scc.exe", "ThinkGear Connector.exe") and registry.value : ("Bomgar_Cleanup_*", "ThinkGear Connector")) and
  registry.data.strings :
            ("*rundll32*",
             "*regsvr32*",
             "*mshta*",
             "*msbuild*",
             "*RegAsm*",
             "*RegSvcs*",
             "*InstallUtil*",
             "*cscript*",
             "*wscript*",
             "*.js?",
             "*.js",
             "*.vbs?",
             "*.vbs",
             "*.vbe?",
             "*.vbe",
             "*.bat?",
             "*.bat",
             "*.url",
             "*.url?",
             "*.lnk",
             "*.lnk?",
             "*.jar",
             "*msxsl*",
             "*cmstp*",
             "*cerutil*",
             "*bitsadmin*",
             "*msiexec*",
             "*wmic*",
             "*powershell*",
             "*cmd.exe *",
             "*cmd * /c*",
             "*svchost*",
             "*lsass*",
             "*csrss*",
             "*winlogon*",
             "*Microsoft.Workflow.Compiler.exe*",
             "*VBScript.Encode*",
             "*http://*",
             "*WScript.Shell*",
             "*VBScript.Encode*",
             "*:\\Users\\Public\\*",
             "*:\\Users\\*\\Documents\\*",
             "*:\\Documents and Settings\\*",
             "*:\\Users\\*\\Pictures\\*",
             "*:\\Users\\*\\Music\\*",
             "*:\\Users\\*\\Pictures\\*",
			 "?:\\Users\\*\\Downloads\\*",
             "?:\\Users\\*\\Desktop\\*",
             "*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*",
             "\\\\*.exe",
             "*javaw.exe* -jar *") and not
    registry.data.strings :
                   ("*rundll32.exe*advpack.dll,DelNodeRunDLL32*",
                    "*LogiLDA.dll,LogiFetch*",
                    "*\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\*",
                    "*%ProgramFiles%*",
                    "*:\\Program Files\\*",
                    "*:\\Program Files (x86)\\*",
                    "*:\\Windows\\SystemApps\\*",
                    "*:\\Windows\\System32\\DriverStore\\*",
                    "*:\\WINDOWS\\Speech\\*",
                    "*:\\WINDOWS\\System32\\RtkAudUService*",
                    "*:\\WINDOWS\\system32\\SecurityHealthSystray.exe",
                    "*restartSAPinst.vbs*",
                    "*\\Windows\\Downloaded Program Files\\*",
                    "*\\Windows\\SysWOW64\\Macromed\\*",
                    "*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\*.lnk*",
                    "*\\Pictures\\*com_Internet_Download_Manager*",
                    "cmd.exe /c \"start /min /d \"C:\\Users\\*\\AppData\\Local\\PDFProSuite\" PDFProSuite . --update\"",
                    "Powershell.exe -NoProfile -ExecutionPolicy ByPass -WindowStyle Hidden -file C:\\*\\RunOnce\\Logon.ps1",
                    "powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File",
                    "\"\\\\*Desktop.lnk\"") and
    not (process.code_signature.subject_name :
          ("Solanki Piyushkumar", "Sysinternals", "NortonLifeLock Inc.", "Bomgar Corporation", "BIT4ID SRL",
           "JACK HENRY & ASSOCIATES, INC.", "Connectify (Connectify, Inc.)", "Slack Technologies, LLC",
           "Symantec Corporation", "Loom, Inc.", "NinjaOne LLC", "BeyondTrust Corporation", "Quest Software, Inc.",
		   "PHAM KIM LONG") and
           process.code_signature.trusted == true) and
    not (registry.value : "com.squirrel.Teams.Teams" and
        registry.data.strings : "?:\\Users\\*\\AppData\\Local\\Microsoft\\Teams\\Update.exe --processStart \"Teams.exe\" --process-start-args \"--system-initiated\"")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_nameeqSolanki Piyushkumar, Sysinternals, NortonLifeLock Inc., Bomgar Corporation, BIT4ID SRL, JACK HENRY & ASSOCIATES, INC., Connectify (Connectify, Inc.), Slack Technologies, LLC, Symantec Corporation, Loom, Inc., NinjaOne LLC, BeyondTrust Corporation, Quest Software, Inc., PHAM KIM LONGexcludes:process.code_signature.subject_name
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.nameeqbomgar-scc.exe, ThinkGear Connector.exeexcludes:process.name field:"process.name" value:"bomgar-scc.exe" field:"process.name" value:"ThinkGear Connector.exe"
registry.valuewildcardBomgar_Cleanup_*, ThinkGear Connectorexcludes:registry.value field:"registry.value" value:"Bomgar_Cleanup_*" field:"registry.value" value:"ThinkGear Connector"
process.nameeqcscript.exeexcludes:process.name field:"process.name" value:"cscript.exe"
registry.valueeqContingencyUninstallNXTSForCurrentUserexcludes:registry.value field:"registry.value" value:"ContingencyUninstallNXTSForCurrentUser"
process.nameeqrundll32.exeexcludes:process.name field:"process.name" value:"rundll32.exe"
registry.valuewildcardbit4id csp store register*, SafeDiveCertMgmexcludes:registry.value field:"registry.value" value:"bit4id csp store register*" field:"registry.value" value:"SafeDiveCertMgm"
process.namewildcardZoomInfoContactContributor*.exeexcludes:process.name field:"process.name" value:"ZoomInfoContactContributor*.exe"
registry.valueeqZoomInfo Contact Contributorexcludes:registry.value field:"registry.value" value:"ZoomInfo Contact Contributor"
registry.data.stringswildcard?:\Users\*\AppData\Local\Microsoft\Teams\Update.exe --processStart "Teams.exe" --process-start-args "--system-initiated"excludes:registry.data.strings
registry.valueeqcom.squirrel.Teams.Teamsexcludes:registry.value field:"registry.value" value:"com.squirrel.Teams.Teams"
process.executablewildcard?:\Windows\SysWOW64\msiexec.exe, ?:\Windows\system32\msiexec.exe, C:\Windows\Installer\MSI*.tmp, ?:\Windows\SysWOW64\Macromed\Flash\*.exe, ?:\Windows\Downloaded Program Files\*.exe, ?:\Windows\system32\spool\DRIVERS\*, ?:\Windows\system32\mmc.exe, ?:\Windows\Samsung\PanelMgr\SSMMgr.exe, ?:\Windows\System32\wsl.exe, ?:\Windows\SysWOW64\d3con.exe, ?:\Windows\System32\StikyNot.exe, ?:\WINDOWS\splwow64.exe, ?:\Program Files\*.exe, ?:\Program Files (x86)\*.exe, ?:\Windows\SysWOW64\Macromed\Flash\FlashUtil*_Plugin.exe, ?:\Windows\System32\wiawow64.exe, ?:\Windows\SysWOW64\NSIS.Library.RegTool.v3.{BF6A0CE1-774D-43F4-BC30-45E57E406CE1}.exe, ?:\Windows\System32\svchost.exe, \Device\Mup\*.exeexcludes:process.executable
registry.data.stringswildcard*rundll32.exe*advpack.dll,DelNodeRunDLL32*, *LogiLDA.dll,LogiFetch*, *\Users\*\AppData\Local\Microsoft\OneDrive\*, *%ProgramFiles%*, *:\Program Files\*, *:\Program Files (x86)\*, *:\Windows\SystemApps\*, *:\Windows\System32\DriverStore\*, *:\WINDOWS\Speech\*, *:\WINDOWS\System32\RtkAudUService*, *:\WINDOWS\system32\SecurityHealthSystray.exe, *restartSAPinst.vbs*, *\Windows\Downloaded Program Files\*, *\Windows\SysWOW64\Macromed\*, *\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\*.lnk*, *\Pictures\*com_Internet_Download_Manager*, cmd.exe /c "start /min /d "C:\Users\*\AppData\Local\PDFProSuite" PDFProSuite . --update", Powershell.exe -NoProfile -ExecutionPolicy ByPass -WindowStyle Hidden -file C:\*\RunOnce\Logon.ps1, powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File, "\\*Desktop.lnk"excludes:registry.data.strings

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
process.executableis_not_null
  • (no value, null check)
field:"Image" kind:is_not_null
registry.data.stringsis_not_null
  • (no value, null check)
field:"Details" kind:is_not_null
registry.data.stringswildcard
  • *.bat
  • *.bat?
  • *.jar
  • *.js
  • *.js?
  • *.lnk
  • *.lnk?
  • *.url
  • *.url?
  • *.vbe
  • *.vbe?
  • *.vbs
  • *.vbs?
  • *:\Documents and Settings\*
  • *:\Users\*\Documents\*
  • *:\Users\*\Music\*
  • *:\Users\*\Pictures\*
  • *:\Users\Public\* corpus 4 (sigma 4)
  • *InstallUtil*
  • *Microsoft.Workflow.Compiler.exe*
  • *RegAsm*
  • *RegSvcs*
  • *VBScript.Encode*
  • *WScript.Shell*
  • *\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\*
  • *bitsadmin* corpus 2 (sigma 2)
  • *cerutil*
  • *cmd * /c*
  • *cmd.exe *
  • *cmstp*
  • *cscript* corpus 4 (sigma 4)
  • *csrss*
  • *http://*
  • *javaw.exe* -jar *
  • *lsass*
  • *msbuild*
  • *mshta* corpus 5 (sigma 4, splunk 1)
  • *msiexec*
  • *msxsl*
  • *powershell* corpus 11 (sigma 9, elastic 1, chronicle 1)
  • *regsvr32* corpus 3 (sigma 3)
  • *rundll32* corpus 4 (sigma 4)
  • *svchost*
  • *winlogon*
  • *wmic*
  • *wscript* corpus 4 (sigma 4)
  • ?:\Users\*\Desktop\*
  • ?:\Users\*\Downloads\*
  • \\*.exe
field:"Details" kind:wildcard
registry.pathwildcard
  • H*\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run\* corpus 11 (elastic 11)
  • H*\Software\Microsoft\Windows\CurrentVersion\Run\* corpus 12 (elastic 12)
  • H*\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run\* corpus 11 (elastic 11)
  • H*\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run\* corpus 11 (elastic 11)
field:"TargetObject" kind:wildcard
user.idwildcard
  • S-1-12-* corpus 46 (elastic 46)
  • S-1-5-21* corpus 47 (elastic 47)
field:"user.id" kind:wildcard