OpenEMR Script Insertion and SQL Injection Vulnerabilities
Description
Nate Drier has discovered multiple vulnerabilities in OpenEMR, which can be exploited by malicious users to conduct SQL injection attacks and by malicious people to conduct script insertion attacks.
1) Input passed via the "note" POST parameter to /interface/main/onotes/office_comments_full.php (when "mode" is set to "new") 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 the context of an affected site if malicious data is viewed.
2) Input passed via the "start" and "end" POST parameters to /interface/reports/custom_report_range.php and via the "form_newid" POST parameter to /custom/chart_tracker.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.
The vulnerabilities are confirmed in version 4.1.1 patch-12. Prior versions may also be affected.