← Advisories

OpenEMR 4.1.1 (ofc_upload_image.php) Arbitrary File Upload Vulnerability

High
Advisory ID
ZSL-2013-5126
Release Date
13 February 2013
Vendor
Affected Version
4.1.1
CVE
N/A
Tested On
Microsoft Windows 7 Ultimate SP1 (EN), Fedora Linux, Apache2, PHP 5.4 MySQL 5.5
Summary

OpenEMR is a Free and Open Source electronic health records and medical practice management application that can run on Windows, Linux, Mac OS X, and many other platforms.

Description

The vulnerability is caused due to the improper verification of uploaded files in '/library/openflashchart/php-ofc-library/ofc_upload_image.php' script thru the 'name' parameter. This can be exploited to execute arbitrary PHP code by uploading a malicious PHP script with multiple extensions.

/library/openflashchart/php-ofc-library/ofc_upload_image.php: ---------------------- 21: $default_path = '../tmp-upload-images/'; 23: if (!file_exists($default_path)) mkdir($default_path, 0777, true); 26: $destination = $default_path . basename( $_GET[ 'name' ] ); 28: echo 'Saving your image to: '. $destination; 39: $jfh = fopen($destination, 'w') or die("can't open file"); 40: fwrite($jfh, $HTTP_RAW_POST_DATA); 41: fclose($jfh); 46: exit();
Proof of Concept
Disclosure Timeline
14.02.2013Vendor releases patch 4.1.1-Patch-10 to address this issue.
Credits
Vulnerability discovered by Gjoko Krstic
References
Changelog
13.02.2013Initial release
14.02.2013Added vendor status and reference [2], [3], [4] and [5]
15.02.2013Added reference [6], [7] and [8]
20.02.2013Added reference [9], [10] and [11]
05.10.2014Added reference [12] and [13]
08.10.2014Added reference [14]
19.05.2015Added reference [15]