AfterLogic WebMail最新版任意文件包含

暗月博客 2019年11月21日20:54:33评论892 views字数 2039阅读6分47秒阅读模式
摘要

AfterLogic Web Mail任意文件包含,包括最新版,和老版本都存在这个问题,无需登录。

简要描述:

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版本就没办法进行截断了

漏洞证明:

AfterLogic WebMail最新版任意文件包含

当然这里可以利用重装,然后登陆上传文件拿到shell

修复方案:

安装文成后自动删除install,或者进行instal.lock判断

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
暗月博客
  • 本文由 发表于 2019年11月21日20:54:33
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   AfterLogic WebMail最新版任意文件包含http://cn-sec.com/archives/72608.html

发表评论

匿名网友 填写信息