OpenEMR is a free and open source electronic health records and medical practice management application. Users with the `Notes - my encounters` role can fill Eye Exam forms in patient encounters. The answers to the form are displayed on the encounter page and in the visit history for the users with the same role. Versions prior to 8.0.0.3 have a stored cross-site scripting (XSS) vulnerability in the function to display the form answers, allowing any authenticated attacker with the specific role to insert arbitrary JavaScript into the system by entering malicious payloads to the form answers. The JavaScript code is later executed by any user with the form role when viewing the form answers in the patient encounter pages or visit history. Version 8.0.0.3 contains a patch.
OpenEMR versions prior to 8.0.0.3 contain a stored XSS vulnerability in Eye Exam forms that allows authenticated users with 'Notes - my encounters' role to inject malicious JavaScript. The vulnerability affects all users viewing patient encounters and visit history, potentially compromising patient data confidentiality and enabling lateral movement within healthcare systems. This is particularly critical for Saudi healthcare organizations given the sensitivity of medical records and regulatory requirements.
IMMEDIATE ACTIONS:
1. Identify all OpenEMR instances in your organization and verify current version (check Administration > System > Version)
2. Restrict access to Eye Exam forms to trusted personnel only until patching is complete
3. Review audit logs for suspicious Eye Exam form submissions in the past 90 days
4. Isolate affected systems from critical networks if running versions prior to 8.0.0.3
PATCHING GUIDANCE:
1. Upgrade OpenEMR to version 8.0.0.3 or later immediately
2. Test patches in non-production environment first
3. Backup all patient data before applying patches
4. Verify form rendering after patching to ensure no data loss
COMPENSATING CONTROLS (if immediate patching not possible):
1. Implement Web Application Firewall (WAF) rules to detect and block XSS payloads in form submissions
2. Disable Eye Exam form functionality until patching is complete
3. Implement strict Content Security Policy (CSP) headers: Content-Security-Policy: default-src 'self'; script-src 'self'
4. Enable HTML entity encoding for all form output
5. Implement input validation to reject special characters in form fields
DETECTION RULES:
1. Monitor for form submissions containing: <script>, javascript:, onerror=, onload=, event handlers
2. Alert on Eye Exam form access by users outside normal business hours
3. Track modifications to encounter pages and visit history records
4. Monitor database queries for unusual Eye Exam form data patterns
5. Log all form submissions with user ID, timestamp, and payload content
الإجراءات الفورية:
1. حدد جميع مثيلات OpenEMR في مؤسستك وتحقق من الإصدار الحالي (تحقق من الإدارة > النظام > الإصدار)
2. قيد الوصول إلى نماذج فحص العيون للموظفين الموثوقين فقط حتى اكتمال التصحيح
3. راجع سجلات التدقيق لتقديمات نماذج فحص العيون المريبة في آخر 90 يوماً
4. عزل الأنظمة المتأثرة عن الشبكات الحرجة إذا كانت تعمل بإصدارات سابقة للإصدار 8.0.0.3
إرشادات التصحيح:
1. قم بترقية OpenEMR إلى الإصدار 8.0.0.3 أو أحدث على الفور
2. اختبر التصحيحات في بيئة غير الإنتاج أولاً
3. قم بعمل نسخة احتياطية من جميع بيانات المرضى قبل تطبيق التصحيحات
4. تحقق من عرض النموذج بعد التصحيح للتأكد من عدم فقدان البيانات
الضوابط البديلة (إذا لم يكن التصحيح الفوري ممكناً):
1. تطبيق قواعد جدار حماية تطبيقات الويب (WAF) للكشف عن حمولات XSS وحجبها
2. تعطيل وظيفة نموذج فحص العيون حتى اكتمال التصحيح
3. تطبيق رؤوس سياسة أمان المحتوى الصارمة: Content-Security-Policy: default-src 'self'; script-src 'self'
4. تفعيل ترميز كيان HTML لجميع مخرجات النموذج
5. تطبيق التحقق من الإدخال لرفض الأحرف الخاصة في حقول النموذج
قواعد الكشف:
1. مراقبة تقديمات النموذج التي تحتوي على: <script>، javascript:، onerror=، onload=، معالجات الأحداث
2. تنبيه الوصول إلى نموذج فحص العيون من قبل المستخدمين خارج ساعات العمل العادية
3. تتبع التعديلات على صفحات اللقاء والسجل الطبي
4. مراقبة استعلامات قاعدة البيانات لأنماط بيانات نموذج فحص العيون غير العادية
5. تسجيل جميع تقديمات النموذج برقم المستخدم والطابع الزمني ومحتوى الحمولة