Zero-Day Analysis|SQL Server · Actively Exploited

CVE-2026-21262: Any SQL Server User Can Become Sysadmin

CVE-2026-21262 is an actively exploited zero-day in Microsoft SQL Server that allows any authenticated, low-privileged user to escalate to sysadmin over the network — no special permissions required. Patched in the March 10, 2026 Patch Tuesday, but exploitation was confirmed in the wild before the fix dropped. Over 500,000 SQL Server instances are directly accessible on the public internet.

The flaw stems from improper access control in the SQL Server network layer protocol implementation (TDS). A crafted sequence of network packets allows the attacker to execute operations as the sysadmin role within their existing authenticated session — no exploit code required, just crafted protocol messages. CVSS 8.8 (HIGH). Affects SQL Server 2016 SP3 through SQL Server 2025.

Sable Security Research Team
March 17, 2026
0 views
12 min read

TL;DR — CVE-2026-21262: Patch Now, Scope is Massive

500K+
Instances Exposed
SQL Server on public internet
8.8
CVSS Score
HIGH severity (zero-day)
10
SQL Server Versions
SQL 2016 SP3 → SQL 2025
0 days
Patch Window
actively exploited in the wild

Bottom line: Any user with a SQL Server login — your app service account, a contractor's read-only credentials, even a guest account — can own the entire database server. If your SQL Server is internet-accessible and unpatched, assume it is already compromised.

Vulnerability Details

CVE IDCVE-2026-21262
CVSS Score8.8 (HIGH)
TypeElevation of Privilege (EoP)
Zero-DayYES — exploited before patch
Attack VectorNetwork (TCP/1433)
Auth RequiredLow — any SQL login
PatchedMarch 10, 2026 (Patch Tuesday)
CWECWE-284 — Improper Access Control
Actively Exploited Before Patch

Microsoft confirmed exploitation in the wild prior to the March 10 patch release. This means threat actors — including ransomware groups — already had working exploits before defenders had a fix. The window between public knowledge and mass exploitation for this class of vulnerability is typically under 48 hours.

Attack Chain: 3 Steps to Full Database Control

The attack requires no special tooling — just a SQL client and valid credentials. The entire chain can execute in under 60 seconds on an unpatched target.

1Initial Access — Any Authenticated User
Attacker obtains any valid SQL Server credentials (low-privileged db_reader, guest, or app service account)
Credentials are widely available: leaked via credential stuffing, phishing, or reused from breached systems
Target must be reachable on TCP/1433 — Shodan shows 500K+ instances internet-accessible
No special permissions required — a newly created test account is sufficient
2Protocol Exploitation — Network Layer Manipulation
Attacker sends crafted TDS (Tabular Data Stream) packets to the SQL Server network endpoint
The network layer protocol implementation performs improper access control validation on certain protocol messages
A specifically crafted sequence of TDS packets triggers the flaw in the permission-checking code path
SQL Server processes the packets using the privileges of the server process rather than the authenticated user
3Privilege Escalation — Low-Priv to Sysadmin
Exploited flaw allows attacker to execute operations as the sysadmin role over the existing network connection
No server restart required; escalation happens in-session via the network protocol
Full sysadmin access: read/write/delete any database, create new logins, execute OS commands via xp_cmdshell
Attacker can add themselves as a permanent sysadmin login — persistence survives session termination
root-cause — tds-protocol.md
# Root cause: improper access control in TDS packet handler
# The handler processes certain packet types with elevated context
# before the user privilege check completes
Attacker sends: crafted TDS PacketType=0x12
SQL Server resolves: permission check SKIPPED
Execution context: sysadmin
→ Full database compromise in a single network round-trip

What Attackers Can Do With Sysadmin Access

Sysadmin in SQL Server is equivalent to root on Linux or SYSTEM on Windows. From this position, attackers can do everything — and typically do:

🗄️Read entire database
CRITICAL
SELECT * FROM master..sysdatabases
SELECT * FROM SensitiveTable
💻Execute OS commands
CRITICAL
EXEC xp_cmdshell 'whoami'
EXEC xp_cmdshell 'net user attacker P@ss123 /add'
🔑Create backdoor login
CRITICAL
CREATE LOGIN backdoor WITH PASSWORD='P@ss123!'
EXEC sp_addsrvrolemember 'backdoor','sysadmin'
📤Exfiltrate via linked server
HIGH
SELECT * FROM OPENROWSET('SQLNCLI','...',
'SELECT sensitive_col FROM prod_db.dbo.customers')
🕵️Disable audit logging
HIGH
ALTER SERVER AUDIT [AuditSpec] WITH (STATE=OFF)
DROP SERVER AUDIT [AuditSpec]
🔒Deploy ransomware payload
CRITICAL
EXEC xp_cmdshell 'powershell -enc <b64_payload>'
-- Encrypt SQL Server data files in place

Affected Versions & Required Patches

VersionLast Vulnerable BuildStatusKB Article
SQL Server 2016 SP3CU17 GDR and earlierVULNERABLEKB5040946
SQL Server 2017CU31 GDR and earlierVULNERABLEKB5040939
SQL Server 2019CU28 GDR and earlierVULNERABLEKB5046860
SQL Server 2022CU16 GDR and earlierVULNERABLEKB5077465
SQL Server 2025RTM and earlierVULNERABLEKB5077480
Azure SQL Database and SQL Managed Instance

