Skip to content

Commit 45f758f

Browse files
authored
Add files via upload
0 parents  commit 45f758f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+5741
-0
lines changed

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 shadow1ng
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Plugins/CVE-2020-0796.go

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
package Plugins
2+
3+
import (
4+
"bytes"
5+
"fmt"
6+
"time"
7+
8+
"github.com/shadow1ng/fscan/common"
9+
)
10+
11+
const (
12+
pkt = "\x00" + // session
13+
"\x00\x00\xc0" + // legth
14+
15+
"\xfeSMB@\x00" + // protocol
16+
17+
//[MS-SMB2]: SMB2 NEGOTIATE Request
18+
//https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/e14db7ff-763a-4263-8b10-0c3944f52fc5
19+
20+
"\x00\x00" +
21+
"\x00\x00" +
22+
"\x00\x00" +
23+
"\x00\x00" +
24+
"\x1f\x00" +
25+
"\x00\x00\x00\x00" +
26+
"\x00\x00\x00\x00" +
27+
"\x00\x00\x00\x00" +
28+
"\x00\x00\x00\x00" +
29+
"\x00\x00\x00\x00" +
30+
"\x00\x00\x00\x00" +
31+
"\x00\x00\x00\x00" +
32+
"\x00\x00\x00\x00" +
33+
"\x00\x00\x00\x00" +
34+
"\x00\x00\x00\x00" +
35+
"\x00\x00\x00\x00" +
36+
"\x00\x00\x00\x00" +
37+
38+
// [MS-SMB2]: SMB2 NEGOTIATE_CONTEXT
39+
// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/15332256-522e-4a53-8cd7-0bd17678a2f7
40+
41+
"$\x00" +
42+
"\x08\x00" +
43+
"\x01\x00" +
44+
"\x00\x00" +
45+
"\x7f\x00\x00\x00" +
46+
"\x00\x00\x00\x00" +
47+
"\x00\x00\x00\x00" +
48+
"\x00\x00\x00\x00" +
49+
"\x00\x00\x00\x00" +
50+
"x\x00" +
51+
"\x00\x00" +
52+
"\x02\x00" +
53+
"\x00\x00" +
54+
"\x02\x02" +
55+
"\x10\x02" +
56+
"\x22\x02" +
57+
"$\x02" +
58+
"\x00\x03" +
59+
"\x02\x03" +
60+
"\x10\x03" +
61+
"\x11\x03" +
62+
"\x00\x00\x00\x00" +
63+
64+
// [MS-SMB2]: SMB2_PREAUTH_INTEGRITY_CAPABILITIES
65+
// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/5a07bd66-4734-4af8-abcf-5a44ff7ee0e5
66+
67+
"\x01\x00" +
68+
"&\x00" +
69+
"\x00\x00\x00\x00" +
70+
"\x01\x00" +
71+
"\x20\x00" +
72+
"\x01\x00" +
73+
"\x00\x00\x00\x00" +
74+
"\x00\x00\x00\x00" +
75+
"\x00\x00\x00\x00" +
76+
"\x00\x00\x00\x00" +
77+
"\x00\x00\x00\x00" +
78+
"\x00\x00\x00\x00" +
79+
"\x00\x00\x00\x00" +
80+
"\x00\x00\x00\x00" +
81+
"\x00\x00" +
82+
83+
// [MS-SMB2]: SMB2_COMPRESSION_CAPABILITIES
84+
// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/78e0c942-ab41-472b-b117-4a95ebe88271
85+
86+
"\x03\x00" +
87+
"\x0e\x00" +
88+
"\x00\x00\x00\x00" +
89+
"\x01\x00" + //CompressionAlgorithmCount
90+
"\x00\x00" +
91+
"\x01\x00\x00\x00" +
92+
"\x01\x00" + //LZNT1
93+
"\x00\x00" +
94+
"\x00\x00\x00\x00"
95+
)
96+
97+
func SmbGhost(info *common.HostInfo) error {
98+
if common.IsBrute {
99+
return nil
100+
}
101+
err := SmbGhostScan(info)
102+
return err
103+
}
104+
105+
func SmbGhostScan(info *common.HostInfo) error {
106+
ip, port, timeout := info.Host, 445, time.Duration(common.Timeout)*time.Second
107+
addr := fmt.Sprintf("%s:%v", info.Host, port)
108+
conn, err := common.WrapperTcpWithTimeout("tcp", addr, timeout)
109+
defer func() {
110+
if conn != nil {
111+
conn.Close()
112+
}
113+
}()
114+
if err != nil {
115+
return err
116+
}
117+
_, err = conn.Write([]byte(pkt))
118+
if err != nil {
119+
return err
120+
}
121+
buff := make([]byte, 1024)
122+
err = conn.SetReadDeadline(time.Now().Add(timeout))
123+
n, err := conn.Read(buff)
124+
if err != nil {
125+
return err
126+
}
127+
if bytes.Contains(buff[:n], []byte("Public")) == true {
128+
result := fmt.Sprintf("[+] %v CVE-2020-0796 SmbGhost Vulnerable", ip)
129+
common.LogSuccess(result)
130+
131+
}
132+
return err
133+
}

0 commit comments

Comments
 (0)