CleverTap Web SDK version 1.15.2 and earlier is vulnerable to Cross-Site Scripting (XSS) via window.postMessage. The handleCustomHtmlPreviewPostMessageEvent function in src/util/campaignRender/nativeDisplay.js performs insufficient origin validation using the includes() method, which can be bypassed by an attacker using a subdomain
CleverTap Web SDK versions up to 1.15.2 contain a critical Cross-Site Scripting (XSS) vulnerability in the postMessage handler that allows attackers to bypass origin validation using subdomain manipulation. This vulnerability affects customer engagement platforms widely used by Saudi enterprises for marketing automation and customer analytics. Immediate patching is required as the vulnerability enables arbitrary JavaScript execution in the context of affected web applications.
IMMEDIATE ACTIONS:
1. Identify all web applications and services using CleverTap Web SDK versions 1.15.2 or earlier
2. Audit postMessage event handlers and origin validation implementations
3. Implement Content Security Policy (CSP) with strict frame-ancestors and script-src directives
PATCHING GUIDANCE:
1. Upgrade CleverTap Web SDK to version 1.15.3 or later immediately
2. Test upgraded SDK in staging environment before production deployment
3. Verify origin validation now uses strict equality (===) instead of includes() method
4. Clear browser caches and CDN caches after deployment
COMPENSATING CONTROLS (if immediate patching not possible):
1. Implement strict Content Security Policy: frame-ancestors 'none'; script-src 'self'
2. Add server-side origin validation for all postMessage communications
3. Implement Sub-Resource Integrity (SRI) for SDK script loading
4. Monitor for suspicious postMessage events in browser console
DETECTION RULES:
1. Monitor for postMessage events with origins containing subdomains of trusted domains
2. Alert on inline script execution attempts from postMessage handlers
3. Track CleverTap SDK version in use across all web properties
4. Implement WAF rules to detect XSS payloads in postMessage communications
الإجراءات الفورية:
1. تحديد جميع تطبيقات الويب والخدمات التي تستخدم CleverTap Web SDK الإصدارات 1.15.2 أو أقدم
2. تدقيق معالجات أحداث postMessage وتطبيقات التحقق من الأصل
3. تطبيق سياسة أمان المحتوى (CSP) مع توجيهات صارمة frame-ancestors و script-src
إرشادات التصحيح:
1. ترقية CleverTap Web SDK إلى الإصدار 1.15.3 أو أحدث فوراً
2. اختبار SDK المحدث في بيئة التجريب قبل نشره في الإنتاج
3. التحقق من أن التحقق من الأصل يستخدم الآن المساواة الصارمة (===) بدلاً من طريقة includes()
4. مسح ذاكرة التخزين المؤقت للمتصفح وذاكرة التخزين المؤقت لـ CDN بعد النشر
الضوابط البديلة (إذا لم يكن الإصلاح الفوري ممكناً):
1. تطبيق سياسة أمان محتوى صارمة: frame-ancestors 'none'; script-src 'self'
2. إضافة التحقق من الأصل من جانب الخادم لجميع اتصالات postMessage
3. تطبيق Sub-Resource Integrity (SRI) لتحميل سكريبت SDK
4. مراقبة أحداث postMessage المريبة في وحدة تحكم المتصفح
قواعد الكشف:
1. مراقبة أحداث postMessage مع أصول تحتوي على نطاقات فرعية من النطاقات الموثوقة
2. تنبيه محاولات تنفيذ السكريبت المضمنة من معالجات postMessage
3. تتبع إصدار CleverTap SDK المستخدم عبر جميع خصائص الويب
4. تطبيق قواعد WAF للكشف عن حمولات XSS في اتصالات postMessage