2020-03-12 11:13:50 +08:00
|
|
|
|
## CVE-2020–0796检测与修复
|
|
|
|
|
|
|
|
|
|
漏洞影响版本:
|
|
|
|
|
|
|
|
|
|
Windows 10版本1903(用于32位系统)
|
|
|
|
|
Windows 10版本1903(用于基于ARM64的系统)
|
|
|
|
|
Windows 10版本1903(用于基于x64的系统)
|
|
|
|
|
Windows 10版本1909(用于32位系统)
|
|
|
|
|
Windows 10版本1909(用于基于ARM64的系统)
|
|
|
|
|
Windows 10版本1909(用于)基于x64的系统
|
|
|
|
|
Windows Server 1903版(服务器核心安装)
|
|
|
|
|
Windows Server 1909版(服务器核心安装)
|
|
|
|
|
|
|
|
|
|
**漏洞检测工具**
|
|
|
|
|
|
|
|
|
|
python版本
|
|
|
|
|
|
|
|
|
|
来源:https://github.com/ollypwn/SMBGhost/blob/master/scanner.py
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
import socket
|
|
|
|
|
import struct
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
pkt = b'\x00\x00\x00\xc0\xfeSMB@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$\x00\x08\x00\x01\x00\x00\x00\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00x\x00\x00\x00\x02\x00\x00\x00\x02\x02\x10\x02"\x02$\x02\x00\x03\x02\x03\x10\x03\x11\x03\x00\x00\x00\x00\x01\x00&\x00\x00\x00\x00\x00\x01\x00 \x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\n\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00'
|
|
|
|
|
sock = socket.socket(socket.AF_INET)
|
|
|
|
|
sock.settimeout(3)
|
|
|
|
|
sock.connect(( sys.argv[1], 445 ))
|
|
|
|
|
sock.send(pkt)
|
|
|
|
|
|
|
|
|
|
nb, = struct.unpack(">I", sock.recv(4))
|
|
|
|
|
res = sock.recv(nb)
|
|
|
|
|
|
|
|
|
|
if not res[68:70] == b"\x11\x03":
|
|
|
|
|
exit("Not vulnerable.")
|
|
|
|
|
if not res[70:72] == b"\x02\x00":
|
|
|
|
|
exit("Not vulnerable.")
|
|
|
|
|
|
|
|
|
|
exit("Vulnerable.")
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
nmap版本:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
if [ $# -eq 0 ]
|
|
|
|
|
then
|
|
|
|
|
echo $'Usage:\n\tcheck-smb-v3.11.sh TARGET_IP_or_CIDR {Target Specification - Nmap}'
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "Checking if there's SMB v3.11 in" $1 "..."
|
|
|
|
|
|
|
|
|
|
nmap -p445 --script smb-protocols -Pn -n $1 | grep -P '\d+\.\d+\.\d+\.\d+|^\|.\s+3.11' | tr '\n' ' ' | tr 'Nmap scan report for' '@' | tr "@" "\n" | tr '|' ' ' | tr '_' ' ' | grep -oP '\d+\.\d+\.\d+\.\d+'
|
|
|
|
|
|
|
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
|
echo "There's no SMB v3.11"
|
|
|
|
|
fi
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**漏洞缓解方法**
|
|
|
|
|
|
2020-03-12 11:32:28 +08:00
|
|
|
|
- 注:在powershell下禁止或者开启即可缓解
|
|
|
|
|
|
2020-03-12 11:13:50 +08:00
|
|
|
|
Disable compression:
|
|
|
|
|
|
|
|
|
|
> Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters” DisableCompression -Type DWORD -Value 1 -Force
|
|
|
|
|
|
|
|
|
|
Enable compression:
|
|
|
|
|
|
|
|
|
|
> Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters” DisableCompression -Type DWORD -Value 0 -Force
|