OpenEMR is a free and open source electronic health records and medical practice management application. Prior to version 8.0.0.3, an Insecure Direct Object Reference (IDOR) vulnerability in the fee sheet product save logic (`library/FeeSheet.class.php`) allows any authenticated user with fee sheet ACL access to delete, modify, or read `drug_sales` records belonging to arbitrary patients by manipulating the hidden `prod[][sale_id]` form field. The `save()` method uses the user-supplied `sale_id` in five SQL queries (SELECT, UPDATE, DELETE) without verifying that the record belongs to the current patient and encounter. Version 8.0.0.3 contains a patch.
OpenEMR versions prior to 8.0.0.3 contain an Insecure Direct Object Reference (IDOR) vulnerability in the fee sheet module that allows authenticated users to access, modify, or delete drug sales records for arbitrary patients. This critical healthcare data exposure vulnerability affects medical institutions across Saudi Arabia that rely on OpenEMR for patient record management. Immediate patching to version 8.0.0.3 or later is essential to prevent unauthorized access to sensitive pharmaceutical and financial records.
IMMEDIATE ACTIONS:
1. Identify all OpenEMR instances in your organization and document current versions
2. Restrict fee sheet ACL access to only essential personnel pending patch deployment
3. Enable audit logging for all fee sheet operations (drug_sales table modifications)
4. Review access logs for unauthorized drug_sales record access patterns
PATCHING GUIDANCE:
1. Upgrade OpenEMR to version 8.0.0.3 or later immediately
2. Test patch in non-production environment first
3. Schedule maintenance window for production deployment
4. Verify patch application by checking FeeSheet.class.php contains patient/encounter validation
COMPENSATING CONTROLS (if immediate patching not possible):
1. Implement database-level access controls restricting fee sheet queries to current patient context
2. Deploy Web Application Firewall (WAF) rules to detect and block manipulation of prod[][sale_id] parameters
3. Implement row-level security (RLS) on drug_sales table based on patient_id and encounter_id
4. Disable fee sheet functionality for non-essential users
DETECTION RULES:
1. Monitor for SQL queries accessing drug_sales with mismatched patient_id/encounter_id combinations
2. Alert on fee sheet save operations with sale_id values not belonging to current patient
3. Track modifications to drug_sales records by users without direct patient assignment
4. Log all hidden form field manipulations in fee sheet submissions
الإجراءات الفورية:
1. حدد جميع مثيلات OpenEMR في مؤسستك وقثق الإصدارات الحالية
2. قيد الوصول إلى ACL لورقة الرسوم للموظفين الأساسيين فقط قبل نشر التصحيح
3. فعّل تسجيل التدقيق لجميع عمليات ورقة الرسوم (تعديلات جدول drug_sales)
4. راجع سجلات الوصول للكشف عن أنماط الوصول غير المصرح إلى سجلات drug_sales
إرشادات التصحيح:
1. قم بترقية OpenEMR إلى الإصدار 8.0.0.3 أو أحدث على الفور
2. اختبر التصحيح في بيئة غير الإنتاج أولاً
3. جدول نافذة صيانة لنشر الإنتاج
4. تحقق من تطبيق التصحيح بالتحقق من أن FeeSheet.class.php يحتوي على التحقق من المريض/الالتقاء
الضوابط التعويضية (إذا لم يكن التصحيح الفوري ممكناً):
1. تنفيذ ضوابط الوصول على مستوى قاعدة البيانات تقيد استعلامات ورقة الرسوم لسياق المريض الحالي
2. نشر قواعد جدار حماية تطبيقات الويب (WAF) للكشف عن معالجة معاملات prod[][sale_id] وحظرها
3. تنفيذ أمان على مستوى الصف (RLS) على جدول drug_sales بناءً على patient_id و encounter_id
4. تعطيل وظيفة ورقة الرسوم للمستخدمين غير الأساسيين
قواعد الكشف:
1. مراقبة استعلامات SQL التي تصل إلى drug_sales مع عدم تطابق patient_id/encounter_id
2. تنبيه عمليات حفظ ورقة الرسوم مع قيم sale_id لا تنتمي إلى المريض الحالي
3. تتبع التعديلات على سجلات drug_sales من قبل المستخدمين بدون تعيين مريض مباشر
4. تسجيل جميع معالجات حقول النموذج المخفية في عمليات إرسال ورقة الرسوم