The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2022-21664

CVE-2022-21664: WordPress SQL Injection Vulnerability

CVE-2022-21664 is a SQL injection vulnerability in WordPress CMS caused by improper input sanitization. Attackers can execute unintended SQL queries. This article covers technical details, affected versions, and patches.

Published: February 17, 2026

CVE-2022-21664 Overview

CVE-2022-21664 is a SQL Injection vulnerability affecting WordPress, the widely-used open-source content management system written in PHP and paired with a MariaDB database. Due to lack of proper sanitization in the WP_Meta_Query and WP_Tax_Query classes, there is potential for unintended SQL queries to be executed. This vulnerability allows authenticated attackers with low privileges to manipulate database queries, potentially leading to unauthorized data access, data modification, or complete database compromise.

Critical Impact

Authenticated attackers can exploit improper alias sanitization in WordPress query classes to execute arbitrary SQL queries, potentially compromising the entire WordPress database including user credentials and sensitive content.

Affected Products

  • WordPress versions prior to 5.8.3 (with security patches backported to version 4.1.34)
  • Debian Linux 9.0, 10.0, and 11.0
  • Fedora 34 and 35

Discovery Timeline

  • January 6, 2022 - CVE-2022-21664 published to NVD
  • November 21, 2024 - Last updated in NVD database

Technical Details for CVE-2022-21664

Vulnerability Analysis

This SQL Injection vulnerability (CWE-89) stems from insufficient input validation in WordPress's query handling classes. The vulnerability exists within the WP_Meta_Query class (class-wp-meta-query.php) and the WP_Tax_Query class (class-wp-tax-query.php), where sibling alias values are used directly in SQL query construction without proper sanitization.

The attack requires network access and low-privilege authentication, but once these conditions are met, the exploitation complexity is low. A successful attack can result in complete compromise of confidentiality, integrity, and availability of the WordPress database.

Root Cause

The root cause of CVE-2022-21664 lies in the improper handling of the alias property when building SQL queries. In both WP_Meta_Query and WP_Tax_Query, when comparing clauses with compatible operators, the sibling's alias value was directly assigned without sanitization. This allowed non-word characters to be passed through, enabling SQL injection attacks.

The vulnerable code directly assigned $sibling['alias'] to $alias without filtering potentially malicious characters that could break out of the intended SQL context.

Attack Vector

The attack vector is network-based and requires an authenticated user with low privileges. An attacker could craft malicious input that includes SQL injection payloads through the alias parameter. When WordPress processes meta or taxonomy queries, the unsanitized alias value could be incorporated into the final SQL statement, allowing the attacker to:

  1. Extract sensitive data from the database
  2. Modify or delete database records
  3. Potentially escalate privileges by manipulating user tables
  4. Compromise the entire WordPress installation
php
// Security patch in src/wp-includes/class-wp-meta-query.php
// Before: Unsanitized alias assignment
// $alias = $sibling['alias'];
// After: Sanitized alias using regex to remove non-word characters

 			$clause_compare  = strtoupper( $clause['compare'] );
 			$sibling_compare = strtoupper( $sibling['compare'] );
 			if ( in_array( $clause_compare, $compatible_compares, true ) && in_array( $sibling_compare, $compatible_compares, true ) ) {
-				$alias = $sibling['alias'];
+				$alias = preg_replace( '/\W/', '_', $sibling['alias'] );
 				break;
 			}
 		}

Source: GitHub Commit Change

php
// Security patch in src/wp-includes/class-wp-tax-query.php
// Same sanitization pattern applied to taxonomy queries

 			// The sibling must both have compatible operator to share its alias.
 			if ( in_array( strtoupper( $sibling['operator'] ), $compatible_operators, true ) ) {
-				$alias = $sibling['alias'];
+				$alias = preg_replace( '/\W/', '_', $sibling['alias'] );
 				break;
 			}
 		}

Source: GitHub Commit Change

Detection Methods for CVE-2022-21664

Indicators of Compromise

  • Unusual database queries in MySQL/MariaDB slow query logs or general query logs containing unexpected SQL syntax
  • Error logs showing SQL syntax errors or database connection anomalies
  • Unexpected data modifications in wp_postmeta, wp_termmeta, or taxonomy tables
  • Authentication logs showing suspicious activity from low-privilege accounts followed by elevated data access

Detection Strategies

  • Monitor web application firewall (WAF) logs for SQL injection patterns targeting WordPress meta and taxonomy query endpoints
  • Implement database activity monitoring to detect anomalous query patterns or unauthorized data access
  • Review WordPress debug logs for unexpected query construction errors
  • Deploy intrusion detection signatures that identify SQL injection attempts in WordPress-specific parameters

Monitoring Recommendations

  • Enable MySQL/MariaDB general query logging temporarily to audit query patterns during incident investigation
  • Configure alerts for failed or unusual database queries originating from the WordPress application
  • Monitor file integrity of core WordPress files, particularly class-wp-meta-query.php and class-wp-tax-query.php
  • Track user activity logs for authenticated users performing unusual meta or taxonomy operations

How to Mitigate CVE-2022-21664

Immediate Actions Required

  • Update WordPress to version 5.8.3 or later immediately using the WordPress admin dashboard or WP-CLI
  • For older installations, apply the security releases available back to version 4.1.34
  • Enable WordPress auto-updates to ensure timely application of future security patches
  • Review database logs for any signs of prior exploitation attempts

Patch Information

WordPress has addressed this vulnerability in version 5.8.3, released as part of a security release on January 6, 2022. The fix applies regex sanitization using preg_replace('/\W/', '_', $sibling['alias']) to replace all non-word characters with underscores, effectively neutralizing SQL injection payloads. Security patches have been backported to all supported WordPress versions going back to 4.1.34.

For additional details, refer to the WordPress Security Release and the GitHub Security Advisory.

Debian users should apply updates per the Debian Security Advisory DSA-5039. Fedora users should update via the official Fedora package announcements.

Workarounds

  • There are no known workarounds for this vulnerability; updating WordPress is the only effective mitigation
  • As a temporary defense-in-depth measure, implement a web application firewall (WAF) with SQL injection detection rules
  • Consider restricting user registration and reducing the number of authenticated users until patches are applied
  • Enable WordPress maintenance mode to limit exposure while applying updates
bash
# Update WordPress via WP-CLI
wp core update

# Verify WordPress version after update
wp core version

# Enable auto-updates for future security releases
wp config set WP_AUTO_UPDATE_CORE true --raw

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

  • Vulnerability Details
  • TypeSQLI

  • Vendor/TechWordpress

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability3.75%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-89
  • Technical References
  • GitHub Commit Change

  • GitHub Security Advisory

  • Debian LTS Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Debian Security Advisory
  • Vendor Resources
  • WordPress Security Release
  • Related CVEs
  • CVE-2026-4668: WordPress Amelia Plugin SQLi Vulnerability

  • CVE-2026-2511: JS Help Desk WordPress Plugin SQL Injection

  • CVE-2026-4306: WP Job Portal SQL Injection Vulnerability

  • CVE-2026-2412: Quiz and Survey Master WordPress SQLi Flaw
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English