The AddFunc Head & Footer Code plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the `aFhfc_head_code`, `aFhfc_body_code`, and `aFhfc_footer_code` post meta values in all versions up to, and including, 2.3. This is due to the plugin outputting these meta values without any sanitization or escaping. While the plugin restricts its own metabox and save handler to administrators via `current_user_can('manage_options')`, it does not use `register_meta()` with an `auth_callback` to protect these meta keys. This makes it possible for authenticated attackers, with Contributor-level access and above, to inject arbitrary web scripts via the WordPress Custom Fields interface that execute when an administrator previews or views the post.
The AddFunc Head & Footer Code WordPress plugin (versions ≤2.3) contains a Stored XSS vulnerability in head, body, and footer code meta fields. Authenticated users with Contributor-level access can inject malicious scripts through WordPress Custom Fields that execute when administrators view posts, potentially leading to admin account compromise and site-wide malware injection. No patch is currently available, requiring immediate mitigation strategies.
IMMEDIATE ACTIONS:
1. Audit all posts and pages for suspicious meta values in aFhfc_head_code, aFhfc_body_code, and aFhfc_footer_code fields using WordPress database queries
2. Disable the AddFunc Head & Footer Code plugin immediately via wp-admin or by renaming the plugin directory
3. Review WordPress user roles and remove unnecessary Contributor-level access; restrict to Editor and Administrator only
4. Audit WordPress user accounts and access logs for unauthorized activity
COMPENSATING CONTROLS:
5. Implement Web Application Firewall (WAF) rules to detect and block script injection patterns in POST requests to wp-admin/post.php
6. Enable WordPress security plugins (Wordfence, Sucuri) with real-time malware scanning
7. Restrict wp-admin access by IP whitelist to known office locations
8. Implement Content Security Policy (CSP) headers to prevent inline script execution
9. Use WordPress security hardening: disable file editing, restrict plugin uploads, enforce strong passwords
DETECTION:
10. Monitor database for suspicious meta key modifications: SELECT * FROM wp_postmeta WHERE meta_key IN ('aFhfc_head_code', 'aFhfc_body_code', 'aFhfc_footer_code') AND meta_value LIKE '%<script%'
11. Log and alert on any post preview/view actions by administrators following contributor edits
12. Monitor wp-admin access logs for Contributor-level users accessing post edit screens
الإجراءات الفورية:
1. تدقيق جميع المنشورات والصفحات للقيم الوصفية المريبة في حقول aFhfc_head_code و aFhfc_body_code و aFhfc_footer_code باستخدام استعلامات قاعدة بيانات WordPress
2. تعطيل مكون إضافة AddFunc Head & Footer Code فوراً عبر wp-admin أو بإعادة تسمية دليل المكون الإضافي
3. مراجعة أدوار مستخدمي WordPress وإزالة وصول المساهم غير الضروري؛ تقييد الوصول للمحررين والمسؤولين فقط
4. تدقيق حسابات مستخدمي WordPress وسجلات الوصول للنشاط غير المصرح به
الضوابط التعويضية:
5. تنفيذ قواعد جدار حماية تطبيقات الويب (WAF) للكشف عن أنماط حقن النصوص البرمجية وحجبها في طلبات POST إلى wp-admin/post.php
6. تفعيل مكونات إضافة أمان WordPress (Wordfence, Sucuri) مع المسح الضار في الوقت الفعلي
7. تقييد وصول wp-admin حسب IP للمواقع المعروفة
8. تنفيذ رؤوس سياسة أمان المحتوى (CSP) لمنع تنفيذ النصوص البرمجية المضمنة
9. تعزيز أمان WordPress: تعطيل تحرير الملفات، تقييد تحميل المكونات الإضافية، فرض كلمات مرور قوية
الكشف:
10. مراقبة قاعدة البيانات للتعديلات المريبة على المفاتيح الوصفية: SELECT * FROM wp_postmeta WHERE meta_key IN ('aFhfc_head_code', 'aFhfc_body_code', 'aFhfc_footer_code') AND meta_value LIKE '%<script%'
11. تسجيل والتنبيه على أي إجراءات معاينة/عرض منشورات من قبل المسؤولين بعد تعديلات المساهم
12. مراقبة سجلات وصول wp-admin لمستخدمي المساهم الذين يصلون إلى شاشات تحرير المنشورات