OSCAR EMR 15.21beta361 XSS / Disclosure / CSRF / Insecure Direct Object Reference

OSCAR EMR version 15.21beta361 suffers from remote code execution, cross site request forgery, cross site scripting, denial of service, deserialization, remote SQL injection, and path traversal vulnerabilities.

MD5 | 6823c6acccafa60cd8d4e4359d2ae81f

Title: Multiple vulnerabilities in OSCAR EMR
Product: OSCAR EMR
Vendor: Oscar McMaster
Tested version: 15.21beta361
Remediation status: Unknown
Reported by: Brian D. Hysell


Product Description:

"OSCAR is open-source Electronic Medical Record (EMR) software that
was first developed at McMaster University by Dr. David Chan. It is
continuously enriched by contributions from OSCAR users and the
Charter OSCAR Service Providers that support them. OSCAR has been
certified by OntarioMD, and verified as IHE compliant, achievements
made possible by the creation and success of OSCAR EMRas ISO
13485:2003 certified Quality Management System."



29 Mar 2016 - Vendor contacted
29 Mar 2016 - Vendor responded
29 Apr 2016 - Vendor contacted for permission to share redacted report
with third party
02 May 2016 - Vendor responded
17 Jan 2017 - Lead developer contacted (no response)
01 Jul 2018 - Vendor and lead developer contacted for follow-up,
informed of intended 15 Aug disclosure (no response)
12 Aug 2018 - Alternate email address attempted for lead developer (no response)
15 Aug 2018 - Vulnerabilities publicly disclosed



This report uses OVE identifiers: http://www.openwall.com/ove/

OVE-20160329-0001: Database backup disclosure or denial of service via
insecure dependency
OVE-20160329-0003: Remote code execution via unsafe object deserialization
OVE-20160329-0004: Stored cross-site scripting (XSS) vulnerability in
security report interface
OVE-20160329-0007: SQL injection
OVE-20160329-0008: Path traversal
OVE-20160329-0002: Insecure direct object reference in document manager
OVE-20160329-0005: Denial of service via resource exhaustion
OVE-20160329-0006: Insecure password storage
OVE-20160329-0009: Cross-site request forgery


Issue details:

=== OVE-20160329-0001: Database backup disclosure or denial of service
via insecure dependency ===

OSCAR uses a version of Apache Struts, 1.2.7, which is vulnerable to

An authenticated user can issue the following request with different /
omitted cookie headers:

Consequently, he or she can access (using a valid session cookie),
e.g., /oscar/OscarBackup.sql.gz

An unauthenticated attacker is prevented from doing likewise by the
aLoginFiltera servlet filter, but can still carry out a
denial-of-service attack impeding any access to the application until
Tomcat is restarted by issuing a request like the following:

=== OVE-20160329-0003: Remote code execution via unsafe object
deserialization ===

TraceabilityReportProcessor deserializes user-provided data, allowing
remote code execution given the presence of known-vulnerable libraries
in the classpath such as ROME 1.0. This functionality is only
available to administrators but can be exploited via XSS
(OVE-20160329-0004) or CSRF (issue 9) using a payload generated with

In the tested configuration PMmodule/GenericIntake/ImportForm.jsp is
inaccessible due to the following exception
aorg.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'oscarSecurityManager' is defineda, but were it to be
accessible, it would be vulnerable as well.

=== OVE-20160329-0004: Stored cross-site scripting (XSS) vulnerability
in security report interface ===

logReport.jsp, in general, does not escape data it outputs to the
page; in particular, on line 283, prop.getProperty("contentId") is
printed unescaped. As a result, if an attacker includes Javascript in
his or her username during a login attempt, it will be executed if an
administrator views the Security Log Report for that timeframe. The
text printed in the "Keyword" column is cut off at 80 characters, but
that is more than enough to load an externally-hosted script, such as
the following script exploiting the deserialization RCE

var decodedBase64 =
var binaryArray = new Uint8Array(new ArrayBuffer(decodedBase64.length));
for(var i = 0; i < binaryArray.length; i++) {
binaryArray[i] = decodedBase64.charCodeAt(i);
var payload = new Blob([binaryArray], {type: "application/x-gzip"});
var formData = new FormData();
formData.append("file", payload);
formData.append("submit", "Generate");
var xhr = new XMLHttpRequest();
xhr.open("POST", "/oscar/admin/GenerateTraceabilityReportAction.do");

XSS was not a focus of this test; other confirmed or likely XSS
vulnerabilities are:
* Reflected XSS through the errormsg parameter in loginfailed.jsp
* Reflected XSS through the signatureRequestId parameter in tabletSignature.jsp
* Reflected XSS through the noteId parameter, line 1562 in
CaseManagementViewAction (untested)
* Reflected XSS through the pdfName parameter when an exception has
been thrown, line 1174 in ManageDocumentAction (untested)
* Reflected XSS through the pharmaName and pharmaFax parameters, line
149 in FrmCustomedPDFServlet (untested)
* Reflected XSS through the id and followupValue parameters, line 81
in EctAddShortMeasurementAction (untested)

=== OVE-20160329-0007: SQL injection ===

On line 239 of oscarMDS/PatientSearch.jsp, the orderby parameter is
concatenated into an SQL statement rather than parameterized; likewise
the content parameter on lines 217, 223, and 229 of
admin/logReport.jsp. In both cases these errors result in error-based
SQL injection vulnerabilities; the former allows authenticated users
with access to oscarMDS/PatientSearch.jsp to access information beyond
their privilege levels while the latter is accessible only to

=== OVE-20160329-0008: Path traversal ===

ImportLogDownloadAction reads and outputs an arbitrary absolute file
path provided by the user; DelImageAction deletes a user-specified
filename without accounting for the possibility of relative path
traversal (i.e., the inclusion of "../" in the filename).

Any authenticated user can exploit the former issue to steal files
from the system, e.g.,

An authenticated user with access to eforms can delete files writeable
by the Tomcat user, e.g.,

=== OVE-20160329-0002: Insecure direct object reference in document manager ===

ManageDocumentAction.display() does not check the permissions
associated with the requested document ID (doc_no) before providing it
to the requesting user. Given
/oscar/dms/ManageDocument.do?method=display&doc_no=X&providerNo=Y, a
user with access to the document management interface can view
arbitrary documents by incrementing or decrementing X, regardless of
whether they have been marked private.

=== OVE-20160329-0005: Denial of service via resource exhaustion ===

uploadSignature.jsp, which is accessible to and operable by
unauthenticated users, saves uploaded files to a temporary directory
but never deletes them. An attacker can upload many junk files and
eventually consume all disk space available to the /tmp directory,
impeding access to the application depending on the functionality in
question and the partition layout of the host system (the effects are
crippling and pervasive if /tmp is on the same partition as /; they
are much less so if /tmp is on a separate partition).

=== OVE-20160329-0006: Insecure password storage ===

Passwords are stored as SHA-1 hashes; unless unusually complex,
passwords stored in that manner are typically easily recoverable with
a tool such as oclHashcat. In OSCAR each hash is stored as a string of
decimal numbers, rather than hexadecimal or raw bytes. This somewhat
non-traditional representation adds a bit of programming work to the
cracking process, but does not represent a major impediment to attack.

=== OVE-20160329-0009: Cross-site request forgery ===

The application lacks protection against cross-site request forgery
attacks. A CSRF attack could be used against an administrator to
exploit the deserialization RCE in a manner similar to the example
provided with OVE-20160329-0004.

Related Posts