13 Feb 2023

WordPress Plugin Security Review: ShortPixel Image Optimizer

For our 41st security review of a WordPress plugin based on the voting of our customers, we reviewed the plugin ShortPixel Image Optimizer.

If you are not yet a customer of the service, once you sign up for the service as a paying customer, you can start suggesting and voting on plugins to get security reviews. For those already using the service that haven’t already suggested and voted for plugins to receive a review, you can start doing that here. You can use our tool for doing limited automated security checks of plugins to see if plugins you are using have possible issues that would make them good candidates to get a review. You can also order a review of a plugin separately from our service.

The review was done on version 5.1.6 of ShortPixel Image Optimizer. We checked for the following issues during it as part of our standard review:

  • Insecure file upload handling (this is the cause of the most exploited type of vulnerability, arbitrary file upload)
  • Deserialization of untrusted data
  • Security issues with functions accessible through WordPress’ AJAX functionality (those have and continued to be a common source of disclosed vulnerabilities)
  • Security issues with functions accessible through WordPress’ REST API (those have started to be a source of disclosed vulnerabilities)
  • Persistent cross-site scripting (XSS) vulnerabilities in the frontend portions of the plugin and in the admin portions accessible to users with the Author role or below
  • Cross-site request forgery (CSRF) vulnerabilities in the admin portion of the plugin
  • SQL injection vulnerabilities (the code that handles requests to the database)
  • Reflected cross-site scripting (XSS) vulnerabilities
  • Security issues with functions accessible through any of the plugin’s shortcodes
  • Security issues with functions accessible through the admin_action action
  • Security issues with functions accessible through the admin_init action
  • Security issues with functions accessible through the admin_post action
  • Security issues with import/export functionality
  • Security issues with usage of the is_admin() function
  • Security issues with usage of the add_option(), delete_option(), and update_option() functions
  • Security issues with usage of the update_user_meta() and wp_update_user () functions
  • Security issues with usage of the extract() function
  • Lack of IP address validation
  • Proper usage of sanitize_callback when using register_setting() to register settings.
  • CSV injection
  • Host header injection vulnerabilities
  • Lack of protection against unintended direct access of PHP files
  • Insecure and unwarranted requests to third-party websites
  • Any additional possible issues identified by our Plugin Security Checker

Results

We found the plugin contained a vulnerability and several places where security could be improved, which are detailed below.

We contacted the developer about the results through their website on January 13. They replied the same day that they were evaluating the results and would get back to us. Six days later, they responded that they would be addressing some of the issues in the next version, 5.2.0. So far that hasn’t been released. In line with our disclosure policy, as it has now been 30 days since notifying the developer, we are releasing the results.

Cross-Site Request Forgery (CSRF) Vulnerability

In the file /class/Controller/SettingsController.php, the functions action_addkey() and action_request_new_key() fail to check for a valid nonce to prevent cross-site request forgery (CSRF). It looks like that might be intended to be done by the function checkPost() they call, but that just returns false if there isn’t a valid nonce. Other functions in the file also are missing a nonce check.

Missing Capabilities Checks

The AJAX accessible functions ajax_checkquota(), ajax_getBackupFolderSize(), ajax_getItemView(), ajax_proposeQuotaUpgrade(), and ajaxRequest() in /class/Controller/AjaxController.php lack a capabilities check to limit access to the intended users. There is a nonce check, which would normally do the equivalent of that, but as the documentation for that states, it shouldn’t be relied on for that:

Nonces should never be relied on for authentication, authorization, or access control.

The same issue exists with the function ajax_action() in the file /build/shortpixel/notices/src/NoticeController.php.

Lack of Protection Against Direct Access to PHP Files

The plugin’s .php files that didn’t appear to be intended to be directly accessed don’t contain protection against direct access, but others were missing that. We didn’t see anything that could be exploited in the files without the restriction in place, but restricting access to them would ensure that there isn’t any issue with that.

Leave a Reply

Your email address will not be published.