The BJ Lazy Load plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the `filter_images()` function in all versions up to, and including, 1.0.9. This is due to the use of regex-based HTML processing (`preg_replace`) that does not properly handle HTML attribute boundaries when replacing `src` attributes, allowing crafted content inside a `class` attribute value to be promoted to real DOM attributes after processing. This makes it possible for authenticated attackers, with Contributor-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.
The BJ Lazy Load WordPress plugin (versions ≤1.0.9) contains a Stored XSS vulnerability in the filter_images() function that allows authenticated contributors to inject malicious scripts through improper HTML attribute processing. Attackers can exploit regex-based HTML parsing flaws to inject code via class attributes that gets promoted to executable DOM attributes. This vulnerability affects WordPress sites using this plugin and poses a moderate risk to content integrity and user security.
IMMEDIATE ACTIONS:
1. Audit all WordPress installations for BJ Lazy Load plugin presence and version
2. Disable the plugin immediately if version ≤1.0.9 is detected
3. Review user access logs for Contributor+ level accounts with suspicious activity in the past 30 days
4. Scan all published posts/pages for suspicious class attributes containing script-like content
PATCHING GUIDANCE:
1. Contact plugin developer for security update timeline
2. If no patch available within 30 days, consider removing the plugin entirely
3. Implement alternative lazy-loading solutions (e.g., native WordPress lazy-loading, Smush, or Imagify)
COMPENSATING CONTROLS:
1. Restrict Contributor role permissions to trusted users only
2. Implement Web Application Firewall (WAF) rules to detect/block XSS patterns in POST requests
3. Enable WordPress security plugins (Wordfence, Sucuri) with XSS detection
4. Implement Content Security Policy (CSP) headers to restrict inline script execution
5. Enable WordPress revision history and monitor post modifications
DETECTION RULES:
1. Monitor for posts/pages with class attributes containing: <script, javascript:, onerror=, onload=
2. Alert on any modifications to posts by Contributor+ accounts
3. Log all preg_replace() function calls in plugin files
4. Monitor for DOM attribute injection patterns in HTTP requests
الإجراءات الفورية:
1. تدقيق جميع تثبيتات WordPress للتحقق من وجود مكون BJ Lazy Load والإصدار
2. تعطيل المكون فوراً إذا تم اكتشاف الإصدار ≤1.0.9
3. مراجعة سجلات الوصول للمستخدمين على مستوى المساهم وما فوقه للنشاط المريب في آخر 30 يوماً
4. فحص جميع المنشورات/الصفحات المنشورة عن سمات فئة مريبة تحتوي على محتوى يشبه البرامج النصية
إرشادات التصحيح:
1. التواصل مع مطور المكون بشأن جدول الأمان
2. إذا لم يتوفر تصحيح خلال 30 يوماً، فكر في إزالة المكون بالكامل
3. تنفيذ حلول بديلة للتحميل البطيء (مثل التحميل البطيء الأصلي في WordPress، Smush، أو Imagify)
الضوابط التعويضية:
1. تقييد أذونات دور المساهم للمستخدمين الموثوقين فقط
2. تنفيذ قواعد جدار حماية تطبيقات الويب (WAF) للكشف عن أنماط XSS وحجبها
3. تفعيل مكونات أمان WordPress (Wordfence، Sucuri) مع كشف XSS
4. تنفيذ رؤوس سياسة أمان المحتوى (CSP) لتقييد تنفيذ البرامج النصية المضمنة
5. تفعيل سجل مراجعة WordPress ومراقبة تعديلات المنشورات
قواعد الكشف:
1. مراقبة المنشورات/الصفحات التي تحتوي على سمات فئة تحتوي على: <script، javascript:، onerror=، onload=
2. تنبيه عند أي تعديلات على المنشورات بواسطة حسابات المساهم وما فوقه
3. تسجيل جميع استدعاءات دالة preg_replace() في ملفات المكون
4. مراقبة أنماط حقن سمات DOM في طلبات HTTP