← 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-2009-0846Mit kerberos 5 vulnerabilityThe asn1_decode_generaltime function in lib/krb5/asn.1/asn1_decode.c in the ASN.1 GeneralizedTime decoder in MIT Kerberos 5 (aka krb5) before 1.6.4 a…EPSS 8.9%10.0CVE-2006-4028Wordpress vulnerabilityMultiple unspecified vulnerabilities in WordPress before 2.0.4 have unknown impact and remote attack vectors. NOTE: due to lack of details, it is not…EPSS 3.8%10.0CVE-2000-0844Caldera openlinux ebuilder permissions and access controls vulnerabilitySome functions that implement the locale subsystem on Unix do not properly cleanse user-injected format strings, which allows local attackers to exec…EPSS 16%10.0CVE-2000-0666Conectiva linux vulnerabilityrpc.statd in the nfs-utils package in various Linux distributions does not properly cleanse untrusted format strings, which allows remote attackers t…EPSS 26%10.0CVE-2000-0584Debian linux vulnerabilityBuffer overflow in Canna input system allows remote attackers to execute arbitrary commands via an SR_INIT command with a long user name or group nam…EPSS 5.9%10.0CVE-2000-1221Sgi irix vulnerabilityThe line printer daemon (lpd) in the lpr package in multiple Linux operating systems authenticates by comparing the reverse-resolved hostname of the …EPSS 17%10.0CVE-1999-0832Debian linux vulnerabilityBuffer overflow in NFS server on Linux allows attackers to execute commands via a long pathname.EPSS 3.5%10.0CVE-1999-0730Debian linux vulnerabilityThe zsoelim program in the Debian man-db package allows local users to overwrite files via a symlink attack.EPSS 4.5%

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