Hijacking file associations is the same basic idea as hijacking shortcut files. This is a two-step process.
- Locate the “programmatic ID” of the extension you wish to hijack under
HKLM\Software\Classes
(this will be the key’s(Default)
value). - The programmatic ID will also be in
HKLM\Software\Classes
and will have the command path as the(Default)
value for itsshell\open\command
key.
Note that the programmatic ID command will probably include the %1
placeholder, which is used to pass in the file path. This requires a slightly different script than is used to backdoor shortcuts:
Note the quoting here, as well as the inclusion of the entire $args
array. Most of the documentation I’ve found online suggests using $args[0]
as an unquoted argument, but this approach did not work in my testing.