To drop Canarytokens on Windows endpoints, a powershell script can be deployed and executed using Microsoft Endpoint Manager (MEM).
The powershell script on github should be downloaded and configured as a MEM script which will be executed on an applicable Device Collection.
The Powershell Script
The powershell script contains multiple variables that need to set according to your deployment requirements. In this example we'll deploy an AWS API Key to the c:\secret directory on multiple targets. The memo/reminder field will include the hostname of the device so thats it's possible to determine where tokens have been deployed.
The following variables need to be set within the script:
- Domain
- Your Console domain hash, e.g xxxxyyyy.canary.tools
- FactoryAuth
- Factory auth key, e.g a1bc3e769fg832hij3
- Instructions for creating a Canarytoken factory can be found here
- TargetDirectory
- Directory to create on endpoint, e.g c:\secret
- TokenFileName
- File name to create on endpoint, e.g aws_secret.txt
- TokenType
- The type of token to be created, e.g AWS API Key
MEM Script
Using the powershell script, MEM administrators will be able to create a MEM script that will deploy the Canarytokens and apply it to device collections.
Deployment Steps
Create the script
- Go to “Software Library”, select Scripts and click “Create Script”
- Provide a “Script name”, specify PowerShell as the language and paste the provided script into the “Script” text box.
- Verify that the parameters within the script are configured as expected and make use of double quotes instead of single quotes.
- Finish the script creation and click on “close”.
Create the script
- Go to “Software Library” and select the script that you created above. Click on the “Approve/Deny” ribbon item.
- Verify that the Script Parameters are correct and click “next”
- Select the “Approve” radio button and click “next”.
- Finish the script approval and click on “close”.
Create a Device Collection
- Go to “Assets and Compliance” and select “Device Collections”. Click on the “Create Device Collection” ribbon item.
- Go to “Assets and Compliance” and select “Device Collections”. Click on the “Create Device Collection” ribbon item.
- Select “All Desktop and Server Clients”
- Click on the “Add Rule” drop down, and select “Direct Rule”.
- Select an applicable “Attribute name” to filter on. The example filters for all hostnames starting with “WIN”.
- Select the devices you wish to add to the device collection from the search output.
- Click “Close” to return to main Device Collection wizard
- Confirm that the relevant devices have been added to the “Membership rules” and click “Next”.
- Finish the Device Collection creation and click on “close”.
Run the Script
- Go to “Assets and Compliance” and select “Device Collections”. Select the “subset_token_collection” device collection and click on the “Run Script” ribbon item.
- Select the script created above and click “next”
- Verify that the parameters within the script are correct, and click “next”
- Click “close” once the script has completed
- Verify that the token has been dropped into the specified location
You're done! ;-)