### 简要描述:
今天看到发布了2.1就去下载了个看看。
但是还是有洞没补。
### 详细说明:
\app\article\action\admin\cate.php
这文件在admin目录下 是为了让是管理才能访问的?
但是我自己在前台注册了一个用户, 可以直接访问到。
难道这是传说中的越权?
```
case "edit_do":
$cateid = intval($_POST['cateid']);
$catename = tsClean($_POST['catename']);
$new['article']->update('article_cate',array(
'cateid'=>$cateid,
),array(
'catename'=>$catename,
'orderid'=>intval($_POST['orderid']),
));
header("Location: ".SITE_URL."index.php?app=article&ac=admin&mg=cate&ts=list");
break;
}
```
```
function tsClean($text) {
$text = cleanJs ( $text );
return $text;
}
```
```
function cleanJs($text) {
$text = trim ( $text );
$text = stripslashes ( $text );
// 完全过滤注释
$text = preg_replace ( '/<!--?.*-->/', '', $text );
// 完全过滤动态代码
$text = preg_replace ( '/<\?|\?>/', '', $text );
// 完全过滤js
$text = preg_replace ( '/<script?.*\/script>/', '', $text );
// 过滤多余html
$text = preg_replace ( '/<\/?(html|head|meta|link|base|body|title|style|script|form|iframe|frame|frameset)[^><]*>/i', '', $text );
// 过滤on事件lang js
while ( preg_match ( '/(<[^><]+)(lang|data|onfinish|onmouse|onexit|onerror|onclick|onkey|onload|onchange|onfocus|onblur)[^><]+/i', $text, $mat ) ) {
$text = str_replace ( $mat [0], $mat [1], $text );
}
while ( preg_match ( '/(<[^><]+)(window\.|javascript:|js:|about:|file:|document\.|vbs:|cookie)([^><]*)/i', $text, $mat ) ) {
$text = str_replace ( $mat [0], $mat [1] . $mat [3], $text );
}
return $text;
}
```
正如这函数的名称, 只是cleanjs
然后带入update。row未过滤。
### 漏洞证明:
首先先新建一个分类。用于回显。
```
case "add_do":
$new['article']->create('article_cate',array(
'catename'=>tsClean($_POST['catename']),
'orderid'=>intval($_POST['orderid']),
));
header("Location: ".SITE_URL."index.php?app=article&ac=admin&mg=cate&ts=list");
break;
```
然后
[<img src="https://images.seebug.org/upload/201402/15172808493413a022d21e1e68a2a05f06520431.jpg" alt="1.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201402/15172808493413a022d21e1e68a2a05f06520431.jpg)
然后再访问 http://127.0.0.1/thinksaas/index.php?app=article&ac=admin/cate&ts=list
[<img src="https://images.seebug.org/upload/201402/15172905e43fd057fe2b0291d1c4a0e8e7e9fc37.jpg" alt="2.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201402/15172905e43fd057fe2b0291d1c4a0e8e7e9fc37.jpg)
成功 有图 有真相。
暂无评论