T1042 Default File Association Persistence - CraigDonkin/Infrastructure GitHub Wiki
Change the command associated with opening a file, for example when you load a .html file, to execute arbitrary command.
- User Keys stored in HKEY_USERS\S-xxxx_classes[extension]
- There will be a subfolder called Shell with a folder called open and then a key for command
- Replace the command with malicious command
- You could replace with a .exe that also deploys the original .exe so the victim doesn't notice anything has changed
- https://github.com/hasherezade/persistence_demos/blob/master/extension_hijack/proxy_app/src/main.cpp
- Global handlers are defined in HKEY_CLASSES_ROOT.[extension]
- HKEY_CLASSES_ROOT[handler]\shell[action]\command
- If there is no local extension then the global one is executed
- Read extension handlers defined globally
- Rewrite them locally
- Hijack