React Router is a router for React. In versions 7.7.0 through 7.13.1, when using React Router's unstable React Server Components (RSC) APIs, there is a potential client-side Cross-Site Scripting (XSS) vulnerability in the RSC redirect handling if redirects come from untrusted sources. This does not impact applications that are not using the unstable RSC APIs in React Router. This is patched in version 7.13.2.
React Router versions 7.7.0-7.13.1 contain a client-side XSS vulnerability in unstable React Server Components (RSC) redirect handling when processing untrusted redirect sources. This affects only applications explicitly using RSC APIs. With CVSS 8.0, this poses significant risk to Saudi web applications and digital services relying on React Router for frontend routing, particularly those handling sensitive user data or financial transactions.
IMMEDIATE ACTIONS:
1. Audit all React Router implementations to identify if unstable RSC APIs are in use (check for use of createServerFn, serverAction, or similar RSC patterns)
2. If RSC APIs are NOT used, no action required; vulnerability does not apply
3. If RSC APIs ARE used, immediately implement input validation and sanitization for all redirect sources
PATCHING GUIDANCE:
1. Upgrade React Router to version 7.13.2 or later when available (currently patch is pending)
2. Until patch release, apply these compensating controls:
- Implement strict Content Security Policy (CSP) headers: default-src 'self'; script-src 'self'; object-src 'none'
- Validate all redirect URLs against whitelist of allowed domains before processing
- Use URL.parse() and verify hostname matches expected values
- Encode all user-controlled data in redirect parameters using encodeURIComponent()
DETECTION RULES:
1. Monitor for unusual redirect patterns in application logs
2. Alert on redirect URLs containing script tags or javascript: protocol
3. WAF rules: Block requests with encoded script payloads in redirect parameters
4. Browser console monitoring for XSS execution attempts
5. CSP violation reports indicating inline script execution
الإجراءات الفورية:
1. تدقيق جميع تطبيقات React Router لتحديد ما إذا كانت واجهات برمجة تطبيقات RSC غير المستقرة قيد الاستخدام
2. إذا لم تكن واجهات برمجة تطبيقات RSC قيد الاستخدام، فلا إجراء مطلوب
3. إذا كانت واجهات برمجة تطبيقات RSC قيد الاستخدام، قم فوراً بتطبيق التحقق من صحة المدخلات والتطهير لجميع مصادر إعادة التوجيه
إرشادات التصحيح:
1. ترقية React Router إلى الإصدار 7.13.2 أو أحدث عند توفره
2. حتى إصدار التصحيح، طبق هذه الضوابط البديلة:
- تطبيق رؤوس سياسة أمان المحتوى الصارمة
- التحقق من صحة جميع عناوين URL لإعادة التوجيه مقابل قائمة بيضاء
- ترميز جميع البيانات التي يتحكم فيها المستخدم في معاملات إعادة التوجيه
قواعد الكشف:
1. مراقبة أنماط إعادة التوجيه غير العادية في سجلات التطبيق
2. تنبيهات على عناوين URL تحتوي على علامات البرنامج النصي
3. قواعد جدار الحماية: حظر الطلبات التي تحتوي على حمولات برنامج نصي مشفرة