Implementing Deception-Based Detection with Canarytoken
Overview
Canary Tokens are lightweight tripwire mechanisms that alert when an attacker accesses a resource. This skill uses the Thinkst Canary REST API to programmatically create tokens (web bugs, DNS tokens, MS Word documents, AWS API keys), deploy them to strategic locations, monitor for triggered alerts, and generate deception coverage reports.
When to Use
Trigger phrases:
"implementing deception based detection with canarytoken"
"When deploying or configuring implementing deception based detection with canary"
"When establishing security controls aligned to compliance requirements"
"When building or improving security architecture for this domain"
When deploying or configuring implementing deception based detection with canarytoken capabilities in your environment
When establishing security controls aligned to compliance requirements
When building or improving security architecture for this domain
When conducting security assessments that require this implementation
Prerequisites
- Thinkst Canary Console or canarytokens.org account
- API auth token from Canary Console
- Python 3.9+ with
requests
- File system access for deploying document and file tokens
Steps
# Example: IOC detection
import re
IOC_PATTERNS = {
"ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
"domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",
"hash_md5": r"\b[a-f0-9]{32}\b",
"hash_sha256": r"\b[a-f0-9]{64}\b",
}
def extract_iocs(text: str) -> dict:
return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}
- Authenticate to the Canary Console API using auth_token
- Create web bug (HTTP) tokens for embedding in documents and web pages
- Create DNS tokens for monitoring DNS resolution attempts
- Create MS Word document tokens for file share deployment
- List all active tokens and their trigger history
- Query recent alerts for triggered token events
- Generate deception coverage report with deployment recommendations
Expected Output
- JSON report listing all deployed Canary Tokens, trigger history, alert details, and coverage analysis
- Deployment map showing token types across network segments
When NOT to Use
- You need to test the implementation (use performing-* skills)
- Task is about configuring existing tools (use configuring-* skills)
- You need to analyze security events (use analyzing-* skills)
- Task is about building detection rules (use building-* skills)
- You don't have access to the target environment
- Task requires vendor-specific expertise (consult vendor docs)
Red Flags
- Performing actions without explicit written authorization from the asset owner
- Testing against production systems without a defined scope and rules of engagement
- Testing without rate limiting, potentially causing service degradation
- Storing sensitive test data (credentials, tokens) in plain text logs
- Using automated scanners blindly without reviewing results for false positives
Process
- Reconnaissance — Gather target information, identify attack surface, enumerate services
- Analysis/Exploitation — Execute the technique, analyze results, document findings
- Reporting — Document IOCs, write findings, provide remediation recommendations
Verification
- All steps executed successfully against a test environment before production use
- Output documented with screenshots or logs demonstrating expected behavior
- Vulnerabilities reproduced with proof-of-concept and impact analysis
- False positives filtered out through manual verification
- Fix recommendations include code-level remediation guidance
Anti-Rationalization Table
| Rationalization |
Reality |
| "We are too small to be targeted" |
Automated attacks target everyone. Size does not matter. |
| "Security slows us down" |
A breach slows you down 100x more. Build security in from the start. |
| "We will fix it after launch" |
Vulnerabilities in production are exploited within hours. Fix before deploy. |
1---2name: implementing-deception-based-detection-with-canarytoken3description: Use when deploy and monitor Canary Tokens via the Thinkst Canary API for deception-based breach detection using web bug tokens, DNS tokens, document tokens, and AWS key tokens. Use when deploying and monitor canary tokens via the thinkst canary api.4license: Apache-2.05---678# Implementing Deception-Based Detection with Canarytoken910## Overview1112Canary Tokens are lightweight tripwire mechanisms that alert when an attacker accesses a resource. This skill uses the Thinkst Canary REST API to programmatically create tokens (web bugs, DNS tokens, MS Word documents, AWS API keys), deploy them to strategic locations, monitor for triggered alerts, and generate deception coverage reports.131415## When to Use1617**Trigger phrases:**18- "implementing deception based detection with canarytoken"19- "When deploying or configuring implementing deception based detection with canary"20- "When establishing security controls aligned to compliance requirements"21- "When building or improving security architecture for this domain"222324- When deploying or configuring implementing deception based detection with canarytoken capabilities in your environment25- When establishing security controls aligned to compliance requirements26- When building or improving security architecture for this domain27- When conducting security assessments that require this implementation2829## Prerequisites3031- Thinkst Canary Console or canarytokens.org account32- API auth token from Canary Console33- Python 3.9+ with `requests`34- File system access for deploying document and file tokens3536## Steps3738```python39# Example: IOC detection40import re4142IOC_PATTERNS = {43 "ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",44 "domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",45 "hash_md5": r"\b[a-f0-9]{32}\b",46 "hash_sha256": r"\b[a-f0-9]{64}\b",47}4849def extract_iocs(text: str) -> dict:50 return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}51```52531. Authenticate to the Canary Console API using auth_token542. Create web bug (HTTP) tokens for embedding in documents and web pages553. Create DNS tokens for monitoring DNS resolution attempts564. Create MS Word document tokens for file share deployment575. List all active tokens and their trigger history586. Query recent alerts for triggered token events597. Generate deception coverage report with deployment recommendations6061## Expected Output6263- JSON report listing all deployed Canary Tokens, trigger history, alert details, and coverage analysis64- Deployment map showing token types across network segments65## When NOT to Use6667- You need to test the implementation (use performing-* skills)68- Task is about configuring existing tools (use configuring-* skills)69- You need to analyze security events (use analyzing-* skills)70- Task is about building detection rules (use building-* skills)71- You don't have access to the target environment72- Task requires vendor-specific expertise (consult vendor docs)737475## Red Flags7677- Performing actions without explicit written authorization from the asset owner78- Testing against production systems without a defined scope and rules of engagement79- Testing without rate limiting, potentially causing service degradation80- Storing sensitive test data (credentials, tokens) in plain text logs81- Using automated scanners blindly without reviewing results for false positives8283## Process84851. **Reconnaissance** — Gather target information, identify attack surface, enumerate services861. **Analysis/Exploitation** — Execute the technique, analyze results, document findings871. **Reporting** — Document IOCs, write findings, provide remediation recommendations8889## Verification9091- All steps executed successfully against a test environment before production use92- Output documented with screenshots or logs demonstrating expected behavior93- Vulnerabilities reproduced with proof-of-concept and impact analysis94- False positives filtered out through manual verification95- Fix recommendations include code-level remediation guidance9697## Anti-Rationalization Table9899| Rationalization | Reality |100|---|---|101| "We are too small to be targeted" | Automated attacks target everyone. Size does not matter. |102| "Security slows us down" | A breach slows you down 100x more. Build security in from the start. |103| "We will fix it after launch" | Vulnerabilities in production are exploited within hours. Fix before deploy. |