简要描述:
AfterLogic WebMail任意文件包含,包括最新版,和老版本都存在这个问题,无需登录。
详细说明:
AfterLogic WebMail最新版7.6.0的版本为例进行测试
AfterLogic WebMail在安装后默认是不会删除install目录的
所以这里你也可以重装,设置自己的mailserver,进行各种操作
在安装过程中存在设计缺陷导致无需登录,即可进行任意文件包含
文件/install/index.php:
code 区域
<?php /* * Copyright 2004-2015, AfterLogic Corp. * Licensed under AGPLv3 license or AfterLogic license * if commercial version of the product was purchased. * See the LICENSE file for a full license statement. */ defined('WM_INSTALLER_PATH') || define('WM_INSTALLER_PATH', (dirname(__FILE__).'/')); include WM_INSTALLER_PATH.'installer.php'; $oInstaller = new CInstaller(); $oInstaller->Run();
跟进/install/installer.php:
code 区域
$this->_sState = isset($_GET['step']) ? $_GET['step'] : 'index'; $this->_aMenu = array( 'compatibility', 'license', 'license-key', 'db', 'dav', 'admin-panel', 'email-server-test', 'completed' ); function Run() { if (isset($_GET['post'])) { $this->Post(); exit(); } if ('index' === $this->_sState) { $_SESSION['checksessionindex'] = true; header('Location: index.php?step=compatibility'); exit(); } $sState = in_array($this->_sState, $this->_aMenu) ? $this->_sState : 'compatibility';
当这里是POST请求时会调用POST函数
如果是GET的话就会判断这里的$this->_sState:
code 区域
$sState = in_array($this->_sState, $this->_aMenu) ? $this->_sState : 'compatibility';
所以这里参数$this->_sState被限制,没办法利用,我们看看POST方法:
code 区域
function Post() { $sState = empty($_POST['state']) ? '' : $_POST['state']; if (isset($_POST['back_btn'])) { header('Location: '.'index.php?step='.$this->getBackStep($sState)); } else { $oStepObject = null; if (@file_exists(WM_INSTALLER_PATH.'steps/'.$sState.'.php')) { include_once WM_INSTALLER_PATH.'steps/'.$sState.'.php'; $oCurrentStateStepClass = 'C'.ucfirst(preg_replace('/[^a-z]/', '', $sState)).'Step'; $oStepObject = new $oCurrentStateStepClass; $sUrl = 'index.php?step='.$sState; if ($oStepObject->DoPost()) { $sUrl = 'index.php?step='.$this->getNextStep($sState); } header('Location: '.$sUrl); } else { echo 'State error'; } } }
可以看到这里$sState = empty($_POST['state']) ? '' : $_POST['state'];
然后判断文件是否存在,如果存在就include_once这个文件
在进入include_once的文件中带入了我们可控的变量$sState
所以导致存在包含漏洞
但是这里有点鸡肋,就是需要截断,在5.3.4后的php版本就没办法进行截断了
漏洞证明:
修复方案:
安装文成后自动删除install,或者进行instal.lock判断
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论