Executive brief
The AddFunc Head & Footer Code plugin for WordPress, which allows site owners to add custom code to their website's header and footer, contains a security flaw. This vulnerability allows users with basic contributor access to inject malicious scripts into the website. If an administrator views or previews the affected content, these scripts could execute, potentially leading to unauthorized actions or site compromise.
Technical details
The AddFunc Head & Footer Code plugin for WordPress is vulnerable to Stored Cross-Site Scripting (XSS) via the `aFhfc_head_code`, `aFhfc_body_code`, and `aFhfc_footer_code` post meta values in versions up to 2.3. The root cause is the plugin's failure to sanitize or escape these values upon output. Although the plugin's primary interface is restricted to administrators, it fails to use `register_meta()` with an `auth_callback` to protect the underlying meta keys. This allows authenticated attackers with Contributor-level permissions or higher to bypass the intended restrictions using the WordPress Custom Fields interface. Malicious scripts injected this way execute in the context of any user, including administrators, who views or previews the affected post. The issue is addressed in version 2.4.
Affected products
- AddFunc AddFunc Head & Footer Code Up to, and including, 2.3
Timeline
- 2026-04-10: disclosed
- 2026-04-10: advisory
References
- https://plugins.trac.wordpress.org/browser/addfunc-head-footer-code/tags/2.3/addfunc-head-footer-code.php
- https://plugins.trac.wordpress.org/browser/addfunc-head-footer-code/tags/2.3/addfunc-head-footer-code.php
- https://plugins.trac.wordpress.org/browser/addfunc-head-footer-code/tags/2.3/addfunc-head-footer-code.php
- https://plugins.trac.wordpress.org/browser/addfunc-head-footer-code/trunk/addfunc-head-footer-code.php
- https://plugins.trac.wordpress.org/browser/addfunc-head-footer-code/trunk/addfunc-head-footer-code.php
- https://plugins.trac.wordpress.org/browser/addfunc-head-footer-code/trunk/addfunc-head-footer-code.php
- https://plugins.trac.wordpress.org/changeset?old_path=%2Faddfunc-head-footer-code/tags/2.3&new_path=%2Faddfunc-head-footer-code/tags/2.4