Authenticated Persistent Cross-Site Scripting Vulnerability in Google Language Translator WordPress Plugin
The most recent version of the WordPress plugin Google Language Translator, 6.0.10, includes a change that “added url satinization to avoid XSS injections”. There are a couple of problems with that. First, because of the way the developer added the new version, it is not being made available either to existing or new users of the plugin. They are both being provided with 6.0.9 still. Second, the escaping (not sanitization) added, is missing elsewhere in the same lines of code, leading to an authenticated persistent cross-site scripting (XSS) vulnerability still being in the plugin.
We confirmed that there is an exploitable instance of this with the first line that was changed in the new version.
The code is in the function google_translator_menu_language(), which runs when using the glt shortcode:
142 | add_shortcode( 'glt', array(&$this, 'google_translator_menu_language')); |
The first thing that happens in that function, which is in the file /google-language-translator.php, shouldn’t be happening, as the code using the extract() function on user input, in the form of shortcode attributes:
291 292 293 294 295 296 297 298 299 | public function google_translator_menu_language($atts, $content = '') { extract(shortcode_atts(array( "language" => 'Spanish', "label" => 'Spanish', "image" => 'no', "text" => 'yes', "image_size" => '24', "label" => 'Español' ), $atts)); |
That is something that PHP’s documentation warns not to do:
Do not use extract() on untrusted data, like user input (e.g. $_GET, $_FILES).
If the plugin is run through our Plugin Security Checker tool that is warned about, as well as in other plugin that have the same issue.
Some of the values that were extracted with that line are then output without escaping in the line of the function changed in the new version:
340 | return "<a href='".esc_url($href)."' class='nturl notranslate ".$language_code." ".$language_name_flag." single-language flag' title='".$language."'>".($image=='yes' ? "<span class='flag size".$image_size."'></span>" : '') .($text=='yes' ? $label : '')."</a>"; |
That allows for XSS to occur, though by default, high level WordPress users are allowed to do the equivalent of that as they have the unfiltered_html capability. But as the proof of concept below confirms, a user with the Author, which doesn’t have that capability, can exploit this.
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.
[glt language="' onmouseover='alert(document.cookie)'"]