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.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| WordPress | wordpress-develop | < 5.8.3 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | wordpress | 5.8.3+dfsg1-1 | — |
| Debian 13 | wordpress | 5.8.3+dfsg1-1 | — |
| Debian 12 | wordpress | 5.8.3+dfsg1-1 | — |
| Debian 11 | wordpress | 5.7.5+dfsg1-0+deb11u1 | DSA-5039-1 |
| Debian 10 | wordpress | 5.0.15+dfsg1-0+deb10u1 | DSA-5039-1 |
Show 1 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 9 | wordpress | 4.7.22+dfsg-0+deb9u1 | DLA-2884-1 |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 20.04 LTS | wordpress | No fix yet | — |
| Ubuntu 18.04 LTS | wordpress | No fix yet | — |
| Ubuntu 16.04 LTS | wordpress | No fix yet | — |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
Exploit-DB 1
- WordPress Core 5.8.2 - 'WP_Query' SQL Injection EDB-50663 · webapps · Jan 13, 2022
GitHub 13 repositories · most starred shown
-
z92g/CVE-2022-21661 ★ 29 · Jul 28, 2022
WordPress WP_Query SQL Injection POC
-
purple-WL/wordpress-CVE-2022-21661 ★ 17 · Feb 12, 2022
-
0x4E0x650x6F/Wordpress-cve-CVE-2022-21661 ★ 15 · May 28, 2022
Wordpress 5.8.2 CVE-2022-21661 Vuln enviroment POC exploit
-
guestzz/CVE-2022-21661 ★ 7 · Jul 31, 2022
CVE-2022-21661 exp for Elementor custom skin.
-
sealldeveloper/CVE-2022-21661-PoC ★ 6 · Apr 27, 2023
A Python PoC of CVE-2022-21661, inspired from z92g's Go PoC
-
WellingtonEspindula/SSI-CVE-2022-21661 ★ 6 · Jan 13, 2023
Study and exploit the vulnerability CVE-2022-21661 that allows SQL Injections through plugins POST requests to WordPress versions below 5.8.3.
-
daniel616/CVE-2022-21661-Demo ★ 2 · Feb 8, 2023
Demonstration of the SQL injection vulnerability in wordpress 5.8.2
-
CharonDefalt/WordPress--CVE-2022-21661 ★ 0 · Mar 24, 2024
-
p4ncontomat3/CVE-2022-21661 ★ 0 · Jan 4, 2024
Script to validate WordPress CVE-2022-21661
-
safe3s/CVE-2022-21661 ★ 0 · Nov 8, 2022
The first poc video presenting the sql injection test from ( WordPress Core 5.8.2-'WP_Query' / CVE-2022-21661)
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Automated scanner template
A ready-made Nuclei template detects this vulnerability automatically. Vulnerabilities with public scanner templates are typically probed across the internet soon after the template appears — exposed systems should be patched first.
- WordPress <5.8.3 - SQL Injection http/cves/2022/CVE-2022-21661.yaml
Source: projectdiscovery/nuclei-templates (MIT) — updated daily. Only links are listed.
Advisories 2
- DSA-5039-1 wordpress - security update Debian Security (DSA / DLA) · Mar 9, 2026
- DLA-2884-1 wordpress - security update Debian Security (DSA / DLA) · Mar 9, 2026
References
- https://github.com/WordPress/wordpress-develop/security/advisories/GHSA-6676-cqfm-gw84
- https://github.com/WordPress/wordpress-develop/commit/17efac8c8ec64555eff5cf51a3eff81e06317214
- https://wordpress.org/news/2022/01/wordpress-5-8-3-security-release/
- https://www.zerodayinitiative.com/advisories/ZDI-22-020/
- DSA-5039 vendor-advisory
- https://www.exploit-db.com/exploits/50663
- http://packetstormsecurity.com/files/165540/WordPress-Core-5.8.2-SQL-Injection.html
- FEDORA-2022-8472dd59ff vendor-advisory
- FEDORA-2022-e37e1e6c7a vendor-advisory
- [debian-lts-announce] 20220123 [SECURITY] [DLA 2884-1] wordpress security update mailing-list