Sqli-labs(一)

SQL注入练习

一些函数与sql语句


![在这里插入图片描述]( https://img-blog.csdnimg.cn/10efada7948b49cdbc4764a9ec35f48f.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA,size_16,color_FFFFFF,t_70)
![在这里插入图片描述]( https://img-blog.csdnimg.cn/98bc469d5a4a4f31b56acd57303123ea.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA
,size_16,color_FFFFFF,t_70)

usr() 用户名
version() 版本
database() 当前数据库名
@@datadir 路径
@@version_compile_os 系统

Mysql5.0以上,自带information_schema数据库,存储着所有数据库的数据库名,表名,列名
information_schema.tables 记录所有表名信息的表
information_schema.colums 记录所有列名信息的表
table_name: 表名
column_name:列名
table_schema: 查数据库名


limit m,n
concat(str1,str2,...)字符串连接
concat_ws(seperator,str1,str2,....)有分隔符的连接

group_concat()
group_concat([DISTINCT] 要连接的字段 [Order BY ASC/DESC 排序字段] [Separator '分隔符'])


substr()
语法:substr(string,start,length)
string - 指定的要截取的字符串。
start - 必需,规定在字符串的何处开始。


ascii() 查询ascii码
chr() 转换字符
select chr(38) from dual 输出:&
select ASCII('&') from dual 输出:38


mid()
MID 函数用于从文本字段中提取字符
SELECT MID(column_name,start[,length]) FROM table_name
column_name 必需。要提取字符的字段。
start 必需。规定开始位置(起始值是 1)。
length 可选。要返回的字符数。如果省略,则 MID() 函数返回剩余文本


if()
IF(expr1,expr2,expr3)
如果 expr1 是TRUE (expr1 <> 0 and expr1 <> NULL),则 IF()的返回值为expr2; 否则返回值则为 expr3。IF() 的返回值为数字值或字符串值,具体情况视其所在语境而定。
例:
If(ascii(substr(databse(),1,1)=115,1,sleep(22)))盲注测试


rand()
RAND函数被调用产生0和1之间的一个随机数


floor()
函数返回小于或等于指定值(value)的最小整数,取整
select floor(103.56) from dual ---103
select floor(103.46) from dual ---103


sleep(num)
延缓num后做出响应


count()
count(column_name) 函数返回指定列的值的数目(NULL 不计入)
COUNT(*) 函数返回表中的记录数
COUNT(DISTINCT column_name) 函数返回指定列的不同值的数目


length(str)
返回字符串str的长度,以字节为单位


Union Select ..... Into outfile” “ 写入后门

Union select “” into outfile “d:\..........”#


Union select 1,unhex(hex(usermname)),3 from admin
解决网站编码不一致


Updatexml(xml文档名称,xpath字符串,替换查找到的符合条件的数据)
Updatexml(1,SQL,2)



less-1 单引号

使用单引号来进行闭合
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719073229413.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA,size_16,color_FFFFFF,t_70)
判断列数
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719073337362.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA
,size_16,color_FFFFFF,t_70)
![在这里插入图片描述]( https://img-blog.csdnimg.cn/202107190734091.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA,size_16,color_FFFFFF,t_70)
报错
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719073531691.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA
,size_16,color_FFFFFF,t_70)
查询
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719073637394.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA,size_16,color_FFFFFF,t_70)
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719074044352.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA
,size_16,color_FFFFFF,t_70)
查数据库
![在这里插入图片描述]( https://img-blog.csdnimg.cn/2021071908172674.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA,size_16,color_FFFFFF,t_70)
查表名
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719081846406.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA
,size_16,color_FFFFFF,t_70)
查列名
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719082001326.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA,size_16,color_FFFFFF,t_70)
查数据
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719082127785.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA
,size_16,color_FFFFFF,t_70)

Less-2 数字型

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719082416661.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-3 单引号 括号

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719082508502.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-4 双引号 括号

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719093018851.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-5 单引号 盲注

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719093425579.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA,size_16,color_FFFFFF,t_70)
配合bp爆破出数据库名
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719093619276.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA
,size_16,color_FFFFFF,t_70)
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719094009302.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA,size_16,color_FFFFFF,t_70)
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719094409302.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA
,size_16,color_FFFFFF,t_70)
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719094856593.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-6 报错注入

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719095124874.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-7 写入webshell

文件夹要有相应的权限
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719095256494.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-8 盲注

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719095626777.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-9 时间盲注

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719095847509.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-10 时间盲注

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719100010527.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-11 POST 报文 注入 或者 万能密码

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719100232975.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719100332568.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA,size_16,color_FFFFFF,t_70)
在这里插入图片描述
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719100757437.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA
,size_16,color_FFFFFF,t_70)

Less-12 与11 一样思路

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719101329528.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-13

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719101901706.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA,size_16,color_FFFFFF,t_70)
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719101920992.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA
,size_16,color_FFFFFF,t_70)

Less-14 双引号 万能密码

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719102113209.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-15 单引号

![在这里插入图片描述]( https://img-blog.csdnimg.cn/2021071910225997.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-16

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719125409651.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)

Less-17

注入点在passswd
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Less-18

HTTP头注入
User -agent注入
在这里插入图片描述

在这里插入图片描述

Less-19 refer 注入

在这里插入图片描述
在这里插入图片描述

Less-20 cookie注入

![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719133957910.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA==,size_16,color_FFFFFF,t_70)
在这里插入图片描述
在这里插入图片描述

Less-21 cookie处注入,’)闭合

Base64加密admin1')and extractvalue(1,concat(0x7e,(select @@basedir),0x7e))#
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719134137815.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA,size_16,color_FFFFFF,t_70)
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210719134146425.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjU5NTczOA
,size_16,color_FFFFFF,t_70)

posted @ 2021-07-30 17:02  1ucifer  阅读(82)  评论(0)    收藏  举报