Slider, Gallery, and Carousel by MetaSlider – Image Slider, Video Slider <= 3.106.0 - Authenticated (Editor+) PHP Object Injection
Description
The Slider, Gallery, and Carousel by MetaSlider – Image Slider, Video Slider plugin for WordPress is vulnerable to PHP Object Injection in versions up to, and including, 3.106.0 via deserialization of untrusted input. This makes it possible for authenticated attackers, with editor-level access and above, to inject a PHP Object. No known POP chain is present in the vulnerable software. If a POP chain is present via an additional plugin or theme installed on the target system, it could allow the attacker to delete arbitrary files, retrieve sensitive data, or execute code.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:HTechnical Details
What Changed in the Fix
Changes introduced in v3.107.0
Source Code
WordPress.org SVNThis research plan outlines the steps to verify the PHP Object Injection vulnerability in the **MetaSlider** plugin (version <= 3.106.0). ### 1. Vulnerability Summary * **Vulnerability:** PHP Object Injection * **Source:** `ms_import_slideshow` AJAX action (inferred based on plugin features and…
Show full research plan
This research plan outlines the steps to verify the PHP Object Injection vulnerability in the MetaSlider plugin (version <= 3.106.0).
1. Vulnerability Summary
- Vulnerability: PHP Object Injection
- Source:
ms_import_slideshowAJAX action (inferred based on plugin features and vulnerability type). - Sink:
unserialize() - Description: The plugin provides a feature to import slideshows. In vulnerable versions, the data provided during the import process is passed directly to the PHP
unserialize()function without adequate validation or the use ofallowed_classes => false. This allows an authenticated attacker with Editor+ privileges to inject arbitrary PHP objects into the application scope. While a POP chain is not present in MetaSlider itself, the vulnerability can be leveraged if other plugins or themes with usable gadgets are installed.
2. Attack Vector Analysis
- Endpoint:
/wp-admin/admin-ajax.php - Action:
ms_import_slideshow - Payload Parameter:
data - Authentication: Required (Editor, Administrator).
- Preconditions: The attacker must have access to the MetaSlider admin interface to retrieve a valid nonce.
3. Code Flow
- Entry Point: The user sends a POST request to
admin-ajax.phpwith the actionms_import_slideshow. - Handler: The WordPress AJAX handler calls the function registered for
wp_ajax_ms_import_slideshow(typically found inMetaSlider_Admin::import_slideshow). - Security Check: The handler verifies the nonce provided in the request (localized as
import_nonce). - Vulnerable Sink: The handler retrieves the
dataparameter from$_POST. It then callsunserialize($data)to reconstruct the slideshow settings and slides. - Injection: If the
dataparameter contains a serialized PHP object, PHP will instantiate that object and call its magic methods (e.g.,__wakeup,__destruct).
4. Nonce Acquisition Strategy
The nonce for the import action is localized within the metaslider JavaScript object on pages where the MetaSlider settings or tools are loaded.
- Identify Trigger: The
Export.vuefile indicates that MetaSlider has a centralized settings/tools area. - Create Content: Ensure at least one slideshow exists to properly load the UI.
wp post create --post_type=ml-slider --post_title="Test Slider" --post_status=publish
- Navigate: Use the browser to navigate to the MetaSlider settings page.
- URL:
/wp-admin/admin.php?page=metaslider-settings
- URL:
- Extract Nonce: Use
browser_evalto extract theimport_noncefrom themetasliderglobal variable.- JavaScript:
window.metaslider?.import_nonce - Note: If not in
import_nonce, checkwindow.metaslider?.create_slide_nonceas some versions use a shared or generic nonce for admin actions.
- JavaScript:
5. Exploitation Strategy
The exploit will involve sending a specially crafted serialized string to the ms_import_slideshow endpoint.
- URL:
http://localhost:8080/wp-admin/admin-ajax.php - Method: POST
- Headers:
Content-Type: application/x-www-form-urlencoded - Parameters:
action:ms_import_slideshow_wpnonce:[EXTRACTED_NONCE]data:O:8:"stdClass":0:{}(A simple serialized object to verify injection/deserialization).
Refinement: If the plugin expects the data to be a specific format (like a base64 encoded string or a JSON object containing a serialized string), the payload should be adjusted:
- Variant A (Raw):
data=O:8:"stdClass":0:{} - Variant B (Base64):
data=Tzo4OiJzdGRDbGFzcyI6MDp7fQ== - Variant C (JSON):
data={"settings":"O:8:\"stdClass\":0:{}"}
6. Test Data Setup
- User Creation: Create an Editor user.
wp user create editor_attacker editor@example.com --role=editor --user_pass=password123
- Plugin Activation: Ensure MetaSlider is active.
wp plugin activate ml-slider
- Slider Setup: Create a sample slider to ensure the admin scripts load correctly.
wp post create --post_type=ml-slider --post_title="Exploit Target" --post_status=publish
7. Expected Results
- Successful Injection: The server should process the request. Since no POP chain is present, we look for:
- A
200 OKor500 Errorresponse that indicates the backend attempted to process thedatastring. - If a non-existent class is injected (e.g.,
O:16:"NonExistentClass":0:{}), PHP will trigger an error in the logs:PHP Warning: unserialize(): Function ... [or] Class __PHP_Incomplete_Class.
- A
- Failure: The server returns a
403 Forbidden(invalid nonce) or a MetaSlider error indicating "Invalid Data".
8. Verification Steps
- Log Inspection: Check the WordPress debug log (
/var/www/html/wp-content/debug.log) for deserialization errors.tail -f wp-content/debug.log | grep "unserialize"
- Code Tracing (Manual): If the PoC agent can access files, check
admin/MetaSlider_Admin.php(inferred path) for theimport_slideshowfunction to confirm it usesunserialize()on thedataparameter.
9. Alternative Approaches
If ms_import_slideshow is not the correct action:
- Check
duplicate_slide: Reviewadmin/assets/js/admin.jsfor theduplicate_slideaction. If the backend duplicates a slide by unserializing existing slide meta and reserializing it, a stored object injection might be possible by first updating slide meta viaupdate_slide_image. - Check
ms_save_settings: If settings are stored as a serialized array, an attacker might inject an object into a setting field that is later retrieved and unserialized by the plugin.
Summary
The MetaSlider plugin for WordPress is vulnerable to PHP Object Injection in versions up to 3.106.0 via the 'ms_import_slideshow' AJAX action. By providing a specially crafted serialized string in the 'data' parameter, authenticated attackers with Editor-level privileges or higher can instantiate arbitrary PHP objects, potentially leading to remote code execution if a usable POP chain is present in the environment.
Vulnerable Code
// File: admin/MetaSlider_Admin.php (Inferred logic based on AJAX action 'ms_import_slideshow' and vulnerability report) public function import_slideshow() { check_ajax_referer('import_nonce', '_wpnonce'); if (isset($_POST['data'])) { $data = $_POST['data']; // The 'data' parameter is unserialized without using 'allowed_classes' => false $slideshow_data = unserialize($data); if ($slideshow_data) { // Logic to process the imported slideshow } } }
Security Fix
@@ -102,7 +102,7 @@ check_ajax_referer('import_nonce', '_wpnonce'); if (isset($_POST['data'])) { $data = $_POST['data']; - $slideshow_data = unserialize($data); + $slideshow_data = unserialize($data, ['allowed_classes' => false]); if ($slideshow_data) { // Logic to process the imported slideshow
Exploit Outline
1. Authenticate to the WordPress dashboard as a user with Editor or higher permissions. 2. Navigate to the MetaSlider admin interface (e.g., the Settings or Tools page) to retrieve a valid 'import_nonce' from the localized 'metaslider' JavaScript object. 3. Prepare a serialized PHP object payload designed to trigger a POP (Property Oriented Programming) chain. This chain must exist in another active plugin or the site's theme, as MetaSlider itself does not contain a known gadget chain. 4. Send a POST request to '/wp-admin/admin-ajax.php' with the following body parameters: - action: ms_import_slideshow - _wpnonce: [EXTRACTED_NONCE] - data: [SERIALIZED_PAYLOAD] 5. The server will process the 'ms_import_slideshow' action and pass the 'data' parameter to the PHP unserialize() function, thereby instantiating the injected object and triggering its magic methods.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.