首页 -> 安全研究

安全研究

安全漏洞
PHP-Nuke绕过SQL注入保护及多个SQL注入漏洞

发布日期:2007-04-17
更新日期:2007-04-19

受影响系统:
PHP-Nuke PHP-Nuke <= 8.0.0.3.3b
描述:
BUGTRAQ  ID: 23528

PHP-Nuke是一个广为流行的网站创建和管理工具,它可以使用很多数据库软件作为后端,比如MySQL、PostgreSQL、mSQL、Interbase、Sybase等。

PHP-Nuke实现上存在多个SQL注入漏洞,远程攻击者可能利用这些漏洞非授权操作数据库。

在mainfile.php文件中435行:
__________________________________________

  //Union Tap
  //Copyright Zhen-Xjell 2004 http://nukecops.com
  //Beta 3 Code to prevent UNION SQL Injections
  unset($matches);
  unset($loc);
  if(isset($_SERVER['QUERY_STRING'])) {
    if (preg_match("/([OdWo5NIbpuU4V2iJT0n]{5}) /", \
rawurldecode($loc=$_SERVER['QUERY_STRING']), $matches)) {  die('Illegal Operation \
1');  }
  }
  if(!isset($admin) OR (isset($admin) AND !is_admin($admin))) {
    $queryString = $_SERVER['QUERY_STRING'];
    if (($_SERVER['PHP_SELF'] != "/index.php") OR !isset($url))
    {
       if (stristr($queryString,'http://')) die('Illegal Operation 2');
    }
    if ((stristr($queryString,'%20union%20')) OR (stristr($queryString,'/*')) OR \
(stristr($queryString,'*/union/*')) OR (stristr($queryString,'c2nyaxb0')) OR \
(stristr($queryString,'+union+'))  OR ((stristr($queryString,'cmd=')) AND \
(!stristr($queryString,'&cmd'))) OR ((stristr($queryString,'exec')) AND \
(!stristr($queryString,'execu'))) OR (stristr($queryString,'concat'))) {  \
die('Illegal Operation 3');  }
  }__________________________________________

攻击者可以通过不同的过滤器绕过对SQL注入的保护。


此外Web_Links、News和Download模块中还存在多个SQL注入漏洞:

+++++++++++++++++++++++++++

PHP.ini
Magic Quotes = OFF
Register Global = ON
+++++++++++++++++++++++++++

Web_Links/index.php文件中有漏洞的函数如下:

function viewlinkcomments($lid) {
    global $prefix, $db, $admin, $bgcolor2, $module_name, $admin_file;
    include("header.php");
    include("modules/$module_name/l_config.php");
    menu(1);
    $row = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_links_links \
WHERE lid='$lid'")); // BUG ---> $lid  $ttitle = filter($row['title'], "nohtml");
    $lid = intval(trim($lid)); //WTF?<===== lol ??????????????? :):):):):)
    echo "<br>";
...
__________________________________________________

function viewlinkcomments($lid) {
function viewlinkeditorial($lid){
function viewlinkcomments($lid){
function ratelink($lid, $user) {

$lid变量没有经过过滤,因此攻击者可以执行任意sql命令。


Downloads模块中有漏洞函数:

function viewdownloadeditorial($lid) {
function viewdownloadcomments($lid) {
function ratedownload($lid, $user) {

$lid变量没有经过过滤。


News模块中有漏洞函数:

function rate_complete($sid, $rated=0, $score) {

$sid变量没有经过过滤。

<*来源:Aleksandar (programmer@serbiansite.com
  
  链接:http://marc.info/?l=bugtraq&m=117682612903627&w=2
        http://secunia.com/advisories/24949/
*>

测试方法:

警 告

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

http://www.example.com/nuke/?%2f*
http://www.example.com/html80/?%2f**/UNION%2f**/SELECT

建议:
厂商补丁:

PHP-Nuke
--------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:

http://phpnuke.org/

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