← Back to SOC feed Coverage →

suspicious-command-interpreters-added-to-registry

kql MEDIUM Azure-Sentinel
T1112
DeviceRegistryEvents
huntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-05-08T23:00:01Z · Confidence: medium

Hunt Hypothesis

Adversaries may add suspicious command interpreters to the Windows registry to execute arbitrary code or maintain persistence. SOC teams should proactively hunt for this behavior in Azure Sentinel to detect potential command and control (C2) activity or persistence mechanisms early.

KQL Query

DeviceRegistryEvents
// Filter out events initiated by OneDriveSetup.exe to reduce noise
| where InitiatingProcessVersionInfoInternalFileName != @"OneDriveSetup.exe"
// Look at events from the last 30 days
| where Timestamp > ago(30d)
// Consider only key set and key created actions
| where ActionType has_any ('RegistryValueSet','RegistryKeyCreated')
// Search for registry values containing 'powershell' or 'cmd'
| where RegistryValueData has_any('powershell','cmd')
// Project relevant fields for analysis
| project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessParentFileName

Analytic Rule Definition

id: 74dd8aa9-996b-44b1-bf36-9ac9ef6d2c02
name: suspicious-command-interpreters-added-to-registry
description: |
  Looks for suspicious addition of command interpreters to windows registry.
  Author: Jouni Mikkola
  References:
  https://threathunt.blog/registry-hunts/
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - DeviceRegistryEvents
tactics:
- Defense evasion
relevantTechniques:
  - T1112
query: |
  DeviceRegistryEvents
  // Filter out events initiated by OneDriveSetup.exe to reduce noise
  | where InitiatingProcessVersionInfoInternalFileName != @"OneDriveSetup.exe"
  // Look at events from the last 30 days
  | where Timestamp > ago(30d)
  // Consider only key set and key created actions
  | where ActionType has_any ('RegistryValueSet','RegistryKeyCreated')
  // Search for registry values containing 'powershell' or 'cmd'
  | where RegistryValueData has_any('powershell','cmd')
  // Project relevant fields for analysis
  | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessAccountName, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessParentFileName

Required Data Sources

Sentinel TableNotes
DeviceRegistryEventsEnsure this data connector is enabled

MITRE ATT&CK Context

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Defense evasion/suspicious-command-interpreters-added-to-registry.yaml