A vulnerability was found in SourceCodester Pharmacy Sales and Inventory System 1.0. This affects an unknown part of the file /ajax.php?action=save_user. The manipulation of the argument ID results in sql injection. The attack can be executed remotely. The exploit has been made public and could be used.
A critical SQL injection vulnerability exists in SourceCodester Pharmacy Sales and Inventory System 1.0 affecting the /ajax.php?action=save_user endpoint. The vulnerability allows remote attackers to manipulate the ID parameter to execute arbitrary SQL commands, potentially leading to unauthorized data access, modification, or deletion. With a CVSS score of 7.3 and public exploit availability, this poses an immediate threat to healthcare organizations using this system.
IMMEDIATE ACTIONS:
1. Isolate affected systems from production networks if possible or implement network segmentation
2. Enable comprehensive logging and monitoring on /ajax.php endpoints
3. Implement Web Application Firewall (WAF) rules to block SQL injection patterns in ID parameter
4. Restrict access to /ajax.php?action=save_user to authorized users only via IP whitelisting
PATCHING GUIDANCE:
1. Contact SourceCodester for security patches or upgrade timeline
2. If no patch available, consider migrating to alternative pharmacy management systems with active security support
3. Implement input validation: use parameterized queries/prepared statements for all database operations
4. Apply strict input sanitization on ID parameter (whitelist numeric values only)
COMPENSATING CONTROLS:
1. Deploy database activity monitoring (DAM) to detect anomalous SQL queries
2. Implement database user accounts with minimal privileges (principle of least privilege)
3. Enable SQL query logging and audit trails
4. Use database encryption for sensitive pharmacy and patient data
5. Implement rate limiting on /ajax.php endpoints
DETECTION RULES:
1. Monitor for SQL keywords (UNION, SELECT, DROP, INSERT, UPDATE) in ID parameter
2. Alert on multiple failed database queries from single session
3. Track unusual data exfiltration patterns from pharmacy database
4. Monitor for encoded payloads (%27, %22, %2D%2D) in request parameters
الإجراءات الفورية:
1. عزل الأنظمة المتأثرة عن شبكات الإنتاج إن أمكن أو تطبيق تقسيم الشبكة
2. تفعيل السجلات الشاملة والمراقبة على نقاط نهاية /ajax.php
3. تطبيق قواعد جدار حماية تطبيقات الويب (WAF) لحجب أنماط حقن SQL في معامل ID
4. تقييد الوصول إلى /ajax.php?action=save_user للمستخدمين المصرح لهم فقط عبر قائمة بيضاء IP
إرشادات التصحيح:
1. التواصل مع SourceCodester للحصول على تصحيحات أمنية أو جدول زمني للترقية
2. إذا لم يكن هناك تصحيح متاح، فكر في الترقية إلى أنظمة إدارة صيدليات بديلة مع دعم أمني نشط
3. تطبيق التحقق من صحة الإدخال: استخدام الاستعلامات المعاملة/البيانات المحضرة لجميع عمليات قاعدة البيانات
4. تطبيق تنظيف صارم للإدخال على معامل ID (قائمة بيضاء للقيم الرقمية فقط)
الضوابط التعويضية:
1. نشر مراقبة نشاط قاعدة البيانات (DAM) للكشف عن استعلامات SQL غير الطبيعية
2. تطبيق حسابات مستخدمي قاعدة البيانات بأقل صلاحيات (مبدأ أقل امتياز)
3. تفعيل سجلات استعلامات SQL ومسارات التدقيق
4. استخدام تشفير قاعدة البيانات للبيانات الحساسة للصيدلية والمريض
5. تطبيق تحديد معدل على نقاط نهاية /ajax.php
قواعد الكشف:
1. مراقبة كلمات مفتاحية SQL (UNION, SELECT, DROP, INSERT, UPDATE) في معامل ID
2. التنبيه على استعلامات قاعدة بيانات متعددة فاشلة من جلسة واحدة
3. تتبع أنماط تسرب البيانات غير العادية من قاعدة بيانات الصيدلية
4. مراقبة الحمولات المشفرة (%27, %22, %2D%2D) في معاملات الطلب