The CMSTP BOF leverages the auto-elevation functionality of the Windows Connection Manager Profile Installer (CMSTP.exe) to bypass UAC restrictions. It uses a specially crafted INF file to execute arbitrary commands with elevated privileges.
- Generates a malicious INF file containing the specified command
- Uses CMSTP.exe to "install" the INF file, which auto-elevates due to Windows trusted binary status
- Handles window interactions automatically to complete the installation
- Executes the specified command with elevated privileges
- Cleans up temporary files
cmstp.c- Main BOF implementationbeacon.h- Cobalt Strike beacon API definitionscmstp.cna- Aggressor script for Cobalt Strike integrationbuild.sh- Build script to compile the BOF
To build the BOF:
- Ensure you have the required build environment (mingw-w64)
- Run the build script:
./build.sh- Copy all files to your Cobalt Strike installation:
cmstp.cna
cmstp.x64.o
- Load the script in your Cobalt Strike client:
Cobalt Strike -> Scripts -> Load
From a Beacon prompt in Cobalt Strike:
beacon> help cmstp_bof
Usage: cmstp_bof <command>
beacon> cmstp_bof "cmd.exe /c whoami > C:\temp\test.txt"
The BOF implementation:
- Creates a temporary INF file with the specified command
- Leverages CMSTP.exe's auto-elevation capabilities
- Handles GUI automation for installation dialogs
- Implements proper cleanup procedures
- Provides detailed debug output for troubleshooting