This article analyses the Elementor PRO Vulnerability vulnerabilities.
Elementor PRO is a page builder for WordPress with approximately 1+ million users. On the 4th of May, many websites had a suspicious subscriber registering to the site that logged in and managed to upload malicious attachments.
Split seconds later - another IP was trying to access the attachments:
The POST request to this backdoor looks something like below. The backdoor allows the malicious user to execute any PHP function with any arguments they specify.
In this specific scenario, they uploaded a file to a "tmp" directory with a certain payload which the malicious user can use to verify if the site has been successfully infected.
[c] => file_put_contents
[f] => /tmp/….
The exploitataion of Elementor Pro vulnerability
The Elementor PRO vulnerability allowed any user to upload malicious files which lead to remote code execution. It was only possible to attack sites that had any kind of registration open (that includes most WooCommerce stores, LMS sites, etc.).
Now the second vulnerability allowed the attacker to remove this limitation. A vulnerability in the Ultimate Addons For Elementor allowed the attacker to create an account, even if registrations were turned off, and continue with the Elementor PRO vulnerability exploitation.
Elementor Pro < 2.9.4 - Authenticated Arbitrary File Upload
The arbitrary upload vulnerability in the Elementor Pro plugin allowed any authenticated user, regardless of their user role, to submit an AJAX request behind the scenes that allowed them to upload any files to the upload directory.
This function was missing a permission check and a proper file extension check which allowed the vulnerability to exist. This in combination with the registration bypass exploit (or open registration on the site), allowed hackers to easily exploit the combination of these issues to upload malware to the site. Since no suspicious payload was involved, most firewalls did not detect anything suspicious.
The issue was fixed in version 2.9.4 which added a permission and file extension check against the upload action.
Ultimate Addons for Elementor < 1.24.2 - Registration Bypass
In order for a malicious user to exploit the arbitrary upload vulnerability, authenticated is required. In case a site does not have registrations open to the public and the Ultimate Addons for Elementor plugin has been installed, they can exploit the registration bypass vulnerability in the plugin to create an account.
This issue exists in the registration form module, which is registered using an AJAX action. This AJAX action was missing 2 checks: whether or not the site allows registrations and whether or not the module itself has been activated by the administrator of the site.
In version 1.24.2 of the Ultimate Addons for Elementor plugin, they added 2 checks: whether or not registrations are open and if the registration form module has been activated. Only if it meets these 2 conditions will it process the request further down the chain.
Analysis of the wpstaff.php malware
One of the files that are uploaded on the server upon successful exploitation is a "wpstaff.php" file. This file contains a large comment block that makes it seem like a legitimate plugin but a quick look at the PHP code will make it obvious that there is something suspicious going on.
Upon execution of this file, it will attempt to write a file called "wp-xmlrpc.php" into the root of the WordPress site. This file is essentially a password-protected backdoor that allows the malicious user to do pretty much anything with the server as they please.
Some of the functions include getting server information, execute shell commands, execute raw PHP code (eval), alter the file system in any way they please, and download any files present on the server.
Once this file has been created in the root of the WordPress site, it will print "fuckoffffff" on the screen. Most likely to indicate to the malicious user that it successfully created the backdoor on the site.
After this, it will delete itself (the current file and directory) and the only trace left is the "wp-xmlrpc.php" file in the root of the WordPress site.
Steps to take if you think you've been affected with the Elementor Pro vulnerability
First, update both Elementor PRO and Ultimate Addons for Elementor to the latest versions. Next, check the users on your WordPress site and if there are any new or suspicious users.
If you have registrations open and many users sign-up to your site on a regular basis, search for the "Subscriber names" we have collected in the IOC section below.
After you have updated the plugins and deleted the malicious users, look at your website's files and see if there are any PHP or other unwanted files in the /wp-content/uploads/elementor/custom-icons/ directory.
Make sure to take a look inside all the folders within /wp-content/uploads/elementor/custom-icons/. Finally, make sure to delete the wp-xmlrpc.php file in the root of your WordPress site, if present.
List of indicators of compromise (IOC)
Here is a list of subscriber, file, and folder names with IP addresses that are associated with the attacks.
Subscriber names and email addresses:
- jicato3848jicato3848jicato3848jicato3848jicato3848jicato3848jicato3848jicato3848 jicato3848jicato3848jicato3848jicato3848jicato3848jicato3848jicato3848jicato3848 jicato3848jicato3848jicato3848jicato3848jicato3848jicato3848jicato3848jicato3848 (split on 3 lines in this post, as 1 string in the payload)
Files within /wp-content/uploads/elementor/custom-icons/:
- Read Mw.txt
Files within the root of the WordPress site:
The first wave of attacks:
Second wave of attacks:
May 4th, 2020 - First attacks spotted in the wild
May 4th, 2020 - Vulnerability fixed in Ultimate Addons for Elementor version 1.24.2
May 7th, 2020 - Firewall rules and vPatches released to all Patchstack users
May 7th, 2020 - Vulnerability fixed in Elementor PRO version 2.9.4
Is the Elementor Pro vulnerability patched?
The arbitrary upload vulnerability in the Elementor Pro plugin is patched in version 2.9.4. Firewall rules and vPatches have been released to all Patchstack users.
How critical is the Elementor Pro arbitrary file upload vulnerability?
It is a critical vulnerability that allowed any user to upload malicious files and could lead to remote code execution. It was only possible to attack sites that had any kind of registration open (that includes most WooCommerce stores, LMS sites, etc.).
What to do if my website is hacked?
First, update both Elementor PRO and Ultimate Addons for Elementor to the latest versions. Next, check the users on your WordPress site and if there are any new or suspicious users. If you have registrations open and many users sign-up to your site on a regular basis, search for the "Subscriber names" we have collected in the IOC section below.
After you have updated the plugins and deleted the malicious users, look at your website's files and see if there are any PHP or other unwanted files in the /wp-content/uploads/elementor/custom-icons/ directory. Make sure to take a look inside all the folders within /wp-content/uploads/elementor/custom-icons/.
If you see any suspicious users or unwanted files contact Patchstack support for help.