implementing-canary-tokens-for-network-intrusion
它能做什么
这个工具会创建一种叫“Canary Tokens”的“数字警报”。只要有人试图访问这些警报,你就会立刻收到通知。它可以帮你及时发现是否有未经授权的人在尝试入侵你的系统。
适用场景
- ✓当你想知道是否有人在尝试访问他们不该访问的文件或系统时。
- ✓当你想建立一套针对未授权访问的早期预警机制时。
- ✓当你想抓住在网络中从一个系统横向移动到另一个系统的入侵者时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-canary-tokens-for-network-intrusion/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“帮我创建一个数字警报,当有人试图读取生产数据库的配置文件时通知我。”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具会生成特殊的链接或代码(也就是 token)。你把这些 token 放在敏感的位置。如果有人点击或使用了其中某个 token,系统就会向你发送提醒。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Implementing Canary Tokens for Network Intrusion Detection
When to Use
- When deploying deception-based tripwires across network infrastructure to detect intrusions
- When building early warning systems that alert on unauthorized access to sensitive resources
- When planting fake AWS credentials, DNS beacons, or HTTP tokens to catch attackers during lateral movement
- When integrating canary token alerts with SOC workflows via Slack, Microsoft Teams, or SIEM webhooks
- When complementing traditional IDS/IPS with zero-false-positive deception technology
Prerequisites
- Python 3.8+ with
requestslibrary installed - Network access to canarytokens.org API (or self-hosted Canarytokens instance)
- Webhook endpoint for alert delivery (Slack, Teams, email, or generic HTTP)
- For Thinkst Canary enterprise: valid console domain and API auth token
- Administrative access to target systems where tokens will be planted
- Appropriate authorization for all deployment activities
Core Concepts
What Are Canary Tokens?
Canary tokens are digital tripwires -- resources that should never be accessed during normal operations. When an attacker interacts with a canary token, it immediately triggers an alert with near-zero false positives. Unlike signature-based detection, canary tokens detect attackers by their behavior (accessing bait resources) rather than matching known patterns.
Token Types for Network Intrusion Detection
| Token Type | Trigger Mechanism | Best Placement | Detection Scenario |
|---|---|---|---|
| DNS Token | DNS resolution of FQDN | Config files, scripts, internal docs | Attacker reads configs during recon |
| HTTP Token | HTTP GET to unique URL | Internal wikis, bookmark files, HTML | Attacker browses internal resources |
| AWS API Key | AWS API call with fake creds | .aws/credentials, env files, repos |
Attacker tests found credentials |
| Cloned Site | Visit to cloned page | Internal portals, admin panels | Attacker accesses cloned services |
| SVN Token | SVN checkout | Repository configs | Attacker clones repositories |
| SQL Server | Database login attempt | Connection strings, config files | Attacker attempts DB access |
Alert Flow Architecture
[Attacker Action] --> [Token Triggered] --> [Canarytokens Server]
|
[Webhook POST]
|
+-------------------------+-------------------------+
| | |
[Slack Alert] [Email Alert] [SIEM Ingestion]
| | |
[SOC Analyst] [On-Call Page] [Correlation Rule]
Instructions
Step 1: Generate DNS Canary Tokens
DNS tokens are the most versatile -- they trigger on any DNS resolution, even from air-gapped networks with only DNS egress. The token is an FQDN that, when resolved, alerts the token owner.
import requests
# Create DNS canary token via Canarytokens.org
response = requests.post("https://canarytokens.org/generate", data={
"type": "dns",
"email": "soc@company.com",
"memo": "Production database server - /etc/app/db.conf",
"webhook_url": "https://hooks.slack.com/services/T.../B.../xxx"
}, timeout=15)
token_data = response.json()
dns_hostname = token_data["hostname"]
# Example: abc123def456.canarytokens.com
Plant DNS tokens in locations attackers commonly inspect:
/etc/hostsentries pointing to the canary FQDN- Application configuration files (
database_host,backup_server) - SSH config files (
~/.ssh/config) with canary hostnames - Internal DNS zone files as decoy A records
- CI/CD pipeline environment variables
Step 2: Deploy HTTP Canary Tokens
HTTP tokens generate a unique URL that triggers on any HTTP request. They reveal the source IP, User-Agent, and other HTTP headers of the requester.
# Create HTTP token
response = requests.post("https://canarytokens.org/generate", data={
"type": "http",
"email": "soc@company.com",
"memo": "Internal wiki - IT admin passwords page",
"webhook_url": "https://hooks.slack.com/services/T.../B.../xxx"
}, timeout=15)
http_url = response.json()["url"]
…
常见问题
什么是“Canary Tokens”?
它们就像数字化的绊线。这些资源在正常操作中本不应该被访问,一旦有人访问它们,就说明出现了需要警惕的信号。
为什么要用“Canary Tokens”,而不是杀毒软件?
杀毒软件主要查找已知的威胁。Canary Tokens 则会检测任何未经授权的访问,即使是全新的、未知的情况,因为它关注的是访问者的行为。
有哪些类型的 token?
有的 token 会在有人尝试解析互联网地址(DNS)、访问某个链接(HTTP)或使用伪造的云端凭证(AWS API Key)等情况下被触发,此外还有其他类型。
详情
作者的原始描述
Deploys DNS, HTTP, and AWS API key canary tokens across network infrastructure to detect unauthorized access and lateral movement. Integrates with webhook alerting (Slack, Teams, email, generic HTTP) for real-time intrusion notifications. Provides automated token generation, placement strategies, and monitoring for enterprise network environments. Use when building deception-based network intrusio
热度
- GitHub 星标
- 35k
- 排名
- #8008
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。