RUN KEYS
RUNONCE
STARTUP FOLDER
SYSMON 13
DetectionBlue TeamSOCOctober 12, 2026•9 min read

Detecting Run Key and Startup Folder Persistence

Run keys are the oldest persistence trick on Windows and still one of the most used. They are noisy to write and easy to read, which makes them cheap to detect well.

Scroll

The Run and RunOnce registry keys and the Startup folder execute a payload every time a user logs on, with no elevated rights needed for the per-user hive. Commodity loaders, stealers and hands-on-keyboard operators all use them first because they are reliable and survive reboots. We can detect them from two telemetry sources: registry value sets (Sysmon Event ID 13) and file creation in the Startup directories (Sysmon Event ID 11).

Signals at a Glance

SignalWhereATT&CK
Value set under CurrentVersion\Run or RunOnce (HKCU and HKLM)Sysmon 13, EDR registry eventsT1547.001
Run value pointing at AppData, Temp, ProgramData or Users\PublicSysmon 13 (Details field)T1547.001
Run value launching a script host or LOLBin (powershell, mshta, wscript, rundll32)Sysmon 13, command-line logsT1059
New .lnk, .bat, .vbs, .js or .exe written to a Startup folderSysmon 11, EDR file eventsT1547.001
Writer process is an Office app, script host or reg.exe rather than an installerSysmon 13 (Image field)T1112
Winlogon Shell or Userinit value modifiedSysmon 13T1547.004

Registry Run and RunOnce Keys

Every value written under the Run family of keys is a command that will execute at logon. Legitimate installers write them constantly, so the useful question is not whether a Run value was set but what it points to and who wrote it. This Sigma rule keys on the location of the payload and filters common installer writers; extend the filter list from your own baseline.

title: Run Key Set With Suspicious Value Data
logsource:
  product: windows
  category: registry_set
detection:
  selection_key:
    TargetObject|contains:
      - '\Software\Microsoft\Windows\CurrentVersion\Run\'
      - '\Software\Microsoft\Windows\CurrentVersion\RunOnce\'
      - '\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run\'
  selection_data:
    Details|contains:
      - '\AppData\'
      - '\Temp\'
      - '\ProgramData\'
      - '\Users\Public\'
      - 'powershell'
      - 'mshta'
      - 'wscript'
      - 'cscript'
      - 'rundll32'
      - 'cmd /c'
  filter_installers:
    Image|endswith:
      - '\msiexec.exe'
      - '\setup.exe'
  condition: selection_key and selection_data and not filter_installers
level: medium
# tune/validate: per-user apps (Teams, OneDrive, Zoom) legitimately register Run values in AppData.

If you run Microsoft Defender for Endpoint, the same logic works in Advanced Hunting against the registry table, and it lets you pivot straight to the initiating process:

// KQL: Run/RunOnce values that launch from user-writable paths or script hosts
DeviceRegistryEvents
| where ActionType == "RegistryValueSet"
| where RegistryKey has_any (@"\CurrentVersion\Run", @"\CurrentVersion\RunOnce")
| where RegistryValueData matches regex @"(?i)(\\AppData\\|\\Temp\\|\\ProgramData\\|\\Users\\Public\\|powershell|mshta|wscript|cscript|rundll32)"
| where InitiatingProcessFileName !in~ ("msiexec.exe", "OneDriveSetup.exe")
| project Timestamp, DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine,
          RegistryKey, RegistryValueName, RegistryValueData
| order by Timestamp desc
// tune/validate: add your software-deployment tooling to the exclusion list.

Startup Folder and Neighbouring Keys

The per-user and all-users Startup folders are the file-based twin of the Run key. A shortcut or script dropped there runs at logon without touching the registry, so a Run-key-only detection misses it. Watch file creation in both paths:

title: File Created In Startup Folder
logsource:
  product: windows
  category: file_event
detection:
  selection:
    TargetFilename|contains:
      - '\Microsoft\Windows\Start Menu\Programs\Startup\'
    TargetFilename|endswith:
      - '.lnk'
      - '.bat'
      - '.cmd'
      - '.vbs'
      - '.js'
      - '.exe'
      - '.ps1'
  condition: selection
level: medium
# tune/validate: expect legitimate .lnk drops from installers and VDI profile tooling.
Vetted sources

Start from the SigmaHQ registry_set and file_event persistence rules, Elastic’s registry-run-key detections, Splunk ESCU registry content, MITRE CAR analytics and Atomic Red Team tests for T1547.001 to validate that your telemetry fires. Use Sysinternals Autoruns or osquery for inventory, and baseline your own environment before alerting, since legitimate software writes Run keys all the time.

Build Detections That Fire

Mjolnir Security helps blue teams turn threat intelligence into high-fidelity detections across endpoint, network, identity and cloud telemetry.

Detection EngineeringManaged Detection & ResponseThreat HuntingIncident ResponsePurple Teaming
  • Detection Engineering We build and tune detections mapped to ATT&CK from your own telemetry.
  • Threat Hunting as a Service Hypothesis-driven hunts for the behaviours on this page.
  • 24/7 Incident Response Containment when a detection fires. Call +1 833 403 5875.
Written by: Mjolnir Threat Research (MTAC)  |  Published: October 12, 2026  |  Last reviewed: October 12, 2026