← Vulnerability feed

Vulnerability record · CVE-2022-21661 · published 6 January 2022

CVE-2022-21661: WordPress WP_Query improper sanitization enables SQL injection

Wordpress · Wordpress

WordPress core fails to properly sanitize input in WP_Query, allowing SQL injection when plugins or themes pass attacker-controlled data into that class. The flaw is patched in WordPress 5.8.3, with backports to 3.7.37 and later branches. Because WP_Query is widely used by plugins and themes, exposure depends on how each site's extensions call it.

7.5 CVSS 3.1 High EPSS 98% · top 0.1% CWE-89 · SQL injection
7.5CVSS 3.1 base score, v2 5.0
98%EPSS exploitation probability, 30 days
NoNot in CISA KEV
3Affected product versions listed by NVD
21References, 5 tagged exploit
17 Jun 2026Last modified by NVD

Description

WordPress is a free and open-source content management system written in PHP and paired with a MariaDB database. Due to improper sanitization in WP_Query, there can be cases where SQL injection is possible through plugins or themes that use it in a certain way. This has been patched in WordPress version 5.8.3. Older affected versions are also fixed via security release, that go back till 3.7.37. We strongly recommend that you keep auto-updates enabled. There are no known workarounds for this vulnerability.

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Automated analysis

Generated by VULONE's analysis model from the NVD record, CISA KEV and EPSS data on 17 September 2026. Confidence: high.

high priorityHigh CVSS (7.5), very high EPSS, and public exploit code make this a realistic target despite no KEV listing.

What it is

WordPress core fails to properly sanitize input in WP_Query, allowing SQL injection when plugins or themes pass attacker-controlled data into that class. The flaw is patched in WordPress 5.8.3, with backports to 3.7.37 and later branches. Because WP_Query is widely used by plugins and themes, exposure depends on how each site's extensions call it.

Impact

An unauthenticated attacker can inject SQL through a vulnerable WP_Query call, potentially reading sensitive database contents such as user credentials and configuration data. The CVSS vector rates confidentiality impact as high with no integrity or availability impact.

Attack surface

Reached over the network via HTTP requests to a site whose plugin or theme passes unsanitized input into WP_Query; the CVSS vector indicates no authentication and no user interaction are required. The description does not name specific vulnerable plugins or themes.

Exploitation

CISA KEV does not list this CVE, but EPSS is very high at roughly 0.978 (99.9th percentile) and public exploit references exist on Exploit-DB and Packet Storm, indicating mature, widely available exploit code.

What to do

  • Update WordPress core to 5.8.3 or later, or to the relevant security release (3.7.37 and later branches).
  • Keep automatic core updates enabled as the vendor recommends.
  • Inventory installed plugins and themes and update or remove any that pass user input into WP_Query without sanitization.
  • Apply the Debian or Fedora package updates if running WordPress from those distributions.
  • Note that the vendor states there are no known workarounds, so patching is the only reliable fix.

Detection

  • Review web server and WAF logs for SQL metacharacters (quotes, UNION, SLEEP, comments) in query parameters hitting WordPress endpoints.
  • Enable and monitor database query logging for anomalous or malformed SQL originating from the web application.
  • Check installed plugin and theme versions against vendor advisories for WP_Query usage.
  • Alert on unexpected outbound or database access patterns consistent with data exfiltration.

This assessment is produced automatically and is not human-reviewed. Verify against the vendor advisory before acting on it.

Affected products

3 vulnerable configurations from NVD's CPE data, grouped by vendor and product.

References

