Trusted Installer
Last updated
Last updated
MsSense is a PPL service, meaning that even with SYSTEM privileges, we will not be able to stop this.
However Microsoft allows "trusted callers" to manage protected services and other critical resources in the system. This "trusted caller" is a service called TrustedInstaller.
You may have seen this certain service while looking at ACLs of certain applications:
As you can see, it is given full control of calc.exe, and is the only service that has full control.
It is also given full control over all the SVCHOST, which hosts the diagtrack service binary.
The TrustedInstaller service is also a service which does not have PPL configured:
So does that mean we can just change Trustedinstaller’s binary path to stop the ATP Sense service?
Well, you can't, since this is already a known technique that ATP is aware of, and will make an alert if you try to do this.
Alright, so we know that TrustedInstaller is a service configured without PPL, we could potentially spawn a cmd prompt with DiagTrack as its parent(cmd will inherit the TrustedInstaller's security token descriptor), and use that cmd prompt to disable the ATP service that way.
Information of why this works is in this picture:
To do this, we need the SeDebug privilege(which you can enable if you are admin).
We will use PowerShell, and two .NET DLLs from James forshaw which will ease the whole process for us. These are called NtObjectManager.dll and NtApiDoNet.dll.
You can find these DLLs here:
These DLLs will not trigger any alerts due to the fact that they are legitimate windows code and are just wrappers around low-level code.
We will first load those 2 dlls in memory:
We will then import the loaded assemblies:
We will then enable the SeDebug privilege:
And then launch the TrustedInstaller process and get a handle to it:
We will then call the CreateProcess method to launch cmd.exe with TrustedInstaller.exe as its parent process.
Then our CMD will popup!
From there, we can just stop the MsSense and Diagtrack service
Or just rename the executable:
This will effectively stop the ATP process.