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
    • Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • 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-21661

CVE-2022-21661: WordPress WP_Query SQLi Vulnerability

CVE-2022-21661 is a SQL injection flaw in WordPress WP_Query due to improper sanitization that allows database attacks through plugins or themes. This article covers technical details, affected versions, and mitigation.

Published: February 17, 2026

CVE-2022-21661 Overview

CVE-2022-21661 is a SQL Injection vulnerability in WordPress, the widely-used open-source content management system. Due to improper sanitization in the WP_Query class, specifically within the WP_Tax_Query component, attackers can potentially inject malicious SQL commands through plugins or themes that utilize these functions in vulnerable ways. This vulnerability allows unauthorized access to sensitive database information and poses a significant risk to WordPress installations worldwide.

Critical Impact

This SQL injection vulnerability enables unauthenticated attackers to extract sensitive data from WordPress databases through improperly sanitized taxonomy queries, potentially exposing user credentials, private content, and configuration data.

Affected Products

  • WordPress versions prior to 5.8.3 (patched versions available back to 3.7.37)
  • Fedora 34 and 35
  • Debian Linux 9.0, 10.0, and 11.0

Discovery Timeline

  • January 6, 2022 - CVE-2022-21661 published to NVD
  • January 2022 - WordPress releases security patch in version 5.8.3
  • August 19, 2025 - Last updated in NVD database

Technical Details for CVE-2022-21661

Vulnerability Analysis

This SQL Injection vulnerability exists within the WordPress WP_Tax_Query class, which is responsible for handling taxonomy-related database queries. The root issue stems from insufficient input validation when processing the terms parameter in taxonomy queries. When plugins or themes pass user-controlled data to WP_Query with specific taxonomy parameters, the application fails to properly sanitize integer-type field values before incorporating them into SQL statements.

The vulnerability can be exploited remotely without authentication, allowing attackers to read arbitrary data from the WordPress database. While the impact is limited to data confidentiality (no direct write or execute capabilities), attackers could extract sensitive information including user credentials, private posts, and configuration data.

Root Cause

The vulnerability originates in src/wp-includes/class-wp-tax-query.php where the terms array was being processed uniformly regardless of the query field type. The original code treated all term values the same way, using array_unique() without proper type validation. When the field parameter was set to values other than slug or name (such as term_id or term_taxonomy_id), the terms should be validated as integers but were instead passed through without sanitization, allowing SQL injection payloads to be inserted.

Attack Vector

The attack is network-based and requires no authentication or user interaction. An attacker can craft malicious requests to WordPress installations where plugins or themes expose WP_Query functionality with controllable taxonomy parameters. By injecting SQL syntax into the terms parameter when targeting integer-type fields, attackers can manipulate the underlying database queries to extract unauthorized information.

php
 		return;
 	}
 
-	$query['terms'] = array_unique( (array) $query['terms'] );
+	if ( 'slug' === $query['field'] || 'name' === $query['field'] ) {
+		$query['terms'] = array_unique( (array) $query['terms'] );
+	} else {
+		$query['terms'] = wp_parse_id_list( $query['terms'] );
+	}
 
 	if ( is_taxonomy_hierarchical( $query['taxonomy'] ) && $query['include_children'] ) {
 		$this->transform_query( $query, 'term_id' );

Source: GitHub Commit for WordPress Fix

Detection Methods for CVE-2022-21661

Indicators of Compromise

  • Unusual database query patterns in web server logs containing SQL injection syntax (UNION SELECT, etc.)
  • Unexpected outbound data transfers from the database server
  • Error log entries indicating malformed SQL queries in taxonomy-related functions
  • Access log entries with abnormally long query strings targeting WordPress endpoints

Detection Strategies

  • Monitor web application firewall (WAF) logs for SQL injection patterns targeting WordPress taxonomy parameters
  • Implement database activity monitoring to detect anomalous query patterns from the WordPress application
  • Review access logs for requests containing encoded SQL injection payloads in the tax_query parameter
  • Deploy intrusion detection signatures for known CVE-2022-21661 exploitation attempts

Monitoring Recommendations

  • Enable WordPress debug logging and monitor for database errors in taxonomy queries
  • Configure SIEM rules to alert on SQL injection signatures in HTTP request parameters
  • Monitor database query execution times for unusually long-running queries that may indicate data exfiltration
  • Set up file integrity monitoring on WordPress core files to detect unauthorized modifications

How to Mitigate CVE-2022-21661

Immediate Actions Required

  • Update WordPress to version 5.8.3 or later immediately
  • Enable WordPress automatic updates to ensure timely security patch deployment
  • Audit installed plugins and themes for direct usage of WP_Query with user-controlled taxonomy parameters
  • Implement a web application firewall with SQL injection protection rules

Patch Information

WordPress has released security patches addressing this vulnerability in version 5.8.3. Security fixes have also been backported to all supported branches going back to version 3.7.37, ensuring broad coverage for legacy installations. The fix can be reviewed in the GitHub Commit for WordPress Fix. According to the WordPress Security Release 5.8.3, WordPress strongly recommends keeping auto-updates enabled.

Additional security advisories have been published by Debian Security Advisory DSA-5039 and Fedora Package Announcement for their respective package repositories.

Workarounds

  • There are no known workarounds for this vulnerability as stated in the official advisory
  • Deploy a web application firewall with strict SQL injection filtering as a temporary measure
  • Restrict network access to the WordPress administration and REST API endpoints
  • Consider temporarily disabling plugins that heavily utilize taxonomy queries until updates can be applied
bash
# Configuration example - Enable WordPress automatic updates
# Add to wp-config.php
define( 'WP_AUTO_UPDATE_CORE', true );

# Verify current WordPress version
wp core version

# Update WordPress core via WP-CLI
wp core update

# Verify the update was successful
wp core verify-checksums

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 Score7.5

  • EPSS Probability90.90%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityNone
  • CWE References
  • CWE-89
  • Technical References
  • Packet Storm SQL Injection Advisory

  • GitHub Security Advisory GHSA-6676

  • Debian LTS Security Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Debian Security Advisory DSA-5039

  • Exploit-DB #50663

  • Zero Day Initiative Advisory ZDI-22-020

  • Vicarius Blog on SQL Injection Vulnerability
  • Vendor Resources
  • GitHub Commit for WordPress Fix

  • WordPress Security Release 5.8.3
  • Related CVEs
  • CVE-2023-54359: WordPress Adivaha Travel Plugin SQLI Flaw

  • CVE-2026-3781: WordPress Attendance Manager SQLi Flaw

  • CVE-2026-39466: Broken Link Checker SQL Injection Flaw

  • CVE-2026-1865: WordPress User Registration SQLi Flaw
Default Legacy - Prefooter | 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