Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CanaryHunter — Canary Hunter 旨在成为一个快速的 PowerShell 脚本,用于检查在 canarytokens.org 上免费生成的各种格式的常见 Canary。 | Kitploit
工具/GitHubGitHub/c0axx/canaryhunter
云基础设施安全配置审计信息收集渗透测试秘密检测红队对抗性攻击
GitHubc0axx/canaryhunter

CanaryHunter

Canary Hunter 旨在成为一个快速的 PowerShell 脚本,用于检查在 canarytokens.org 上免费生成的各种格式的常见 Canary。

查看仓库
137113年前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

Canary Hunter

摘要

在过去几年执行多次红队演练期间,我曾多次遇到 Canary Token,这些令牌可能会让安全运营中心(SOC)察觉到所采取的行动。因此,我花了一些时间深入探索,试图找出是否有办法检测环境内文件中存在的这些 canary。Canary Hunter 的诞生就是为了快速检查在 canarytokens.org 上免费生成的各类常见 Canary。

什么是 Canary Token

Canary token 是一种免费、快速、无痛的方式,帮助防御者发现他们已被入侵(通过让攻击者自我暴露)。有关 Canary token 的更多信息以及如何免费生成它们,可以查看 https://blog.thinkst.com/p/canarytokensorg-quick-free-detection.html

概览

目前该脚本可以检测以下格式中的 canary:

  • Docx
  • Xlsx
  • PDF(前提是已安装 PDFStreamDumper)
  • 通过注册表项检测敏感命令令牌
  • AWS 配置
  • WireGuard 配置
  • Kube 配置
  • MySQL 转储令牌

用法

导入脚本

root@kitploit:~
PS C:\> Import-Module .\CanaryHunter.psd1

Docx 文件

将 docx 复制为 zip,然后解析 xml 内容,使用正则匹配 Canary Token 域名。

root@kitploit:~
PS C:\> Invoke-DocxCheck -DocxPath gwfrr71nre84bk5gobf3h96ms.docx
Url Found:

http://canarytokens.com/feedback/traffic/gwfrr71nre84bk5gobf3h96ms/index.html

Xlsx 文件

将 xlsx 复制为 zip,然后解析 xml.rels 内容,使用正则匹配 Canary Token 域名。

root@kitploit:~
PS C:\> Invoke-XlsxCheck -XlsxPath  .\gwfrr71nre84bk5gobf3h96ms.xlsx
Url Found:

http://canarytokens.com/images/tags/articles/gwfrr71nre84bk5gobf3h96ms/contact.php

PDF 文件

对指定的 .pdf 执行 PDFStreamDumper,然后解析 .unk 流文件中关键字 Canary。

root@kitploit:~
PS C:\> Invoke-PDFCheck -StreamDumperPath C:\PDFStreamDumper\PDFStreamDumper.exe -PDFPath .\gwfrr71nre84bk5gobf3h96ms.pdf
Url Found:

http://gwfrr71nre84bk5gobf3h96ms.canarytokens.net/RNGPLTCJSTEKJHOMLLYCQINNXOVOWCUVME

注册表项

默认检查 "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit" 中是否存在使用静默退出监控的进程,然后对 Monitor Process 属性运行正则匹配。

root@kitploit:~
PS C:\> Invoke-RegistryCheck
Sensitive Command Canary Found For:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\net.exe


Monitor Process Canary Value Found:
cmd.exe /c start /min powershell.exe -windowstyle hidden -command "$($u=$(\"u$env:username\" 
-replace('[^\x00-\x7f]|\s', ''))[0..63] -join '';$c=$(\"c$env:computername\" -replace('[^\x00-\x7f]|\s', ''));
Resolve-DnsName -Name \"$c.UN.$u.CMD.gwfrr71nre84bk5gobf3h96ms.canarytokens.com\")"

AWS 配置

根据 Bobby Lin 的博客,扫描可能属于免费 Canary token 服务 AWS 账户的 AWS 访问密钥。

root@kitploit:~
PS C:\> Invoke-AWSCheck -AWSPath .\AWS.config
Possible Canary Config Found:

AWS.config:2:aws_access_key_id = AKIAYVP4CIPPJUYTRES

WireGuard 配置

扫描 WireGuard 配置中已知的 Canary Token IP 地址。

root@kitploit:~
PS C:\> Invoke-WireguardCheck -WireGuardPath .\WireguardConfig
Possible Canary Config Found:

Endpoint = 52.18.63.80

Kube 配置

扫描 Kube 配置中已知的 Canary Token IP 地址。

root@kitploit:~
PS C:\> Invoke-KubeCheck -KubeConfigPath .\KubeConfig
Possible Canary Config Found:

server: https://52.18.63.80:6443

MySQL 转储

扫描 MySQL 转储中的 SET @b=,然后运行正则匹配以确定 MASTER HOST 是否包含已知的 Canary Token IP 地址。

root@kitploit:~
PS C:\> Invoke-MySqlDumpCheck -MySQLDumpPath .\gwfrr71nre84bk5gobf3h96ms_mysql_dump.sql
Url Found:

MASTER_HOST='gwfrr71nre84bk5gobf3h96ms.canarytokens.com'

阻止 Canary 出站流量

阻止已知的 Canary IP

root@kitploit:~
PS C:\> Invoke-BlockCanaries

DisplayName                   : Block All Known Canary IP Addresses
Enabled                       : True
Profile                       : Any
Direction                     : Outbound
Action                        : Block

Firewall Rule to Block Canary IP Addresses Succesffully Created

致谢

HackingLZ - Coalmine.py

Bobby Lin 的博客

WatchfulSleeper - CanaryTokensDetectorForWin

singe - Canary Token Yara

下载工具