Description
Distribute canary tokens across strategic locations throughout the environment. Canary tokens are lightweight tripwires embedded in files, URLs, DNS records, or credentials that generate an alert when accessed, without requiring any infrastructure beyond a callback server.
Rationale
Canary tokens can provide lightweight monitoring without the infrastructure required by interactive honeypots. They may be placed in documents, DNS records, configuration files, or database records. Alerts can be low-noise when legitimate access paths are excluded, but authorized testing, scanners, and accidental contact must still be considered.
Supporting Basis
Direct antecedentHoneyfiles, monitored credentials, beacons, and honeytokens are deployed so their access or use can raise an alert.
- Bowen, B.M. et al. Baiting Inside Attackers Using Decoy Documents. SecureComm 2009, 51–70.Peer reviewed
- Spitzner, L. Honeypots: Catching the Insider Threat. ACSAC 2003, 170–179.Peer reviewed
- Yuill, J.; Zappe, M.; Denning, D.; Feer, F. Honeyfiles: Deceptive Files for Intrusion Detection. IEEE SMC Information Assurance Workshop 2004, 116–122.Peer reviewed
These sources establish design lineage and scope. They do not validate this record's operational effectiveness, planning estimates, environment labels, or ATT&CK relationships.
Implementation Steps
Select canary token types
Choose from available token types: DNS tokens, HTTP tokens, document tokens (Word, PDF, Excel), AWS key tokens, email tokens, or custom tokens.
Generate tokens
Create unique tokens for each placement location. Ensure each token can be independently identified when triggered so you know exactly which asset was accessed.
Place tokens strategically
Distribute tokens in locations where adversaries forage: shared drives, configuration files, browser bookmark files, environment variables, and cloud storage buckets.
Configure alert routing
Set up alert delivery for token triggers. Include webhook integrations to push alerts to SOC communication channels in real time.
Create token inventory
Maintain a registry of all deployed tokens, their locations, types, and expected alert behavior. This inventory is essential for managing token lifecycle.
Technical Implementation Examples(1)
Canary Token Generator Script
Python script to generate various types of canary tokens and maintain a deployment inventory
"""
Canary Token Generator and Inventory Manager.
Generates DNS, HTTP, and document-based canary tokens and
maintains a registry of deployed tokens for alert correlation.
"""
import json
import uuid
import hashlib
import os
from datetime import datetime
from typing import Dict, List
INVENTORY_FILE = "canary_inventory.json"
CALLBACK_DOMAIN = "tokens.shadow-cdf.internal"
class CanaryTokenManager:
def __init__(self):
self.inventory: List[Dict] = []
self._load_inventory()
def _load_inventory(self):
if os.path.exists(INVENTORY_FILE):
with open(INVENTORY_FILE) as f:
self.inventory = json.load(f)
def _save_inventory(self):
with open(INVENTORY_FILE, "w") as f:
json.dump(self.inventory, f, indent=2)
def _generate_token_id(self) -> str:
return hashlib.sha256(
uuid.uuid4().bytes
).hexdigest()[:16]
def create_dns_token(
self, placement: str, description: str
) -> Dict:
"""Create a DNS-based canary token.
Triggers when the hostname is resolved."""
token_id = self._generate_token_id()
hostname = f"{token_id}.{CALLBACK_DOMAIN}"
token = {
"type": "dns",
"token_id": token_id,
"trigger_value": hostname,
"placement": placement,
"description": description,
"created_at": datetime.utcnow().isoformat(),
"status": "active",
"alert_message": f"DNS canary triggered: "
f"{placement} - {description}",
}
self.inventory.append(token)
self._save_inventory()
return token
def create_http_token(
self, placement: str, description: str
) -> Dict:
"""Create an HTTP-based canary token.
Triggers when the URL is fetched."""
token_id = self._generate_token_id()
url = f"https://{CALLBACK_DOMAIN}/t/{token_id}/logo.png"
token = {
"type": "http",
"token_id": token_id,
"trigger_value": url,
"placement": placement,
"description": description,
"embed_html": f'<img src="{url}" width="1" '
f'height="1" alt="" />',
"created_at": datetime.utcnow().isoformat(),
"status": "active",
}
self.inventory.append(token)
self._save_inventory()
return token
def create_credential_token(
self, username: str, password: str,
placement: str, description: str,
) -> Dict:
"""Create a credential-based canary.
Triggers when username/password is used for authentication."""
token_id = self._generate_token_id()
token = {
"type": "credential",
"token_id": token_id,
"trigger_value": {
"username": username,
"password_hash": hashlib.sha256(
password.encode()
).hexdigest(),
},
"placement": placement,
"description": description,
"created_at": datetime.utcnow().isoformat(),
"status": "active",
"siem_query": f'event.action:"authentication" AND '
f'user.name:"{username}"',
}
self.inventory.append(token)
self._save_inventory()
return token
def print_inventory_summary(self):
print(f"\nCanary Token Inventory: {len(self.inventory)} tokens")
print("-" * 60)
for token in self.inventory:
print(f" [{token['type']:12s}] {token['token_id']}")
print(f" Placement: {token['placement']}")
print(f" Status: {token['status']}")
print()
if __name__ == "__main__":
mgr = CanaryTokenManager()
# Deploy tokens across the environment
mgr.create_dns_token(
placement="/opt/app/config/monitoring.conf",
description="Fake monitoring endpoint in app config",
)
mgr.create_http_token(
placement="IT_Network_Diagram_2026.docx",
description="Tracking pixel in decoy network diagram",
)
mgr.create_credential_token(
username="svc_sql_backup",
password="SqlB4ckup#Pr0d!",
placement="backup-config.sh on file-server-02",
description="Trap DB credentials in backup script",
)
mgr.print_inventory_summary()MITRE ATT&CK Mappings
| Technique | Tactic | Relationship |
|---|---|---|
| T1083File and Directory Discovery | Discovery | detects |
| T1005Data from Local System | Collection | detects |
| T1552Unsecured Credentials | Credential Access | detects |
Considerations
- Canary tokens should have filenames and locations that make them attractive to adversaries. A file named "passwords.xlsx" on a shared drive is more likely to be opened than "test_document.txt".
- Rotate tokens periodically to prevent adversaries who have mapped your deception from avoiding known tokens.
- Test token triggering regularly to ensure the callback mechanism remains operational.
Supported Environments
Tools & Resources
- Canarytokens.org (free canary token service)
- Thinkst Canary (commercial canary platform)
- Custom canary token implementations
- Webhook integration platforms
Related Techniques
Quick Stats
- Phase
- Deploy
- Difficulty
- foundational
- Detection Value
- critical
- Cost
- minimal
- Time
- 1-3 days
- ATT&CK Mappings
- 3