Authenticated PHP Object Injection Vulnerability in Media Library Assistant
We recently started proactively monitoring for evidence of some high risk vulnerabilities when changes are made to WordPress plugins and if we had more customers we could expand the proactive monitoring to more types of vulnerabilities. One of the types of vulnerabilities we are looking for are PHP object injection vulnerabilities since those are likely to be exploited if hackers become aware of them. Through that we came across an authenticated PHP object injection vulnerability in the plugin Media Library Assistant.
The plugin makes it’s Media Library Assistant page in the admin area viable to users with the upload_files capability, which is normally available to Author-level and above users (in the file /includes/class-mla-main.php):
441 | $hook = add_submenu_page( 'upload.php', $page_title, $menu_title, 'upload_files', MLACore::ADMIN_PAGE_SLUG, 'MLA::mla_render_admin_page' ); |
When that page is accessed the function get_views() in the class MLA_List_Table, which is located in the file /includes/class-mla-list-table.php, will run. If a request is sent to the page without a GET or POST input “post_mime_type” and with a GET or POST input “meta_query” then value of “meta_query” will be unserialized, which permits PHP object injection to occur:
1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 | function get_views( ) { /* * Find current view */ if ( $this->detached ) { $current_view = 'detached'; } elseif ( $this->attached ) { $current_view = 'attached'; } elseif ( $this->is_trash ) { $current_view = 'trash'; } elseif ( empty( $_REQUEST['post_mime_type'] ) ) { if ( isset( $_REQUEST['meta_query'] ) ) { $query = unserialize( stripslashes( $_REQUEST['meta_query'] ) ); |
The vulnerability can also be exploited through cross-site request forgery (CSRF).
The developer put in fix for the vulnerability in the development version of the plugin the same day we notified them of it, but a new version still has yet to be released a month later. In line with our disclosure policy, which is based on the need to provide our customers with information on vulnerabilities on a timely basis, we are now disclosing this vulnerability.
Update 10/19/17: Version 2.6.1 has now been released, which fixes the vulnerability by replacing the usage of unserialize() with json_decode() (as well replacing related usage or serialize() with json_encode().
Proof of Concept
With our plugin for testing for PHP object injection installed and activated, visiting the following URL while logged in to WordPress as an Author-level user will cause the message “PHP object injection has occurred.” to be shown.
Make sure to replace “[path to WordPress]” with the location of WordPress.
http://[path to WordPress]/wp-admin/upload.php?page=mla-menu&meta_query=O:20:"php_object_injection":0:{}
Timeline
- August 3, 2017 – Developer notified.
- August 3, 2017 – Developer responds.
- October 16, 2017 – Version 2.6.1 released, which fixes vulnerability.