Safeguard
Application Security•

Detecting Default File Association Hijacking (T1546.001)

Changing the handler for a file type makes Windows run attacker code whenever that file opens. Here is how it works and how to detect it.

Safeguard Security Team
2 min read

Change Default File Association (MITRE ATT&CK T1546.001) is a Windows persistence and privilege escalation technique. When a file is opened, Windows checks which program is the default handler for its type. Those choices live in the registry and can be edited by users, administrators or programs with registry access, or with the built-in assoc utility.

How attackers use it

System file associations sit under HKEY_CLASSES_ROOT\.[extension], which point to a handler at HKEY_CLASSES_ROOT\[handler]. The commands run for each action are subkeys under shell, such as HKEY_CLASSES_ROOT\txtfile\shell\open\command. Print and printto work the same way.

MITRE says adversaries can modify those command values to run arbitrary commands each time a file of that type is handled.

How to detect it

  • Changes to registry keys used for file handlers, under HKCU and HKCR.
  • New or unusual handler paths that launch odd child processes after a user opens a file, such as PowerShell, cmd or wscript.

How to reduce the risk

MITRE lists no specific mitigations for this sub-technique. Monitor handler keys, limit registry write rights, and treat a handler that launches a script host as suspicious.

Quick check

Where do the commands for a file type's open action live?

Under the shell subkey of the handler, for example HKEY_CLASSES_ROOT\txtfile\shell\open\command.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.