T1547.001 Microsoft Sentinel · KQL

Detect Registry Run Keys / Startup Folder in Microsoft Sentinel

Adversaries may achieve persistence by adding a program to a startup folder or referencing it with a Registry run key. Adding an entry to the 'run keys' in the Registry or startup folder will cause the program referenced to be executed when a user logs in. These programs will be executed under the context of the user and will have the account's associated permissions level. The following run keys are created by default on Windows systems: HKCU\Software\Microsoft\Windows\CurrentVersion\Run, HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce, HKLM\Software\Microsoft\Windows\CurrentVersion\Run, and HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce. Additional persistence can be achieved through the Startup folder at C:\Users\[Username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup and the system-wide C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp. The BootExecute value under Session Manager and the load value under HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows are also abusable.

MITRE ATT&CK

Tactic
Persistence Privilege Escalation
Technique
T1547 Boot or Logon Autostart Execution
Sub-technique
T1547.001 Registry Run Keys / Startup Folder
Canonical reference
https://attack.mitre.org/techniques/T1547/001/

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
let RunKeyPaths = dynamic([
  "\\CurrentVersion\\Run",
  "\\CurrentVersion\\RunOnce",
  "\\CurrentVersion\\RunOnceEx",
  "\\CurrentVersion\\RunServices",
  "\\CurrentVersion\\RunServicesOnce",
  "\\CurrentVersion\\Policies\\Explorer\\Run",
  "\\Windows NT\\CurrentVersion\\Windows",
  "\\Control\\Session Manager"
]);
let TrustedProcesses = dynamic(["msiexec.exe", "TrustedInstaller.exe", "TiWorker.exe", "ccmexec.exe", "MpSigStub.exe"]);
DeviceRegistryEvents
| where Timestamp > ago(24h)
| where ActionType in ("RegistryValueSet", "RegistryKeyCreated")
| where RegistryKey has_any (RunKeyPaths)
| where InitiatingProcessFileName !in~ (TrustedProcesses)
| extend SuspiciousPath = RegistryValueData has_any ("\\Temp\\", "\\AppData\\Local\\Temp", "\\Downloads\\", "\\Public\\", "$Recycle.Bin", "\\ProgramData\\")
| extend SuspiciousExt = RegistryValueData has_any (".vbs", ".js", ".bat", ".cmd", ".ps1", ".hta", ".wsh", ".wsf")
| project Timestamp, DeviceName, ActionType, RegistryKey, RegistryValueName, RegistryValueData,
         InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountName,
         SuspiciousPath, SuspiciousExt
| sort by Timestamp desc
high severity high confidence

Detects modifications to Windows Registry Run/RunOnce keys and related autostart locations using MDE DeviceRegistryEvents. Filters out known trusted installer processes and flags entries pointing to suspicious paths (temp, downloads, recycle bin) or script file types (.vbs, .js, .bat, .ps1). Covers HKLM and HKCU Run, RunOnce, RunOnceEx, RunServices, Policies\Explorer\Run, Session Manager BootExecute, and the HKCU\Windows load value.

Data Sources

Windows Registry: Windows Registry Key ModificationWindows Registry: Windows Registry Key CreationMicrosoft Defender for Endpoint

Required Tables

DeviceRegistryEvents

False Positives & Tuning

  • Legitimate software installations that add Run key entries (antivirus, VPN clients, cloud sync tools like OneDrive, Dropbox)
  • Enterprise deployment tools (SCCM, Intune, PDQ Deploy) adding startup entries for managed software
  • User-installed utilities that register themselves for auto-start (Discord, Spotify, Steam)
  • IT automation scripts that configure startup programs as part of endpoint provisioning
Download portable Sigma rule (.yml)

Other platforms for T1547.001


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Registry Run Key Persistence (HKCU)

    Expected signal: Sysmon Event ID 13: RegistryValueSet on HKCU\Software\Microsoft\Windows\CurrentVersion\Run with ValueName 'df00tech-test' and Details 'C:\Windows\System32\calc.exe'. MDE DeviceRegistryEvents with ActionType 'RegistryValueSet'.

  2. Test 2Startup Folder Persistence via Batch Script

    Expected signal: Sysmon Event ID 11: FileCreate for df00tech-test.bat in the Startup folder path. Security Event ID 4688 showing cmd.exe creating the file.

  3. Test 3RunOnceEx Dependency DLL Loading

    Expected signal: Sysmon Event ID 12: Registry key created for RunOnceEx\0001\Depend. Sysmon Event ID 13: Value set with DLL path. MDE DeviceRegistryEvents captures both the key creation and value set.

  4. Test 4HKLM Run Key via PowerShell

    Expected signal: Sysmon Event ID 13: RegistryValueSet with Image=powershell.exe. Sysmon Event ID 1: Process creation for powershell.exe with the Set-ItemProperty command. PowerShell ScriptBlock Log Event ID 4104.

Unlock Pro Content

Get the full detection package for T1547.001 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections