Skip to main content
CVE Vulnerability Database

CVE-2024-9018: WP Easy Gallery SQL Injection Vulnerability

CVE-2024-9018 is a time-based SQL injection flaw in the WP Easy Gallery WordPress plugin that enables authenticated attackers to extract sensitive database information. This article covers technical details, affected versions, and mitigation.

Published:

CVE-2024-9018 Overview

CVE-2024-9018 is a time-based SQL injection vulnerability in the WP Easy Gallery WordPress plugin developed by plugingarden. The flaw affects all versions up to and including 4.8.5. The key parameter is passed into an SQL query without sufficient escaping or preparation, allowing authenticated attackers with Contributor-level access or higher to append arbitrary SQL statements. Successful exploitation enables extraction of sensitive data from the WordPress database, including user credentials, session tokens, and configuration secrets. The vulnerability is classified under CWE-89 (Improper Neutralization of Special Elements used in an SQL Command).

Critical Impact

Contributor-level attackers can exfiltrate arbitrary database contents, including WordPress user password hashes and secret keys, leading to full site compromise.

Affected Products

  • Plugingarden WP Easy Gallery – WordPress Gallery Plugin, all versions up to and including 4.8.5
  • WordPress sites running the plugin with Contributor-level (or higher) user registration enabled
  • CPE: cpe:2.3:a:plugingarden:wp_easy_gallery:*:*:*:*:*:wordpress:*:*

Discovery Timeline

  • 2024-10-01 - CVE-2024-9018 published to the National Vulnerability Database (NVD)
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-9018

Vulnerability Analysis

The vulnerability resides in the request-handling logic of wp-easy-gallery.php, referenced at approximately line 866 of the plugin trunk. The key request parameter is concatenated into an SQL query executed against the WordPress database without invoking $wpdb->prepare() or applying esc_sql() sanitization. Because the raw user input reaches the query planner, an attacker can inject SQL fragments that alter query semantics.

The injection is time-based, meaning the response body does not directly leak query results. Instead, attackers use conditional SLEEP() payloads or database-specific timing functions to infer data byte by byte. This blind extraction technique reliably retrieves table contents such as wp_users.user_pass hashes and wp_options.option_value secrets.

Root Cause

The plugin trusts the key parameter as an internal identifier and interpolates it directly into an SQL statement string. WordPress's $wpdb abstraction provides parameterized query support, but the plugin bypasses it, violating the WordPress plugin security guidelines for database access.

Attack Vector

An authenticated user with Contributor role or higher submits a crafted request containing malicious SQL syntax in the key parameter. The attacker measures response latency to determine boolean conditions and reconstructs sensitive fields character by character. See the Wordfence Vulnerability Report and the WordPress Plugin Source Code for the vulnerable code path.

Detection Methods for CVE-2024-9018

Indicators of Compromise

  • HTTP requests to WP Easy Gallery endpoints containing SQL keywords such as SLEEP, BENCHMARK, UNION, or SELECT inside the key parameter
  • Anomalous WordPress database query latency correlated with Contributor account activity
  • New or unexpected administrator accounts, altered wp_options values, or modified user password hashes following suspicious plugin requests
  • Access log entries from low-privilege authenticated users targeting plugin AJAX or admin-post handlers

Detection Strategies

  • Deploy a Web Application Firewall (WAF) rule that inspects the key parameter for SQL metacharacters and time-delay function names
  • Enable WordPress query logging or SAVEQUERIES in staging to identify unparameterized queries originating from the plugin
  • Correlate authenticated Contributor-level sessions with unusual request-response timing patterns exceeding baseline thresholds

Monitoring Recommendations

  • Alert on repeated slow HTTP responses from /wp-admin/ endpoints tied to a single authenticated session
  • Monitor WordPress user role changes and creation of privileged accounts through file integrity and audit logging
  • Track outbound egress from the web tier for signs of exfiltrated database contents

How to Mitigate CVE-2024-9018

Immediate Actions Required

  • Deactivate and remove the WP Easy Gallery plugin until a patched version is confirmed installed
  • Audit all WordPress user accounts and revoke unnecessary Contributor, Author, or Editor privileges
  • Rotate WordPress authentication secrets in wp-config.php and force password resets for all users
  • Review recent database changes and web server access logs for indicators of exploitation

Patch Information

No patched version is referenced in the NVD entry at the time of publication. Site owners should monitor the WordPress Plugin Developer Resources page for a release addressing the key parameter handling in wp-easy-gallery.php. Until a fixed version is available, treat any deployment running version 4.8.5 or earlier as vulnerable.

Workarounds

  • Restrict user registration and require administrator approval for new Contributor accounts
  • Add a WAF signature blocking SQL metacharacters and timing function names in requests targeting the plugin
  • Apply the principle of least privilege by removing Contributor and higher roles from users who do not require content creation access
  • Isolate the WordPress database account so it cannot read tables outside the WordPress schema

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.