CVE-2022-29143

7.5 HIGH

📋 TL;DR

This vulnerability in Microsoft SQL Server allows authenticated attackers to execute arbitrary code on affected systems by sending specially crafted queries. It affects SQL Server instances with specific configurations where attackers have existing database access. The impact is remote code execution with the privileges of the SQL Server service account.

💻 Affected Systems

Products:
  • Microsoft SQL Server
Versions: SQL Server 2012 through 2019, SQL Server 2022
Operating Systems: Windows Server
Default Config Vulnerable: ✅ No
Notes: Requires authenticated access to SQL Server; not all configurations may be exploitable. SQL Server on Linux is not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise leading to data exfiltration, ransomware deployment, lateral movement across the network, and persistent backdoor installation.

🟠

Likely Case

Database compromise leading to data theft, privilege escalation within the SQL environment, and potential credential harvesting from the server.

🟢

If Mitigated

Limited impact due to network segmentation, least privilege service accounts, and proper authentication controls restricting exploit surface.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires authenticated access to SQL Server and specific conditions. No public exploit code available as of knowledge cutoff.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Apply latest cumulative updates for respective SQL Server versions (May 2022 security updates or later)

Vendor Advisory: https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2022-29143

Restart Required: Yes

Instructions:

1. Identify SQL Server version. 2. Download appropriate cumulative update from Microsoft Update Catalog. 3. Apply update following Microsoft's SQL Server patching procedures. 4. Restart SQL Server services.

🔧 Temporary Workarounds

Restrict Database Access

all

Limit SQL Server access to only necessary users and applications using principle of least privilege.

USE master;
REVOKE CONNECT SQL FROM [unnecessary_user];
ALTER SERVER ROLE [sysadmin] DROP MEMBER [unnecessary_admin];

Network Segmentation

windows

Isolate SQL Server instances from untrusted networks and implement firewall rules.

New-NetFirewallRule -DisplayName "Block SQL Ports" -Direction Inbound -LocalPort 1433,1434 -Protocol TCP -Action Block

🧯 If You Can't Patch

  • Implement strict network access controls to limit SQL Server exposure
  • Apply principle of least privilege to all SQL Server service accounts and database users

🔍 How to Verify

Check if Vulnerable:

Check SQL Server version against affected versions list and verify patch status via SQL query: SELECT @@VERSION

Check Version:

SELECT SERVERPROPERTY('ProductVersion') AS Version, SERVERPROPERTY('ProductLevel') AS Level, SERVERPROPERTY('Edition') AS Edition;

Verify Fix Applied:

Verify installed updates via Windows Update history or SQL Server Configuration Manager, and confirm version is patched.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL query patterns in SQL Server logs
  • Failed authentication attempts followed by complex query execution
  • Unexpected service account privilege escalation

Network Indicators:

  • Unusual outbound connections from SQL Server
  • Anomalous database query traffic patterns
  • Unexpected PowerShell or command execution from SQL Server process

SIEM Query:

source="sql_server" AND (query="xp_cmdshell" OR query="sp_OACreate" OR query="EXECUTE") AND user!="expected_service_account"

🔗 References

📤 Share & Export