On February 15, 2022, the Wordfence Threat Intelligence team responsibly disclosed a reflected Cross-Site Scripting (XSS) vulnerability in Header Footer Code Manager, a WordPress plugin with over 300,000 installations.
The plugin publisher quickly acknowledged our initial contact and we sent the full disclosure details the same day, on February 15, 2022. A patched version, 1.1.17, was implemented a few days later and made available on February 18, 2022.
Wordfence Premium, Wordfence Care, and Wordfence Response customers received a firewall rule to protect against this vulnerability on February 15, 2022. Sites still running the free version of Wordfence are partially protected against this exploit by our built-in XSS rule, but will receive full protection 30 days later, on March 17, 2022.
Affected Plugin: Header Footer Code Manager
Plugin Slug: header-footer-code-manager
Plugin Developer: 99robots
Affected Versions: <= 1.1.16
CVE ID: CVE-2022-0710
CVSS Score: 6.1 (Medium)
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Researcher/s: Ramuel Gall
Fully Patched Version: 1.1.17
Header Footer Code Manager is a WordPress plugin designed to allow administrators to add code snippets to the header or footer of a website. One of the admin panel pages added by the plugin allows administrators to view a list of code snippets that had been added to the site, which included links to edit or delete these existing code snippets. The plugin’s column_name function used the $_REQUEST[‘page’] parameter to construct this link.
WordPress uses the value of the $_GET[‘page’] parameter in order to determine which page the user is currently visiting, and will block unauthorized users if they’re not allowed to access the current page set in $_GET[‘page’]. This means that $_REQUEST[‘page’] might be expected to just contain the admin page used to display the list of code snippets, hfcm-list. However, due to a quirk of how PHP handles superglobal variables, $_REQUEST parameters can be overloaded.
PHP populates the $_REQUEST superglobal variable from $_GET, $_POST, and $_COOKIE. That means that normally, if a $_GET[‘page’] parameter is sent, $_REQUEST[‘page’] will be populated with the value of $_GET[‘page’]. In most PHP configurations, however, the request_order (or variables_order if request_order is not set) means that if a request is sent with both a $_GET[‘page’] parameter and a $_POST[‘page’] parameter, the value of $_REQUEST[‘page’] is set to the value of $_POST[‘page’].
The upshot is that this can be used to execute JavaScript in the browser of a logged-in administrator, for instance, by tricking them into visiting a self-submitting form that sends a POST request to e.g. hxxps://victimsite.site/wp-admin/admin.php?page=hfcm-list, with the $_POST[‘page’] parameter set to malicious JavaScript.
The $_GET[‘page’] parameter means that WordPress will route the victim to the correct page, and then the value of $_REQUEST[‘page’] (which in nearly all configurations will be set to the value of $_POST[‘page’]) will get echoed out onto the page.
Most XSS can be used to perform actions using an administrator’s session, which includes the ability to create malicious administrators and in some cases add backdoors. Additionally, this particular plugin is used to add code to a site, so an attacker could also potentially leverage reflected XSS into stored XSS to attack site visitors, even on sites where file editing and user creation functionality was locked down.
Timeline
February 15, 2022 – The Wordfence Threat Intelligence team finishes our investigation and releases a firewall rule to Wordfence Premium, Care, and Response users to protect against any exploits targeting this vulnerability. We initiate the responsible disclosure process and receive a response from the plugin’s developers. We send over full disclosure.
February 17, 2022 – Plugin changelog shows the issue is fixed.
February 18, 2022 – A patched version of the plugin, 1.1.17, is released on the WordPress repo.
March 17, 2022 – The firewall rule becomes available to free Wordfence users.
Conclusion
In today’s article, we discussed a reflected XSS vulnerability in Header Footer Code Manager. While this would require tricking an administrator into clicking a link or performing some other action, it still offers the potential for site takeover. As such we urge you to update to the latest version of this plugin, 1.1.17 as of this writing, as soon as possible.
Sites running Wordfence Premium, Wordfence Care, and Wordfence Response are fully protected against this vulnerability. Sites running the free version of Wordfence are partially protected and will receive full protection on March 17, 2022.
If you believe your site has been compromised as a result of this vulnerability or any other vulnerability, we offer Incident Response services via Wordfence Care. If you need your site cleaned immediately, Wordfence Response offers the same service with 24/7/365 availability and a 1-hour response time. Both these products include hands-on support in case you need further assistance.
If you know a friend or colleague who is using this plugin on their site, we highly recommend forwarding this advisory to them to help keep their sites protected, as this is a serious vulnerability that can lead to complete site takeover.
Thanks to Charlie Patel, CEO of 99robots, for rapidly and personally responding to our disclosure
The post Reflected XSS in Header Footer Code Manager appeared first on Wordfence.