CVE-2022-21664

7.4 HIGH

📋 TL;DR

CVE-2022-21664 is an SQL injection vulnerability in WordPress caused by insufficient input sanitization in a core class. This allows attackers to execute arbitrary SQL queries against the database. All WordPress sites running versions before 5.8.3 (and older versions back to 4.1.34) are affected.

💻 Affected Systems

Products:
  • WordPress
Versions: WordPress versions 4.1.34 and earlier up to 5.8.2
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: All standard WordPress installations are vulnerable; no special configuration required.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise allowing data theft, modification, or deletion; potential privilege escalation to administrator access; possible remote code execution through database functions.

🟠

Likely Case

Data exfiltration of sensitive information (user credentials, personal data, content); database manipulation; potential site defacement.

🟢

If Mitigated

Limited impact with proper input validation and database user privilege restrictions; potential for error messages but no successful exploitation.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires some WordPress knowledge but is well-documented in security advisories; authenticated access may be needed depending on attack vector.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: WordPress 5.8.3

Vendor Advisory: https://github.com/WordPress/wordpress-develop/security/advisories/GHSA-jp3p-gw8h-6x86

Restart Required: No

Instructions:

1. Backup your WordPress site and database. 2. Update WordPress core to version 5.8.3 or later via Dashboard > Updates. 3. Verify update completed successfully. 4. Test site functionality.

🔧 Temporary Workarounds

No official workarounds

all

The vendor states there are no known workarounds for this vulnerability.

🧯 If You Can't Patch

  • Implement strict web application firewall (WAF) rules to block SQL injection patterns
  • Restrict database user permissions to minimum required privileges

🔍 How to Verify

Check if Vulnerable:

Check WordPress version in Dashboard > Updates or examine wp-includes/version.php file for version number.

Check Version:

grep '\$wp_version' wp-includes/version.php

Verify Fix Applied:

Confirm WordPress version is 5.8.3 or later; check that the patch commit c09ccfbc547d75b392dbccc1ef0b4442ccd3c957 is present in core files.

📡 Detection & Monitoring

Log Indicators:

  • Unusual database queries in WordPress debug logs
  • SQL syntax errors in web server logs
  • Multiple failed login attempts followed by unusual database activity

Network Indicators:

  • HTTP requests containing SQL keywords (SELECT, UNION, INSERT, etc.) to WordPress endpoints
  • Unusual database connection patterns from web server

SIEM Query:

source="*apache*" OR source="*nginx*" | search "wp-" AND ("SELECT" OR "UNION" OR "INSERT" OR "DELETE") AND status=200

🔗 References

📤 Share & Export