一次SQL盲注记录

背景:遇到一个sql注入,数字型布尔盲注+waf(直接超时那种),只要能出用户名,数据库名即可。

解决办法:

因为可以只要能出user(),database()即可,所以用不着SELECT,那么问题就简单很多了。

我这里用的是mysql,https://dev.mysql.com/doc/refman/5.7/en/string-functions.html 直接去字符串函数里面找一些平时网上的生僻函数即可。

找到个LOCATE函数:

LOCATE(substr,str), LOCATE(substr,str,pos)

The first syntax returns the position of the first occurrence of substring substr in string str. The second syntax returns the position of the first occurrence of substring substr in string str, starting at position pos. Returns 0 if substr is not in str. Returns NULL if substr or str is NULL.

  在注入中用法如下:

 这种数字型注入,可以将我们的结果当做where的条件。可以避免使用and,or等连接符。

对于字符型注入呢?

字符型注入是必须使用连接符的,除开and,or,还有就是异或(xor,^)。

真 ^ 真=假,假 ^ 假 = 假,真 ^ 假 =真

利用如下:

当前面能出数据的时候,后面那一条不能出数据,哪一条就是我们要的了。

注意:由于^的优先级比=高,所以需要用括号把后面的结果括起来。

除了^还可以用+,-这类算数运算符。例如:

当字符和数字比较的时候,将字符转为数字在比较。

截取可以使用:substr,substring这种常规的,也可以使用left,right的组合:

原文地址:https://www.cnblogs.com/xiaozhiru/p/13059752.html