LinkTags
http://packetstormsecurity.com/files/165540/WordPress-Core-5.8.2-SQL-Injection.html ExploitThird Party AdvisoryVDB Entry
https://github.com/WordPress/wordpress-develop/commit/17efac8c8ec64555eff5cf51a3eff81e06317214 PatchThird Party Advisory
https://github.com/WordPress/wordpress-develop/security/advisories/GHSA-6676-cqfm-gw84 Third Party Advisory
https://lists.debian.org/debian-lts-announce/2022/01/msg00019.html Mailing ListThird Party Advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CV4UNEC63UU5GEU47IIR4RM Third Party Advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DM6XPH3JN6V4NF4WBOJTOXZ Third Party Advisory
https://wordpress.org/news/2022/01/wordpress-5-8-3-security-release/ Release NotesVendor Advisory
https://www.debian.org/security/2022/dsa-5039 Third Party Advisory
https://www.exploit-db.com/exploits/50663 ExploitThird Party AdvisoryVDB Entry
https://www.zerodayinitiative.com/advisories/ZDI-22-020/ Third Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/165540/WordPress-Core-5.8.2-SQL-Injection.html ExploitThird Party AdvisoryVDB Entry
https://github.com/WordPress/wordpress-develop/commit/17efac8c8ec64555eff5cf51a3eff81e06317214 PatchThird Party Advisory
https://github.com/WordPress/wordpress-develop/security/advisories/GHSA-6676-cqfm-gw84 Third Party Advisory
https://lists.debian.org/debian-lts-announce/2022/01/msg00019.html Mailing ListThird Party Advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CV4UNEC63UU5GEU47IIR4RM Third Party Advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DM6XPH3JN6V4NF4WBOJTOXZ Third Party Advisory
https://wordpress.org/news/2022/01/wordpress-5-8-3-security-release/ Release NotesVendor Advisory
https://www.debian.org/security/2022/dsa-5039 Third Party Advisory
https://www.exploit-db.com/exploits/50663 ExploitThird Party AdvisoryVDB Entry
https://www.vicarius.io/vsociety/posts/understanding-the-wordpress-sql-injection-vulnerability-cve-2022-21661 ExploitThird Party Advisory
https://www.zerodayinitiative.com/advisories/ZDI-22-020/ Third Party AdvisoryVDB Entry

Track CVE-2022-21661 inside VULONE

Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.

Start free Open in platform

Related vulnerabilities

Same products first, then exploited flaws of the same weakness class.

10.0CVE-2025-32433Erlang/OTP SSH server missing authentication allows remote code executionErlang/OTP SSH servers before OTP-27.3.3, OTP-26.2.5.11 and OTP-25.3.2.20 mishandle SSH protocol messages, letting an unauthenticated attacker execut…KEVEPSS 99%analysed10.0CVE-2025-24201Apple WebKit out-of-bounds write allows sandbox escapeCVE-2025-24201 is an out-of-bounds write in Apple's WebKit that was addressed with improved checks. Maliciously crafted web content may break out of …KEVEPSS 3.8%analysed10.0CVE-2021-44228Apache Log4j2 JNDI lookup remote code executionApache Log4j2 versions 2.0-beta9 through 2.15.0 (excluding 2.12.2, 2.12.3, and 2.3.1) do not protect against attacker-controlled LDAP and other JNDI …KEVEPSS 100%analysed9.8CVE-2026-63030WordPress REST API route confusion leads to SQL injection and RCEWordPress 6.9.x before 6.9.5 and 7.0.x before 7.0.2 contain a REST API batch endpoint route confusion flaw (CWE-436). Chained with the author__not_in…KEVEPSS 10%analysed9.8CVE-2026-24061GNU Inetutils telnetd argument injection allows remote auth bypasstelnetd in GNU Inetutils through 2.7 fails to sanitize the USER environment variable, so a value such as "-f root" is passed as an argument to login …KEVEPSS 99%analysed9.8CVE-2025-39682Linux kernel TLS zero-length record handling flaw on rx_listThe Linux kernel TLS receive path mishandles zero-length records that arrive from the rx_list, breaking the assumption that a record type change cann…KEVEPSS 2.9%analysed9.8CVE-2025-24813Apache Tomcat Default Servlet path equivalence enables RCE and file disclosureApache Tomcat mishandles path equivalence for names containing an internal dot, letting a remote unauthenticated attacker write files through the Def…KEVEPSS 100%analysed9.8CVE-2024-9680Mozilla Firefox and Thunderbird use-after-free in Animation timelinesA use-after-free flaw in Animation timelines allows an attacker to execute code in the content process of Firefox and Thunderbird. Mozilla reports ex…KEVEPSS 23%analysed

Source: NIST National Vulnerability Database (record CVE-2022-21661), CISA KEV, FIRST EPSS (scores of 2026-09-24). This page is refreshed as NVD updates the record.