Strapi is an open source headless content management system. In Strapi versions prior to 5.33.3, the Upload plugin's Content API endpoints did not enforce the administrator-configured MIME type restrictions (`plugin.upload.security.allowedTypes` and `deniedTypes`). The same restrictions were correctly enforced on the Admin Panel upload path. The upload plugin's `enforceUploadSecurity` security check was invoked in the admin upload controller but was missing from the Content API controller. The Content API handlers `uploadFiles` and `replaceFile` (and the `upload` wrapper that dispatches to them) called the underlying upload service directly, bypassing both the magic-byte MIME detection and the configured allow/deny lists. An authenticated user with the Content API upload permission could therefore upload file types the administrator had explicitly disallowed, including HTML and SVG content. In deployments serving uploaded files from the same origin as the admin panel (default), an attacker could upload an HTML or SVG file that, when opened directly by an admin, executed JavaScript in the admin origin, enabling admin-session hijack and authenticated administrative actions against the admin API. The patch in version 5.33.3 introduces a shared `prepareUploadRequest` helper that wraps `enforceUploadSecurity` and is called from both the Content API and admin upload controllers, ensuring identical security policy enforcement on every upload entry point.
Strapi versions prior to 5.33.3 fail to enforce MIME type restrictions on Content API file uploads, allowing authenticated users to bypass administrator-configured upload security policies. This vulnerability enables uploading malicious HTML/SVG files that can execute JavaScript in the admin panel context, potentially leading to admin session hijacking and unauthorized administrative actions. The vulnerability affects deployments serving uploaded files from the same origin as the admin panel, which is the default configuration.
IMMEDIATE ACTIONS:
1. Identify all Strapi instances in your environment running versions prior to 5.33.3
2. Restrict Content API upload permissions to trusted users only; audit existing upload permissions
3. Implement network-level controls to prevent direct access to uploaded files from admin panel origin
PATCHING:
1. Upgrade Strapi to version 5.33.3 or later immediately
2. Test upgrades in non-production environments first
3. Review and re-validate MIME type restrictions (allowedTypes/deniedTypes) after patching
COMPENSATING CONTROLS (if immediate patching not possible):
1. Serve uploaded files from a different origin/subdomain than the admin panel (e.g., cdn.example.com vs admin.example.com)
2. Implement Content Security Policy (CSP) headers to prevent inline script execution
3. Configure web server to serve uploaded files with Content-Disposition: attachment header
4. Disable or restrict Content API upload endpoints if not actively used
5. Implement strict file type validation at the reverse proxy/WAF level
DETECTION:
1. Monitor Content API /upload and /replace endpoints for suspicious file uploads
2. Alert on uploads of .html, .svg, .js, .xml files via Content API
3. Review admin panel access logs for sessions initiated after file uploads
4. Implement file integrity monitoring on upload directories
5. Log and alert on any modifications to plugin.upload.security configuration
الإجراءات الفورية:
1. حدد جميع مثيلات Strapi في بيئتك التي تعمل بإصدارات سابقة للإصدار 5.33.3
2. قيّد أذونات تحميل Content API للمستخدمين الموثوقين فقط؛ قم بتدقيق أذونات التحميل الموجودة
3. تنفيذ عناصر تحكم على مستوى الشبكة لمنع الوصول المباشر إلى الملفات المحملة من أصل لوحة التحكم الإدارية
التصحيح:
1. قم بترقية Strapi إلى الإصدار 5.33.3 أو أحدث على الفور
2. اختبر الترقيات في بيئات غير الإنتاج أولاً
3. راجع وأعد التحقق من قيود نوع MIME (allowedTypes/deniedTypes) بعد التصحيح
عناصر التحكم البديلة (إذا لم يكن التصحيح الفوري ممكناً):
1. قدّم الملفات المحملة من أصل مختلف/نطاق فرعي عن لوحة التحكم الإدارية
2. تنفيذ رؤوس سياسة أمان المحتوى (CSP) لمنع تنفيذ البرامج النصية المضمنة
3. قم بتكوين خادم الويب لتقديم الملفات المحملة برأس Content-Disposition: attachment
4. تعطيل أو تقييد نقاط نهاية تحميل Content API إذا لم تكن قيد الاستخدام النشط
5. تنفيذ التحقق من نوع الملف الصارم على مستوى الوكيل العكسي/WAF
الكشف:
1. مراقبة نقاط نهاية Content API /upload و /replace لتحميلات الملفات المريبة
2. تنبيهات على تحميلات ملفات .html و .svg و .js و .xml عبر Content API
3. مراجعة سجلات الوصول إلى لوحة التحكم الإدارية للجلسات المبدوءة بعد تحميلات الملفات
4. تنفيذ مراقبة سلامة الملفات على أدلة التحميل
5. تسجيل والتنبيه على أي تعديلات على إعدادات plugin.upload.security