Microsoft-managed cloud SQL services were patched automatically. No action required for Azure SQL Database or SQL Managed Instance deployments.

Global Exposure: 500K+ Internet-Accessible Instances

Shodan indexes over 500,000 SQL Server instances accessible on TCP/1433 from the public internet. Many are production databases — not dev or test — because "it's always been open" or because an app deployment opened the port and nobody noticed.

Geographic Distribution (Shodan, March 2026)

🇺🇸United States
34%~170K
🇩🇪Germany
12%~60K
🇬🇧United Kingdom
8%~40K
🇫🇷France
6%~30K
🇧🇷Brazil
5%~25K
🇨🇳China
5%~25K
🇯🇵Japan
4%~20K
🌍Other
26%~130K
LATAM Exposure

Brazil alone accounts for ~25,000 exposed instances. Mexico, Colombia, and Argentina contribute an additional ~15,000 combined. Many are SMB deployments running SQL Server 2016 or 2017 with no automatic updates configured — the highest-risk cohort for this vulnerability.

Mitigation: 5 Steps to Remediate

Patch first. Then harden. Then detect. In that order.

1Apply the March 2026 Patch Tuesday update
-- Verify current SQL Server version:
SELECT @@VERSION

-- You need:
-- SQL 2022: KB5077465 (build 16.0.4175.1+)
-- SQL 2019: KB5046860 (build 15.0.4430.1+)
-- SQL 2017: KB5040939 (build 14.0.3485.1+)
-- SQL 2016: KB5040946 (build 13.0.6445.1+)
2Restrict SQL Server network access immediately
# Block TCP/1433 on firewall for all IPs except app servers:
iptables -A INPUT -p tcp --dport 1433 -s 10.0.0.0/8 -j ACCEPT
iptables -A INPUT -p tcp --dport 1433 -j DROP

# Or in Windows Firewall:
netsh advfirewall firewall add rule name="SQL Block" protocol=TCP dir=in localport=1433 action=block
3Audit all SQL Server logins and privileges
-- List all sysadmin members:
SELECT name, type_desc, is_disabled
FROM sys.server_principals
WHERE IS_SRVROLEMEMBER('sysadmin', name) = 1

-- Disable SQL auth if using Windows-only:
ALTER LOGIN [sa] DISABLE
4Enable SQL Server audit logging
-- Create server audit:
CREATE SERVER AUDIT [SecurityAudit]
TO FILE (FILEPATH = 'C:\SQLAudit\')
WITH (ON_FAILURE = CONTINUE);
ALTER SERVER AUDIT [SecurityAudit] WITH (STATE = ON);

-- Monitor failed logins and privilege changes:
CREATE SERVER AUDIT SPECIFICATION [LoginAudit]
FOR SERVER AUDIT [SecurityAudit]
ADD (FAILED_LOGIN_GROUP),
ADD (SERVER_PRINCIPAL_CHANGE_GROUP);
5Rotate all SQL Server credentials
-- Rotate sa and all service account passwords:
ALTER LOGIN [sa] WITH PASSWORD = '<new-strong-password>';
ALTER LOGIN [app_service] WITH PASSWORD = '<new-strong-password>';

-- Revoke unnecessary permissions:
REVOKE CONNECT SQL FROM [low_priv_user];
DROP USER [unused_account];

Detection Queries: Hunt for Active Exploitation

If you can't patch immediately, run these queries to detect signs of compromise. Unexplained sysadmin additions or xp_cmdshell calls are immediate red flags.

Detect new sysadmin additions
SELECT
  event_time,
  server_principal_name,
  target_server_principal_name,
  statement
FROM sys.fn_get_audit_file('C:\SQLAudit\*', DEFAULT, DEFAULT)
WHERE action_id = 'ADRO'
AND class_type = 'SR'  -- Server Role
Find xp_cmdshell executions
SELECT
  event_time,
  server_principal_name,
  statement
FROM sys.fn_get_audit_file('C:\SQLAudit\*', DEFAULT, DEFAULT)
WHERE statement LIKE '%xp_cmdshell%'
ORDER BY event_time DESC
Check if instance is internet-exposed
-- Run from server:
nmap -sV -p 1433 $(curl -s ifconfig.me)
-- If open: your SQL Server is internet-accessible

March 2026 Patch Tuesday: Other Critical CVEs

83 CVEs were patched in the same release. These four are worth immediate attention for startup and enterprise environments:

CVE-2026-26115PATCHED
CVSS 8.1

SQL Server EoP via linked server — same March 2026 patch batch

CVE-2026-26127PATCHED
CVSS 7.5

.NET Framework DoS — publicly disclosed zero-day, same Patch Tuesday

CVE-2026-26144PATCHED
CVSS 7.3

Microsoft Copilot data exfiltration via prompt injection

CVE-2026-21536PATCHED
CVSS 9.8

Microsoft Devices Pricing Program RCE — unrestricted file upload

Timeline

Before March 10, 2026
Active exploitation in the wild confirmed by Microsoft
March 10, 2026
CVE-2026-21262 disclosed and patched in March Patch Tuesday (83 CVEs total)
March 10–12, 2026
Rapid public analysis; PoC code circulates within security community
March 12, 2026
CISA adds to Known Exploited Vulnerabilities (KEV) catalog
March 17, 2026
Sable Security publishes this research and exposure analysis
Ongoing
Mass exploitation campaigns targeting unpatched internet-exposed instances

References