Windows reg.exe Run Key Modification for Persistence via Process Creation

Alerts on reg.exe commands that add values to Windows Run registry keys, a common persistence technique.

FreeUnreviewedSigmamediumv1
title: Windows reg.exe Run Key Modification for Persistence via Process Creation
id: b9829bcf-ba5d-4e8e-aa03-e3a43f7d508b
status: test
description: This rule flags process executions of reg.exe where the command line includes adding a registry value under common Run key locations. Attackers use Run keys to establish persistence by launching malware or unwanted software at user logon. It relies on Windows process creation telemetry, matching reg.exe usage and specific Registry paths in the command line.
references:
  - https://app.any.run/tasks/9c0f37bc-867a-4314-b685-e101566766d7/
  - https://learn.microsoft.com/en-us/windows/win32/setupapi/run-and-runonce-registry-keys
  - https://github.com/HackTricks-wiki/hacktricks/blob/e4c7b21b8f36c97c35b7c622732b38a189ce18f7/src/windows-hardening/windows-local-privilege-escalation/privilege-escalation-with-autorun-binaries.md
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_reg_add_run_key.yml
author: Florian Roth (Nextron Systems), Swachchhanda Shrawan Poudel (Nextron Systems), Huntrule Team
date: 2021-06-28
modified: 2025-02-17
tags:
  - attack.privilege-escalation
  - attack.persistence
  - attack.t1547.001
logsource:
  category: process_creation
  product: windows
detection:
  selection:
    Image|endswith: \reg.exe
    CommandLine|contains|all:
      - reg
      - " add "
    CommandLine|contains:
      - Software\Microsoft\Windows\CurrentVersion\Run
      - \Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run
      - \Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run
  condition: selection
falsepositives:
  - Legitimate software automatically (mostly, during installation) sets up autorun keys for legitimate reasons.
  - Legitimate administrator sets up autorun keys for legitimate reasons.
  - Discord
level: medium
regression_tests_path: regression_data/rules/windows/process_creation/proc_creation_win_reg_add_run_key/info.yml
license: DRL-1.1
related:
  - id: de587dce-915e-4218-aac4-835ca6af6f70
    type: derived

What it detects

This rule flags process executions of reg.exe where the command line includes adding a registry value under common Run key locations. Attackers use Run keys to establish persistence by launching malware or unwanted software at user logon. It relies on Windows process creation telemetry, matching reg.exe usage and specific Registry paths in the command line.

Known false positives

  • Legitimate software automatically (mostly, during installation) sets up autorun keys for legitimate reasons.
  • Legitimate administrator sets up autorun keys for legitimate reasons.
  • Discord

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.