Description: Reflected Cross-Site Scripting
Affected Plugin: Spam protection, AntiSpam, FireWall by CleanTalk
Plugin Slug: cleantalk-spam-protect
Plugin Developer: CleanTalk
Affected Versions: <= 5.173
CVE ID: CVE-2022-28221
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: 5.174.1
CleanTalk is a WordPress plugin designed to protect websites from spam comments and registrations. One of the features it includes is the ability to check comments for spam and present the spammy comments for deletion.
The plugin uses the column_ct_comment function in /lib/Cleantalk/ApbctWP/FindSpam/ListTable/Comments.php to display the list of spam comments, and in doing so generates links to approve, trash, or mark comments as spam using the value supplied in $_REQUEST[‘page’].
Thanks to a quirk of how WordPress processes the page parameter and the default PHP request order, it is possible to use this parameter to perform a reflected cross-site scripting attack, which is almost identical to a vulnerability we recently covered (https://email.wordfence.com/e3t/Ctc/GC+113/cwG7R04/VWyH9-9bcDccVffKwW5h910xVGwS3m4HgybWN2_Qd573kWFJV1-WJV7CgNgvN4sk7l6S5pYhW3RwYHq6GsK6QW1pJKcl8MWFK3W74DmyG8pyJrYW97sldm92C9V8W7wHKz25sqYtkW3QYgc52jFss-W5XxnmS5gbpMsW8gngml2WrRZ2W5jMKx748WfY9W1yWfPC28Gsd4W6L9b-g3pPQMtW6JjfWK8syNZbVj0Tfp9c9H45N2vP0sncLYbLW24s2rZ5y93x3W6Th-0s5SM_BMW8VBJRF8V7x8rW1Q-S3z1P9xLFW92hLnf1McrkFW8V_VDm7FM-3wW77pxyw7Tqk7GW8rcxNX6Y6pjlMyZK3MHZ8FrW7wzdJ7927wH8W1ntpm38D4Xm432XB1 ) .
The vulnerability 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 the site at wp-admin/edit-comments.php?page=ct_check_spam, with the $_POST[‘page’] parameter set to malicious JavaScript.
As with any Cross-Site Scripting vulnerability, executing JavaScript in an administrator’s session can be used to take over a site by adding a new malicious administrator or injecting a backdoor, among other potential methods.
Description: Reflected Cross-Site Scripting
Affected Plugin: Spam protection, AntiSpam, FireWall by CleanTalk
Plugin Slug: cleantalk-spam-protect
Plugin Developer: CleanTalk
Affected Versions: <= 5.173
CVE ID: CVE-2022-28222
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: 5.174.1
Similar to the spam comment functionality, CleanTalk also includes a feature that checks for spammy users and presents them in a similar table for review and deletion.
In this case the vulnerable function is column_ct_username in /lib/Cleantalk/ApbctWP/FindSpam/ListTable/Users.php, which uses the value of $_REQUEST[‘page’] to generate links to delete potentially spammy users.
As with the spam comment vulnerability, if an administrator can be tricked into performing an action, it is possible to use JavaScript running in their browser to take over a site.
Timeline
February 15, 2022 – The Wordfence Threat Intelligence team finishes our investigation and verifies that the Wordfence firewall’s built-in protection is sufficient to block exploit attempts. We send the full disclosure to a contact at CleanTalk that we have successfully disclosed vulnerabilities to in the past.
March 22, 2022 – As we have not yet heard back from our contact, we reported the vulnerability to the WordPress plugins team.
March 25, 2022 - A patched version of the plugin, 5.174.1, becomes available.
Conclusion
In today’s article, we covered two nearly identical reflected Cross-Site Scripting vulnerabilities in the Spam protection, AntiSpam, FireWall by CleanTalk plugin for WordPress. While both of these vulnerabilities require some degree of social engineering, both could be used for site takeover.