OpenEMR Script Insertion and SQL Injection Vulnerabilities
Description
Multiple vulnerabilities have been discovered in OpenEMR, which can be exploited by malicious users to conduct script insertion and SQL injection attacks.
1) Input passed via the "note" and "manufacturer" parameters to interface/patient_file/summary/immunizations.php when adding an immunization note and "note" parameter to interface/patient_file/summary/pnotes_full.php when adding a new note is not properly sanitised before being used. This can be exploited to insert arbitrary HTML and script code, which will be executed in a user's browser session in context of an affected site when the malicious data is being viewed.
2) Input passed via the "issue" parameter to interface/patient_file/summary/add_edit_issue.php, "pc_facility" parameter to interface/main/calendar/index.php, "set_pid" parameter to interface/patient_file/summary/demographics.php, "administered_by_id" parameter to interface/patient_file/summary/immunizations.php, "noteid" and "offset" parameters to interface/patient_file/summary/pnotes_full.php is not properly sanitised before being used in a SQL query. This can be exploited to manipulate SQL queries by injecting arbitrary SQL code.
NOTE: This can further be exploited to conduct cross-site scripting attacks via SQL error messages.
The vulnerabilities are confirmed in version 3.2.0. Other versions may also be affected.
Vulnerable Products
Vulnerable Software: OpenEMR 3.x
Solution
Upgrade to version 4.1.0, which partially fixes vulnerability #1. Edit the source code to ensure that input is properly sanitised.