T1546.001 Microsoft Sentinel · KQL

Detect Change Default File Association in Microsoft Sentinel

Adversaries may establish persistence by changing the default file association for a file extension. When a file is opened, the default program associated with the file extension is executed. Adversaries can exploit this by modifying the registry key that defines the default handler for a given file extension (e.g., .txt, .js, .hta) to point to a malicious executable, causing their payload to execute whenever a user opens a file with that extension.

MITRE ATT&CK

Tactic
Privilege Escalation Persistence
Technique
T1546 Event Triggered Execution
Sub-technique
T1546.001 Change Default File Association
Canonical reference
https://attack.mitre.org/techniques/T1546/001/

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
DeviceRegistryEvents
| where Timestamp > ago(24h)
| where RegistryKey has_any (
    "SOFTWARE\\Classes\\",
    "HKEY_CLASSES_ROOT\\"
  )
| where RegistryKey matches regex @"\\shell\\open\\command"
| where ActionType in ("RegistryValueSet", "RegistryKeyCreated")
| where RegistryValueData !has_any (
    "C:\\Windows\\system32\\",
    "C:\\Program Files\\",
    "C:\\Program Files (x86)\\"
  )
| extend Extension = extract(@"Classes\\(\.\w+)\\", 1, RegistryKey)
| extend SuspiciousHandler = RegistryValueData has_any (
    "powershell", "cmd.exe", "wscript", "cscript", "mshta",
    "rundll32", "regsvr32", "certutil", "bitsadmin", "AppData", "Temp", "ProgramData"
  )
| project Timestamp, DeviceName, AccountName, ActionType, RegistryKey,
         RegistryValueName, RegistryValueData, Extension, SuspiciousHandler,
         InitiatingProcessFileName, InitiatingProcessCommandLine
| sort by Timestamp desc
medium severity medium confidence

Detects modifications to Windows file association registry keys under HKCU\SOFTWARE\Classes and HKCR that point to suspicious executables. Focuses on shell\open\command subkeys being changed to non-standard locations (outside System32 and Program Files). Flags handlers containing scripting engines, LOLBins, or writable user paths.

Data Sources

Windows Registry: Registry Key ModificationMicrosoft Defender for Endpoint

Required Tables

DeviceRegistryEvents

False Positives & Tuning

  • Software installations that legitimately register file handlers (e.g., installing a new browser changes .html, .htm associations)
  • Development tools registering custom file extensions for project files (Visual Studio, JetBrains IDEs)
  • PDF readers, media players, and archiving utilities that change handler associations during install or on first run
  • Group Policy-driven file association changes pushed by IT during software deployments
Download portable Sigma rule (.yml)

Other platforms for T1546.001


Testing Methodology

Validate this detection against 3 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 1Change .txt File Association to cmd.exe

    Expected signal: Sysmon Event ID 13 (Registry Value Set): TargetObject contains HKCU\Software\Classes\.txt\shell\open\command, Details contains 'cmd.exe'. Security Event ID 4657 if object access auditing is enabled. Process creation for reg.exe with the add command.

  2. Test 2Change .js File Association to PowerShell

    Expected signal: Sysmon Event ID 13: TargetObject HKCU\Software\Classes\.js\shell\open\command, Details contains powershell.exe. Process creation for reg.exe.

  3. Test 3Establish Persistence via .hta File Association

    Expected signal: Sysmon Event ID 13: TargetObject HKCU\Software\Classes\.hta\shell\open\command, Details contains mshta.exe. The vbscript: protocol in the handler is a high-fidelity indicator of malicious intent.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections