mirror of
https://github.com/Mr-xn/Penetration_Testing_POC.git
synced 2025-07-09 16:05:40 +00:00
72 lines
2.5 KiB
Markdown
72 lines
2.5 KiB
Markdown
## 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
|
||
```
|
||
|
||
**漏洞缓解方法**
|
||
|
||
- 注:在powershell下禁止或者开启即可缓解
|
||
|
||
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 |