关于 deploying-active-directory-honeytokens
面向 Active Directory 管理员和安全团队的部署技能,用于布设欺骗对象并监测攻击者交互。涵盖伪装特权账号、SPN、GPO 与 BloodHound 路径。
主要功能
- 01部署伪装特权账号
- 02设置虚假 SPN 检测 Kerberoasting
- 03创建含凭据陷阱的诱饵 GPO
- 04构造欺骗性 BloodHound 路径
- 05配置 SIEM 告警并验证部署
适用场景
- 01发现针对虚假 SPN 的 Kerberoasting
- 02检测凭据窃取与横向移动
- 03识别 GPP 密码搜集活动
- 04为 AD 监控增加欺骗检测信号
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill deploying-active-directory-honeytokens安装后在 Claude Code 中输入/deploying-active-directory-honeytokens确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
LICENSEreferences/api-reference.mdscripts/agent.pyDeploy-ADHoneytokens.ps1详细介绍
部署 Active Directory 蜜标
适用场景
- 在 Active Directory 环境中部署基于欺骗的检测时
- 通过伪造 SPN 蜜标检测 Kerberoasting 攻击时(honeyroasting)
- 创建绊线账户以检测凭证窃取和横向移动时
- 构建诱饵 GPO 以检测组策略首选项密码收集时
- 创建欺骗性 BloodHound 路径以误导并检测攻击者时
- 用高保真检测信号补充现有 AD 监控时
前置条件
- 域管理员或委派的 AD 管理权限
- Active Directory 域(推荐 Windows Server 2016+)
- Windows 事件日志转发至 SIEM(Splunk、Sentinel、Elastic)
- PowerShell 5.1+ 及 ActiveDirectory 模块
- 组策略管理控制台(GPMC)
- 了解 AD 安全、Kerberos 和 BloodHound 攻击路径
背景
为什么使用 AD 蜜标
传统的基于特征的检测会漏掉新型攻击技术。蜜标可提供高保真检测,且误报率几乎为零, 因为任何与诱饵对象的交互本质上都是可疑的。在 Active Directory 中:
- 伪造的特权账户可检测凭证转储(DCSync、NTDS.dit 提取)
- 伪造的 SPN可检测 Kerberoasting 侦察(对不存在服务的 TGS 请求)
- 诱饵 GPO可检测组策略首选项密码收集
- 伪造的 BloodHound 路径可误导使用基于图的 AD 分析的攻击者
关键检测事件 ID
| 事件 ID | 描述 | 蜜标用途 |
|---|---|---|
| 4769 | 请求了 Kerberos TGS 票据 | 检测针对蜜罐 SPN 的 Kerberoast |
| 4625 | 登录尝试失败 | 检测诱饵 GPO 中伪造凭证的使用 |
| 4662 | 访问了目录服务对象 | 检测对蜜标用户的 DACL 读取 |
| 5136 | 修改了目录服务对象 | 检测对诱饵 GPO 的修改 |
| 5137 | 创建了目录服务对象 | 检测模仿诱饵的 GPO 创建 |
| 4768 | 请求了 Kerberos TGT | 检测对蜜罐账户的 AS-REP roasting |
让蜜标更逼真
根据 Trimarc Security 的研究,有效的蜜标必须看起来合法:
- 让账户变旧:重新利用旧的非活动账户(在年代相近的域中,10-15 年历史的账户 看起来更真实)
- 设置 AdminCount=1:将账户标记为具有提升的 AD 权限,使其成为有吸引力的 Kerberoasting 目标
- 使用逼真的命名:符合组织的命名惯例(svc_sqlbackup、 admin.maintenance、svc_exchange_legacy)
- 设置较旧的密码日期:密码年龄 10 年以上且带有 SPN,在攻击者看来就像一个 高价值却疏于管理的服务账户
- 添加组成员身份:将其加入可见的组,如 "Remote Desktop Users" 或自定义的 "Backup Operators",以提高攻击者的兴趣
- 避免暴露破绽:攻击者会检查创建日期、最后登录时间和密码更改日期是否一致
操作步骤
步骤 1:部署伪造的特权管理员账户
创建一个模仿旧版特权服务账户的蜜标账户。
# Import the deployment module
Import-Module .\scripts\Deploy-ADHoneytokens.ps1
# Create a honeytoken admin account
$honeyAdmin = New-HoneytokenAdmin `
-SamAccountName "svc_sqlbackup_legacy" `
-DisplayName "SQL Backup Service (Legacy)" `
-Description "Legacy SQL Server backup service account - DO NOT DELETE" `
-OU "OU=Service Accounts,DC=corp,DC=example,DC=com" `
-PasswordLength 128 `
-SetAdminCount $true
Write-Host "Honeytoken admin created: $($honeyAdmin.DistinguishedName)"
步骤 2:部署伪造 SPN 以检测 Kerberoasting
为蜜标账户分配一个逼真但伪造的 SPN。任何针对此 SPN 的 TGS 请求 都绝对是恶意的(honeyroasting)。
# Add fake SPN to honeytoken account
$honeySPN = Add-HoneytokenSPN `
-SamAccountName "svc_sqlbackup_legacy" `
-ServiceClass "MSSQLSvc" `
-Hostname "sql-legacy-bak01.corp.example.com" `
-Port 1433
Write-Host "Honey SPN registered: $($honeySPN.SPN)"
Write-Host "Monitor Event ID 4769 for TGS requests targeting this SPN"
步骤 3:部署带凭证陷阱的诱饵 GPO
在 SYSVOL 中创建一个伪造的 GPO,内嵌 cpassword(组策略首选项 密码)。使用 Get-GPPPassword 或 gpp-decrypt 等工具的攻击者会发现并 尝试使用这些凭证,从而触发检测。
# Create decoy GPO with cpassword trap
$decoyGPO = New-DecoyGPO `
-GPOName "Server Maintenance Policy (Legacy)" `
-DecoyUsername "admin_maintenance" `
-DecoyDomain "CORP" `
-SYSVOLPath "\\corp.example.com\SYSVOL\corp.example.com\Policies" `
-EnableAuditSACL $true
Write-Host "Decoy GPO created: $($decoyGPO.GPOGuid)"
Write-Host "SACL audit enabled - any read attempt will generate Event ID 4663"
步骤 4:创建欺骗性 BloodHound 路径
设置 ACL 权限,创建对 BloodHound/SharpHound 侦察可见的伪造攻击路径, 将攻击者引向受监控的蜜标。
# Create fake BloodHound attack path
$deceptivePath = New-DeceptiveBloodHoundPath `
-HoneytokenSamAccount "svc_sqlbackup_legacy" `
-TargetHighValueGroup "Domain Admins" `
-IntermediateOU "OU=Service Accounts,DC=corp,DC=example,DC=com"
Write-Host "Deceptive path created: $($deceptivePath.PathDescription)"
步骤 5:配置检测规则
设置 SIEM 检测规则,对任何蜜标交互进行告警。
# Using the Python detection agent
from agent import ADHoneytokenMonitor
monitor = ADHoneytokenMonitor(config_path="honeytoken_config.json")
# Register all honeytokens for monitoring
monitor.register_honeytoken("svc_sqlbackup_legacy", token_type="admin_account")
monitor.register_honeytoken("MSSQLSvc/sql-legacy-bak01.corp.example.com:1433", token_type="spn")
monitor.register_honeytoken("admin_maintenance", token_type="gpo_credential")
# Generate SIEM detection rules
splunk_rules = monitor.generate_detection_rules(siem="splunk")
sentinel_rules = monitor.generate_detection_rules(siem="sentinel")
sigma_rules = monitor.generate_detection_rules(siem="sigma")
for rule in sigma_rules:
print(f"Rule: {rule['title']}")
print(f" Detection: {rule['detection_logic']}")
第 6 步:验证部署
测试蜜罐令牌,确保检测能够正确触发。
# Validate honeytoken deployment
$validation = Test-HoneytokenDeployment `
-SamAccountName "svc_sqlbackup_legacy" `
-ValidateAdminCount `
-ValidateSPN `
-ValidateGPODecoy `
-ValidateAuditPolicy
$validation | Format-Table Check, Status, Details -AutoSize
示例
完整部署流水线
Import-Module .\scripts\Deploy-ADHoneytokens.ps1
# Deploy complete honeytoken suite
$deployment = Deploy-FullHoneytokenSuite `
-Environment "Production" `
-ServiceAccountOU "OU=Service Accounts,DC=corp,DC=example,DC=com" `
-SYSVOLPath "\\corp.example.com\SYSVOL\corp.example.com\Policies" `
-TokenCount 3 `
-IncludeSPN $true `
-IncludeGPODecoy $true `
-IncludeBloodHoundPath $true `
-SIEMType "Splunk"
# Output deployment report
$deployment.Tokens | Format-Table Name, Type, SPN, DetectionRule -AutoSize
$deployment | Export-Csv "honeytoken_deployment_report.csv" -NoTypeInformation
Kerberoasting 检测查询(Splunk)
index=wineventlog EventCode=4769 ServiceName="svc_sqlbackup_legacy"
| eval alert_severity="critical"
| eval alert_type="honeytoken_kerberoast"
| table _time, src_ip, Account_Name, ServiceName, Ticket_Encryption_Type
| sort - _time
Microsoft Sentinel KQL 检测
SecurityEvent
| where EventID == 4769
| where ServiceName in ("svc_sqlbackup_legacy", "svc_exchange_legacy")
| extend AlertType = "Honeytoken Kerberoast Detected"
| project TimeGenerated, Computer, Account, ServiceName, IpAddress, TicketEncryptionType
参考资料
- Trimarc Security - The Art of the Honeypot Account: https://www.hub.trimarcsecurity.com/post/the-art-of-the-honeypot-account-making-the-unusual-look-normal
- ADSecurity.org - Detecting Kerberoasting Activity Part 2 (Honeypot): https://adsecurity.org/?p=3513
- Microsoft Defender for Identity Honeytokens: https://techcommunity.microsoft.com/blog/microsoftthreatprotectionblog/deceptive-defense-best-practices-for-identity-based-honeytokens-in-microsoft-def/3851641
- SpecterOps - Kerberoasting and AES-256: https://specterops.io/blog/2025/10/21/is-kerberoasting-still-a-risk-when-aes-256-kerberos-encryption-is-enabled/
- APT29a Blog - Deploying Honeytokens in AD: https://apt29a.blogspot.com/2019/11/deploying-honeytokens-in-active.html
- ADSecurity.org - Detecting Kerberoasting Activity: https://adsecurity.org/?p=3458
评论
支持 Markdown