WordPress Core < 5.8.3 — SQL Injection via WP_Query
CVE-2022-21661Published · Updated Action summary
Affected: <5.8.3Update to 3.7.37 or 3.8.37 or 3.9.35 or 4.0.34 or 4.1.34 or 4.2.31 or 4.3.27 or 4.4.26 or 4.5.25 or 4.6.22 or 4.7.22 or 4.8.18 or 4.9.19 or 5.0.15 or 5.1.12 or 5.2.14 or 5.3.11 or 5.4.9 or 5.5.8 or 5.6.7 or 5.7.5 or 5.8.3 or newer
Fixed versions are per release branch: update to the fix for the branch you run.
All remediation steps- Severity
- High8.0
- CVSS
- 8.0CVSS 3.1 · CNA (Wordfence)
CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:HWhat does this vector mean?
AV:NAttack vector- Network
AC:HAttack complexity- High
PR:HPrivileges required- High
UI:NUser interaction- None
S:CScope- Changed
C:HConfidentiality- High
I:HIntegrity- High
A:HAvailability- High
- Weakness
- CWE-89 SQL Injection
- Required access
- Unknown
- Exploit prediction (EPSS)
- No score
- CISA KEV
- Not listed
On this page8
Am I affected?
WordPress wordpress
- Affected< 5.8.3
- Patched in3.7.37 / 3.8.37 / 3.9.35 / 4.0.34 / 4.1.34 / 4.2.31 / 4.3.27 / 4.4.26 / 4.5.25 / 4.6.22 / 4.7.22 / 4.8.18 / 4.9.19 / 5.0.15 / 5.1.12 / 5.2.14 / 5.3.11 / 5.4.9 / 5.5.8 / 5.6.7 / 5.7.5 / 5.8.3
Update to 3.7.37 / 3.8.37 / 3.9.35 / 4.0.34 / 4.1.34 / 4.2.31 / 4.3.27 / 4.4.26 / 4.5.25 / 4.6.22 / 4.7.22 / 4.8.18 / 4.9.19 / 5.0.15 / 5.1.12 / 5.2.14 / 5.3.11 / 5.4.9 / 5.5.8 / 5.6.7 / 5.7.5 / 5.8.3 or newer.
You are affected if you run < 5.8.3. Version 3.7.37, 3.8.37, 3.9.35, 4.0.34, 4.1.34, 4.2.31, 4.3.27, 4.4.26, 4.5.25, 4.6.22, 4.7.22, 4.8.18, 4.9.19, 5.0.15, 5.1.12, 5.2.14, 5.3.11, 5.4.9, 5.5.8, 5.6.7, 5.7.5, 5.8.3 and later are not affected by this issue.
- Check your version: in wp-admin go to Plugins → Installed Plugins and read the version under WordPress.
- No admin access? Run a passive check of your site. It reads public files only.
What to do
- Update to one of the following versions, or a newer patched version: 3.7.37, 3.8.37, 3.9.35, 4.0.34, 4.1.34, 4.2.31, 4.3.27, 4.4.26, 4.5.25, 4.6.22, 4.7.22, 4.8.18, 4.9.19, 5.0.15, 5.1.12, 5.2.14, 5.3.11, 5.4.9, 5.5.8, 5.6.7, 5.7.5, 5.8.3
- Rotate administrator passwords and application secrets if the site ran a vulnerable version while publicly reachable.
- Watch WordPress to get an email when the next vulnerability is published.
Advisory
Source description from Wordfence Intelligence, credited to ngocnb from GiaoHangTietKiem JSC, khuyenn from GiaoHangTietKiem JSC.
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.
Exploits & references
Proof-of-concept & detection
No public proof-of-concept or detection template is known for this vulnerability.
Advisories & patches
- Advisorywordfence.com
Related CVEs
Same weakness (SQL Injection)
All SQL Injection| Severity | Vulnerability | CVE | Published |
|---|---|---|---|
| Medium6.4 | Authenticated (Contributor+) DOM-Based Stored Cross-Site Scripting via 'data-text-sec', 'data-title', and 'title' Attributes via Custom HTML Block | CVE-2026-18742 | |
| High7.1 | Unauthenticated PHP Object Injection to Arbitrary File Deletion via 'comment_content'/'comment_agent' Parameter during Attachment Rename Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization≤4.2.19Update to 4.2.20 | CVE-2026-124969 | |
| Critical9.8 | Missing Authorization to Unauthenticated Arbitrary User Password Reset / Account Takeover via Webhook with 'Is the user ID' Field | CVE-2026-126173 | |
| High7.2 | Unauthenticated Stored Cross-Site Scripting via Comment User-Agent Header | CVE-2026-120688 |
- Medium6.4Authenticated (Contributor+) DOM-Based Stored Cross-Site Scripting via 'data-text-sec', 'data-title', and 'title' Attributes via Custom HTML Block
Flatsome
≤3.20.12Update to 3.20.13
- High7.1Unauthenticated PHP Object Injection to Arbitrary File Deletion via 'comment_content'/'comment_agent' Parameter during Attachment Rename
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization
≤4.2.19Update to 4.2.20
- Critical9.8Missing Authorization to Unauthenticated Arbitrary User Password Reset / Account Takeover via Webhook with 'Is the user ID' Field
AutomatorWP Webhooks
≤1.4.4Update to 1.4.5
- High7.2Unauthenticated Stored Cross-Site Scripting via Comment User-Agent Header
EZ SQL Reports Shortcode Widget and DB Backup
≤5.25.25Update to 5.26.45
Timeline
CVE published
Severity high, CVSS 8.0
Record last updated
Sources & licenses
Wordfence record- Vulnerability data
- Wordfence Intelligence. Copyright 2012-2026 Defiant Inc. Licensed under the CC BY-SA 4.0.
- CVE® identifiers
- Copyright 1999-2026 The MITRE Corporation. Used under the CVE Program. CVE® is a registered trademark of The MITRE Corporation.
- CVSS / CWE
- National Vulnerability Database (NVD), shown unmodified. This product uses the NVD API but is not endorsed or certified by the NVD.
- VulnCrest content
- Summary, remediation guidance and page layout © VulnCrest. Not sourced from NVD.
