首页 -> 安全研究

安全研究

安全漏洞
PHPSlash任意帐号权限提升漏洞

发布日期:2005-07-08
更新日期:2005-07-08

受影响系统:
PHPSlash PHPSlash 0.8
PHPSlash PHPSlash 0.7.2
PHPSlash PHPSlash 0.7.1
PHPSlash PHPSlash 0.6.1
PHPSlash PHPSlash 0.5.32
不受影响系统:
PHPSlash PHPSlash 0.8.1
描述:
BUGTRAQ  ID: 14189

phpSlash是用PHP编写的CMS,可以方便的发表基于社区的网站。

phpSlash的Author.class::saveProfile中存在输入验证错误,允许攻击者通过劫持用户帐号获得root用户权限。

<?
   /* Code extracted from Author.class */

   function saveProfile($ary) {

      global $HTTP_COOKIE_VARS;

      // (  ... snip ... )

/********************************************************************
*  This sql query is using data from an untrusted source ( $ary )   *
********************************************************************/

      $this->db->query("SELECT author_id
                        FROM psl_author
                        WHERE author_id = '".$ary['author_id']."'");

/********************************************************************
* This condition is not relevant in that context, it is the current *
* author_id (from $this->auth) that should eventually be compared   *
********************************************************************/

      if ($this->db->next_record()) {
         if ($ary['password'] == "") {
            $q  = "UPDATE psl_author
                      SET author_name     = '$ary[author_name]',
                          author_realname = '$ary[author_realname]',
                          url      = '$ary[url]',
                          email    = '$ary[email]',
                          quote    = '$ary[quote]',
                          author_options = '$serial_opts'
                    WHERE author_id   = '$ary[author_id]'";
                    // use $this->auth->auth['uid'] instead of untrusted $ary
         } else {
            $q  = "UPDATE psl_author
                   SET author_name     = '$ary[author_name]',
                       author_realname = '$ary[author_realname]',
                       url      = '$ary[url]',
                       email    = '$ary[email]',
                       quote    = '$ary[quote]',
                      password = MD5('$ary[author_name]:$ary[password]'),
                       author_options = '$serial_opts'
                 WHERE author_id   = '$ary[author_id]'";

             /************************************************************/
             // use $this->auth->auth['uid'] and $this->auth->auth['uname']
             // instead of untrusted $ary
             /************************************************************/
         }
      }

      // (  ... snip ... )

   }

?>

成功利用这个漏洞的攻击者可以控制任意帐号。

<*来源:tobozo (tobozo@phpsecure.info)
        crashfr (crashfr@sysdream.com
  
  链接:http://marc.theaimsgroup.com/?l=bugtraq&m=112076117708139&w=2
*>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

可以通过以下步骤劫持帐号:

- 注册帐号
- 登录
- 确认可以更新profile
- 将profile.php中的HTML源码拷贝至硬盘并编辑
- 设置<form>中的目标值匹配站点的url
- 更改输入字段author-name的值匹配目标用户的author_name
- 更改输入字段author_id的值匹配目标用户的author_id
- 在浏览器中打开html文件
- 输入期望的口令(两次)
- 提交表单
- 注销
- 以目标用户的author_name和之前选定的口令登录

建议:
厂商补丁:

PHPSlash
--------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载0.8.1版本:

http://prdownloads.sourceforge.net/phpslash/phpslash-0.8.1.tar.gz?download

浏览次数:3510
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障