Hacker Exploiting Unfixed Vulnerability in WooCommerce Extending Plugin MultiSafepay
The security of plugins that extend the WordPress ecommerce plugin WooCommerce is often poor, something that the developer of WooCommerce, Automattic, hasn’t taken an interest in addressing. Another part of Automattic claims to provide some protection against that, but isn’t delivering that. Automattic’s WPScan is promoted with this claim:
Be the first to know about vulnerabilities affecting your WordPress installation, plugins, and themes.
Contrary to that, they don’t currently warn their customers of any vulnerabilities in the WooCommerce extending plugin MultiSafepay:
That is despite a hacker exploiting an unfixed vulnerability in the plugin since at least Thursday.
From third-party data we monitor, we ran across this hacking attempt occurring on that day:
/wp-admin/admin-ajax.php?action=download_multisafepay_logs&log_filename=../../../wp-config.php
What that suggests is that a hacker was trying to exploit a vulnerability to view the contents of the WordPress configuration file, which contains the database credentials for the website and possibly other sensitive information. We were able to identify that would be an exploit attempt against MultiSafepay and that the current version of the plugin contains the vulnerability. More on that below.
Thankfully, none of the customers of our main service are currently using the plugin. Though our customer already had protection available, as we tested and confirmed that our firewall plugin for WordPress already protected against exploitation, even before we discovered the vulnerability, as part of its protection against zero-day vulnerabilities.
We have updated our Plugin Security Checker to flag code similar to this.
Arbitrary File Viewing
The exploit attempt shown above would suggest slightly different code being vulnerable than really is, as it looks like the request is being run through WordPress’ AJAX functionality, but it isn’t.
Instead the plugin registers the function download_multisafepay_logs() to be run during admin_init:
106 | $this->loader->add_action( 'admin_init', $plugin_settings, 'download_multisafepay_logs' ); |
That makes it accessible to even those not logged in to WordPress.
That function will output the contents of a file specified by the GET input “log_filename”:
142 143 144 145 146 147 148 149 150 151 152 153 | public function download_multisafepay_logs() { if ( ! empty( $_GET['log_filename'] ) ) { $file = WC_LOG_DIR . $_GET['log_filename']; if ( file_exists( $file ) && filesize( $file ) > 0 && is_admin() ) { header( 'Pragma: public' ); header( 'Expires: 0' ); header( 'Content-Description: File Transfer' ); header( 'Content-Type: application/octet-stream' ); header( 'Content-Disposition: attachment; filename="' . $_GET['log_filename'] ); header( 'Content-Transfer-Encoding: binary' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_readfile readfile( $file, true ); |
Through directory traversal any file on the server can be viewed through that.
WordPress Causes Full Disclosure
As a protest of the moderators of the WordPress Support Forum’s continued inappropriate behavior we changed from reasonably disclosing to full disclosing vulnerabilities for plugins in the WordPress Plugin Directory in protest, until WordPress gets that situation cleaned up, so we are releasing this post and then leaving a message about that for the developer through the WordPress Support Forum. (For plugins that are also in the ClassicPress Plugin Directory, we will follow our reasonable disclosure policy.)
You can notify the developer of this issue on the forum as well.
Hopefully, the moderators will finally see the light and clean up their act soon, so these full disclosures will no longer be needed (we hope they end soon). You would think they would have already done that, but considering that they believe that having plugins, which have millions installs, remain in the Plugin Directory despite them knowing they are vulnerable is “appropriate action”, something is very amiss with them (which is even more reason the moderation needs to be cleaned up).
If the moderation is cleaned up, it would also allow the possibility of being able to use the forum to start discussing fixing the problems caused by the very problematic handling of security by the team running the Plugin Directory, discussions which they have for years shut down through their control of the Support Forum.
Update: To clear up the confusion where developers claim we hadn’t tried to notify them through the Support Forum (while at the same time moderators are complaining about us doing just that), here is the message we left for this vulnerability:
Is It Fixed?
If you are reading this post down the road the best way to find out if this vulnerability or other WordPress plugin vulnerabilities in plugins you use have been fixed is to sign up for our service, since what we uniquely do when it comes to that type of data is to test to see if vulnerabilities have really been fixed. Relying on the developer’s information can lead you astray, as we often find that they believe they have fixed vulnerabilities, but have failed to do that.