Detect Change Default File Association in Splunk
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/
SPL Detection Query
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" (EventCode=12 OR EventCode=13 OR EventCode=14)
| where match(TargetObject, "\\\\Classes\\\\\.[^\\\\]+\\\\shell\\\\open\\\\command")
| eval IsSuspiciousValue=if(match(lower(Details), "(powershell|cmd\.exe|wscript|cscript|mshta|rundll32|regsvr32|certutil|bitsadmin|appdata|\\\\temp\\\\|programdata)"), 1, 0)
| eval Extension=mvindex(split(TargetObject, "\\\\"), 4)
| eval IsUserHive=if(match(TargetObject, "HKU\\\\|HKCU\\\\"), 1, 0)
| where IsSuspiciousValue=1 OR IsUserHive=1
| table _time, host, User, EventCode, TargetObject, Details, Extension, IsSuspiciousValue, IsUserHive, Image, CommandLine
| sort - _time Detects file association changes via Sysmon Registry events (Event ID 12 create, 13 set value, 14 delete/rename). Monitors for shell\open\command path modifications, flagging entries pointing to scripting engines, LOLBins, or user-writable directories. Also highlights changes in the per-user HKCU hive, which is commonly abused to avoid requiring admin rights.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Software installations that legitimately register file handlers
- Development tools registering custom file extensions
- PDF readers, media players changing default handlers on install
- Group Policy-driven file association changes
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.
- 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.
- 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.
- 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.
References (5)
- https://attack.mitre.org/techniques/T1546/001/
- https://docs.microsoft.com/en-us/windows/win32/shell/fa-intro
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1546.001/T1546.001.md
- https://pentestlab.blog/2020/01/13/persistence-change-default-file-association/
- https://www.hexacorn.com/blog/2018/03/15/beyond-good-ol-run-key-part-75/
Unlock Pro Content
Get the full detection package for T1546.001 including response playbook, investigation guide, and atomic red team tests.