# CMSTP

Adversaries may abuse CMSTP to proxy execution of malicious code. The Microsoft Connection Manager Profile Installer (CMTSP.exe) is command-line program used to install Connection Manager service profiles. CMSTP.exe accepts an installation information file (INF) as a parameter and installs a service profile leveraged for remote  access connections.

Adversaries may supply CMSTP.exe with INF files infected with malicious commands. Similar to Regsvr32 / "Squiblydoo", CMSTP.exe may abused to load and execute DLLs and/or COM scriptlets (SCT) from remote servers. This execution may also bypass AppLocker and other application control defenses since CMSTP.exe is a legitimate, signed Microsoft application.

CMSTP.exe can also be abused to Bypass User Account Control and execute arbitrary commands from a malicious INF through an auto-elevated COM interface.

**Example**

This one was a little tricky as we needed to create an inf file but also have an sct file waiting for us remotely to execute code, as this will use the scrobj.dll to execute our code as well.

![](https://315180959-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRh03Vwd4nuiUi3Oje7%2F-MRkXlpyeiPnNyt1vi75%2F-MRkXmlkFXW2YGvgRlHW%2Fimage.png?alt=media\&token=27fe23c0-b3f7-4d79-a1ff-8c955fe70871)

Then execution should be simple

![](https://315180959-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRh03Vwd4nuiUi3Oje7%2F-MRkXlpyeiPnNyt1vi75%2F-MRkXn_YqKV5JozbzlFg%2Fimage.png?alt=media\&token=07e87b86-ea37-4b1d-8b7f-6c767e502223)

Careful as this will create a VPN Connection and leave a shortcut on the Desktop as well, a way to avoid this is to actually gain a shell (PowerShell, CMD) in this demo the reason (I think?) it is being left behind is because execution finalizes and doesn't stay in a continuous running state such as when receiving a shell

References:

[https://raw.githubusercontent.com/api0cradle/LOLBAS/master/OSBinaries/Payload/Cmstp.inf](https://raw.githubusercontent.com/api0cradle/LOLBAS/master/OSBinaries/Payload/Cmstp.inf)

[https://www.contextis.com/en/blog/applocker-bypass-via-registry-key-manipulation](https://www.contextis.com/en/blog/applocker-bypass-via-registry-key-manipulation)

[https://pentestlab.blog/2017/05/24/applocker-bypass-control-panel/](https://pentestlab.blog/2017/05/24/applocker-bypass-control-panel/)

[https://gist.github.com/NickTyrer/bbd10d20a5bb78f64a9d13f399ea0f80](https://gist.github.com/NickTyrer/bbd10d20a5bb78f64a9d13f399ea0f80)

[https://twitter.com/NickTyrer/status/958450014111633408](https://twitter.com/NickTyrer/status/958450014111633408)
