Detection rules › Sigma

Suspicious PowerShell In Registry Run Keys

Status
test
Severity
medium
Log source
product windows, category registry_set
Author
frack113, Florian Roth (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects potential PowerShell commands or code within registry run keys

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 13RegistryEvent (Value Set)

Rule body yaml

title: Suspicious PowerShell In Registry Run Keys
id: 8d85cf08-bf97-4260-ba49-986a2a65129c
status: test
description: Detects potential PowerShell commands or code within registry run keys
references:
    - https://github.com/frack113/atomic-red-team/blob/a9051c38de8a5320b31c7039efcbd3b56cf2d65a/atomics/T1547.001/T1547.001.md#atomic-test-9---systembc-malware-as-a-service-registry
    - https://www.trendmicro.com/en_us/research/22/j/lv-ransomware-exploits-proxyshell-in-attack.html
    - https://github.com/HackTricks-wiki/hacktricks/blob/e4c7b21b8f36c97c35b7c622732b38a189ce18f7/src/windows-hardening/windows-local-privilege-escalation/privilege-escalation-with-autorun-binaries.md
author: frack113, Florian Roth (Nextron Systems)
date: 2022-03-17
modified: 2025-07-18
tags:
    - attack.privilege-escalation
    - attack.persistence
    - attack.t1547.001
logsource:
    category: registry_set
    product: windows
detection:
    selection:
        TargetObject|contains:
            - '\Software\Microsoft\Windows\CurrentVersion\Run' # Also covers "RunOnce" and "RunOnceEx"
            - '\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run'
            - '\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run'
        Details|contains:
            - 'powershell'
            - 'pwsh '
            - 'FromBase64String'
            - '.DownloadFile('
            - '.DownloadString('
            - ' -w hidden '
            - ' -w 1 '
            - '-windowstyle hidden'
            - '-window hidden'
            - ' -nop '
            - ' -encodedcommand '
            - '-ExecutionPolicy Bypass'
            - 'Invoke-Expression'
            - 'IEX ('
            - 'Invoke-Command'
            - 'ICM -'
            - 'Invoke-WebRequest'
            - 'IWR '
            - 'Invoke-RestMethod'
            - 'IRM '
            - ' -noni '
            - ' -noninteractive '
    condition: selection
falsepositives:
    - Legitimate admin or third party scripts. Baseline according to your environment
level: medium

Stages and Predicates

Stage 0: condition

selection

Stage 1: selection

selection:
    TargetObject|contains:
        - '\Software\Microsoft\Windows\CurrentVersion\Run'
        - '\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run'
        - '\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run'
    Details|contains:
        - 'powershell'
        - 'pwsh '
        - 'FromBase64String'
        - '.DownloadFile('
        - '.DownloadString('
        - ' -w hidden '
        - ' -w 1 '
        - '-windowstyle hidden'
        - '-window hidden'
        - ' -nop '
        - ' -encodedcommand '
        - '-ExecutionPolicy Bypass'
        - 'Invoke-Expression'
        - 'IEX ('
        - 'Invoke-Command'
        - 'ICM -'
        - 'Invoke-WebRequest'
        - 'IWR '
        - 'Invoke-RestMethod'
        - 'IRM '
        - ' -noni '
        - ' -noninteractive '

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
Detailsmatch
  • -encodedcommand corpus 2 (sigma 1, chronicle 1)
  • -noni corpus 2 (sigma 1, chronicle 1)
  • -noninteractive corpus 2 (sigma 1, chronicle 1)
  • -nop corpus 2 (sigma 1, chronicle 1)
  • -w 1 corpus 2 (sigma 1, chronicle 1)
  • -w hidden corpus 2 (sigma 1, chronicle 1)
  • -ExecutionPolicy Bypass corpus 2 (sigma 1, chronicle 1)
  • -window hidden corpus 2 (sigma 1, chronicle 1)
  • -windowstyle hidden corpus 2 (sigma 1, chronicle 1)
  • .DownloadFile( corpus 2 (sigma 1, chronicle 1)
  • .DownloadString( corpus 2 (sigma 1, chronicle 1)
  • FromBase64String corpus 2 (sigma 1, chronicle 1)
  • ICM - corpus 2 (sigma 1, chronicle 1)
  • IEX ( corpus 2 (sigma 1, chronicle 1)
  • IRM
  • IWR corpus 2 (sigma 1, chronicle 1)
  • Invoke-Command corpus 2 (sigma 1, chronicle 1)
  • Invoke-Expression corpus 2 (sigma 1, chronicle 1)
  • Invoke-RestMethod
  • Invoke-WebRequest corpus 2 (sigma 1, chronicle 1)
  • powershell corpus 10 (sigma 9, chronicle 1)
  • pwsh corpus 2 (sigma 1, chronicle 1)
TargetObjectmatch
  • \Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run corpus 4 (sigma 3, kusto 1)
  • \Software\Microsoft\Windows\CurrentVersion\Run corpus 4 (sigma 4)
  • \Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run corpus 3 (sigma 3)