Here’s yet another subclass of tricks one can use to distort the process tree seen by EDR and sandbox solutions.
Many Windows programs launch other internal Windows programs (native to OS). They do so carefully so they typically launch them from %SystemRoot%. Many of them use GetSystemDirectory to build a path, but there are still quite a few that rely on an environment variable – they need to use an ExpandEnvironmentStrings API to obtain the actual path.
Changing that environmental variable and copying the required files to a redirected location while replacing the target application enables us to launch a payload of choice making it look like it was executed by a signed binary.
Example:
In this old post I mentioned AtBroker. When you launch it from a command line without any arguments it will simply launch Narrator.exe.
We can:
- create a test folder
- change the SystemRoot to point to it
- copy all the necessary files from the original system32 and Registration folder (procmon helps)
- launch atbroker.exe
- the narrator.exe payload will be executed