Nginx UI is a web user interface for the Nginx web server. Prior to version 2.3.5, all WebSocket endpoints in nginx-ui use a gorilla/websocket Upgrader with CheckOrigin unconditionally returning true, allowing Cross-Site WebSocket Hijacking (CSWSH). Combined with the fact that authentication tokens are stored in browser cookies (set via JavaScript without HttpOnly or explicit SameSite attributes), a malicious webpage can establish authenticated WebSocket connections to the nginx-ui instance when a logged-in administrator visits the attacker-controlled page. Version 2.3.5 patches the issue.
Nginx UI versions prior to 2.3.5 are vulnerable to Cross-Site WebSocket Hijacking (CSWSH) attacks due to improper WebSocket origin validation and insecure cookie handling. An attacker can establish authenticated WebSocket connections to nginx-ui instances when administrators visit malicious webpages, potentially allowing unauthorized server configuration changes. This vulnerability has a CVSS score of 8.1 and exploits are publicly available, making it a significant threat to organizations managing Nginx infrastructure.
IMMEDIATE ACTIONS:
1. Identify all Nginx UI instances in your environment and document their versions
2. Restrict access to Nginx UI administrative interfaces to trusted networks only using firewall rules
3. Implement network segmentation to isolate Nginx UI management traffic
4. Monitor WebSocket connections for suspicious cross-origin requests
PATCHING:
1. Upgrade Nginx UI to version 2.3.5 or later immediately
2. Test patches in non-production environments before deployment
3. Plan phased rollout for critical infrastructure
COMPENSATING CONTROLS (if immediate patching not possible):
1. Implement a Web Application Firewall (WAF) to block cross-origin WebSocket requests
2. Deploy reverse proxy with strict origin validation in front of Nginx UI
3. Enforce VPN-only access to Nginx UI administrative interfaces
4. Implement IP whitelisting for administrative access
5. Disable WebSocket support if not required for operations
DETECTION:
1. Monitor for WebSocket upgrade requests with mismatched Origin headers
2. Alert on authentication token usage from unexpected IP addresses
3. Log all WebSocket connection attempts and analyze for cross-origin patterns
4. Implement IDS/IPS rules to detect CSWSH attack patterns
5. Review browser access logs for suspicious referrer headers to Nginx UI
الإجراءات الفورية:
1. حدد جميع مثيلات Nginx UI في بيئتك وقم بتوثيق إصداراتها
2. قيد الوصول إلى واجهات إدارة Nginx UI على الشبكات الموثوقة فقط باستخدام قواعد جدار الحماية
3. طبق تقسيم الشبكة لعزل حركة إدارة Nginx UI
4. راقب اتصالات WebSocket للطلبات المريبة عبر الأصول
التصحيح:
1. قم بترقية Nginx UI إلى الإصدار 2.3.5 أو أحدث على الفور
2. اختبر التصحيحات في بيئات غير الإنتاج قبل النشر
3. خطط لنشر متدرج للبنية الأساسية الحرجة
الضوابط البديلة (إذا لم يكن التصحيح الفوري ممكناً):
1. طبق جدار تطبيقات ويب (WAF) لحجب طلبات WebSocket عبر الأصول
2. نشر خادم وكيل عكسي مع التحقق الصارم من الأصل أمام Nginx UI
3. فرض الوصول عبر VPN فقط لواجهات إدارة Nginx UI
4. طبق قائمة بيضاء IP للوصول الإداري
5. عطل دعم WebSocket إذا لم يكن مطلوباً للعمليات
الكشف:
1. راقب طلبات ترقية WebSocket مع رؤوس Origin غير متطابقة
2. أصدر تنبيهات عند استخدام رمز المصادقة من عناوين IP غير متوقعة
3. سجل جميع محاولات اتصال WebSocket وحلل الأنماط عبر الأصول
4. طبق قواعس IDS/IPS للكشف عن أنماط هجوم CSWSH
5. راجع سجلات الوصول للمتصفح للبحث عن رؤوس referrer المريبة إلى Nginx UI