Recently Closed WordPress Plugin with 40,000+ Installs Contains Authenticated Persistent XSS Vulnerability
The WordPress plugin Timetable and Event Schedule was closed on the WordPress Plugin Directory on Monday. That is one of the 1,000 most popular plugins with 40,000+ installs, so we were alerted to its closure. While we were looking in to the plugin to see if there were any serious vulnerabilities we should be warning users of the plugin that also use our service, we found multiple insecurities and we confirmed that there is an authenticated persistent cross-site scripting (XSS) vulnerability.
There also appears to be a related authenticated SQL injection vulnerability, though we didn’t confirm that. We would recommend not using the plugin until a thorough security review is done and additional security issues are addressed.
We tested and confirmed that our upcoming firewall plugin for WordPress protects against the exploitation of this vulnerability.
Authenticated Persistent Cross-Site Scripting (XSS)
The plugin has shortcode that is accessed through “mp-timetable”:
42 | add_shortcode( 'mp-timetable', array( $this, "show_shortcode" ) ); |
The function called show_shortcode(), which is located in the file /classes/class-shortcode.php, doesn’t do any validation or sanitization when bringing user input, in the form of shortcode attributes, in to the code:
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | public function show_shortcode( $params ) { global $mptt_shortcode_data; $this->add_plugin_js( 'shortcode' ); if ( empty( $params ) ) { $params = array(); } $mptt_shortcode_data = array(); $mptt_shortcode_data[ 'params' ] = $params = shortcode_atts( array( 'events' => "", 'event_categ' => "", 'col' => "", 'increment' => "1", // 1 | 0.5 | 0.25 'view' => "dropdown_list", // dropdown_list | tabs 'view_sort' => "", // '' | menu_order || post_title 'label' => __( "All Events", 'mp-timetable' ), 'hide_label' => "0", 'title' => "0", 'time' => "0", 'group' => "0", 'sub-title' => "0", 'description' => "0", 'user' => "0", 'hide_hrs' => "0", 'hide_empty_rows' => "1", 'text_align_vertical' => "default", // default | top | middle | bottom 'row_height' => "45", 'font_size' => "", 'disable_event_url' => "0", 'text_align' => "center", // left | center | right 'id' => "", 'custom_class' => "", 'responsive' => "1", 'table_layout' => "" // default | auto | fixed ), $params ); |
We found that the shortcode attribute “custom_class” is output without also being escaped. The relevant code is this line in the function mptt_shortcode_template_event in the file /templates-functions/action-shortcode-functions.php:
121 | $table_class = apply_filters( 'mptt_shortcode_static_table_class', 'mptt-shortcode-table' ) . ' ' . $params[ 'custom_class' ]; |
That may also occur in a second location in the same file.
As the proof of concept below confirms, that permits cross-site scripting to occur. By default, users with the Editor and Administrator roles can already do the equivalent of that due having the “unfiltered_html” capability, so it wouldn’t be a vulnerability for them to do that, but it would be for lower level users.
WordPress Causes Full Disclosure
Because 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).
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
Creating a new post as a user with the Author role, which doesn’t have the unfiltered_html, with the following shortcode will cause an alert box with any available cookies to be shown when hovering over the plugin’s content on the page.
[mp-timetable custom_class='"onmouseover="alert(document.cookie);']