WordPress Plugin With 100,000+ Installs Contains Post Duplication Vulnerability
On Monday we had what looked to be a hacker probing for usage of the WordPress plugin Email Subscribers, which has 100,000+ installs, on our website. There are several possible explanations for that. One involves a fairly misleading claim about a vulnerability being fixed in the plugin recently.
As part of assessing the situation, we started checking for the possibility that plugin currently contains a more serious vulnerability. What we found is that the plugin is that the plugin is lacking basic security checks in places and other code seems insecurely designed. We would recommend not using the plugin unless it has had a thorough security review done and all the issues found addressed.
As an example of the insecurity, we found the plugin allows even those not logged in to WordPress to duplicate arbitrary WordPress posts, which would include not just blog posts, but any data stored as a post. That could potentially be used in a denial of service attack, by filing the database with duplicate posts.
The plugin registers the function duplicate_message to run during admin_init:
22 | add_action( 'admin_init', array( &$this, 'duplicate_message' ), 10, 1 ); |
By accessing the right URL that will run even for those not logged in to WordPress.
That function, which is located in the file /lite/includes/classes/class-es-templates-table.php, will pass the GET or POST input template_id to another function in the plugin duplicate_in_db():
208 209 210 211 212 213 | public function duplicate_message() { $action = ig_es_get_request_data( 'action' ); $template_id = ig_es_get_request_data( 'template_id' ); if ( ! empty( $template_id ) && 'duplicate-template' === $action ) { // duplicate tempalte $this->duplicate_in_db( $template_id ); |
No security checks are done before doing that.
duplicate_in_db(), which is located in the same file, also does no security checks before duplicating the post with the ID passed from the previous function:
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | public function duplicate_in_db( $original_id ) { // Get access to the database global $wpdb; // Get the post as an array $duplicate = get_post( $original_id, 'ARRAY_A' ); // Modify some of the elements $duplicate['post_title'] = $duplicate['post_title'] . ' ' . __( 'Copy', 'email-subscribers' ); $duplicate['post_status'] = 'draft'; // Set the post date $timestamp = current_time( 'timestamp', 0 ); $duplicate['post_date'] = gmdate( 'Y-m-d H:i:s', $timestamp ); // Remove some of the keys unset( $duplicate['ID'] ); unset( $duplicate['guid'] ); unset( $duplicate['comment_count'] ); $current_user_id = get_current_user_id(); if ( ! empty( $current_user_id ) ) { // Set post author to current logged in author. $duplicate['post_author'] = $current_user_id; } // Insert the post into the database $duplicate_id = wp_insert_post( $duplicate ); |
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.
Proof of Concept
The following proof of concept will cause the specified post to be duplicated.
Replace “[path to WordPress]” with the location of WordPress and “[post ID] with the ID of the post to be duplicated.
http://[path to WordPress]/wp-admin/admin-post.php?action=duplicate-template&template_id=[post ID]