Jul 20, 2026·5 min read·81 visits
An authenticated, low-privileged local attacker can exploit SQL command injection in SQL Server's internal administrative procedures to escalate privileges to sysadmin, gaining complete administrative control over the affected database instance.
CVE-2026-47296 is a high-severity local Elevation of Privilege (EoP) vulnerability in Microsoft SQL Server. The issue stems from the improper neutralization of special elements within internal database routines, allowing a low-privileged authenticated user to execute arbitrary database queries with the privileges of the database owner or system administrator. Microsoft has addressed this vulnerability in its July 2026 security updates.
Microsoft SQL Server utilizes internal stored procedures, functions, and views to perform system maintenance, metadata queries, and administrative integrations. To execute these specialized operations without granting excessive privileges to standard database users, the database engine implements context switching. These routines are designed to execute under the context of a highly privileged principal, such as the database owner (dbo) or a system administrator (sysadmin).
The vulnerability, classified under CWE-89, exists within the input validation mechanism of these administrative routines. If a low-privileged user possesses execution permissions on one of these objects, they can supply malformed parameters. The lack of structured separation between command logic and user-supplied data in the underlying routine allows input boundaries to be breached, enabling unauthorized execution of database commands.
The attack surface is exposed to any authenticated local user who can establish a database session. While typically classified as a local elevation of privilege vector, the threat model extends to multi-tenant environments, web applications utilizing shared database connections, and SaaS platforms that permit standard users to execute raw query parameters.
The root cause of CVE-2026-47296 resides in the insecure construction of dynamic SQL statements within administrative stored procedures. In Microsoft SQL Server, developers frequently use the WITH EXECUTE AS clause or cryptographic signatures to run routines with elevated rights. When these routines execute, SQL Server temporarily switches the execution context, granting the session the permissions of the target principal for the duration of the query execution.
The database engine relies on functions like EXEC() or sp_executesql to process commands dynamic in nature. A security boundary violation occurs when user input is concatenated directly into these execution strings. This implementation pattern fails to treat user-provided arguments as literal values, and instead parses them as executable syntax.
To trigger this vulnerability, an attacker must successfully connect to an affected SQL Server instance using valid database credentials. The attacker must then call a vulnerable system procedure and provide an input argument containing SQL command terminators and secondary payloads. When the database engine processes the concatenated string under the elevated context, it executes the secondary payload with the permissions of the elevated execution principal.
The following code structures demonstrate the insecure code pattern alongside the secure, parameterized pattern implemented by the official patches.
-- Vulnerable internal stored procedure pattern
CREATE PROCEDURE sys.sp_vulnerable_metadata_helper
@TargetTable NVARCHAR(256)
WITH EXECUTE AS OWNER -- Executes with db_owner context
AS
BEGIN
DECLARE @DynamicSQL NVARCHAR(MAX);
-- VULNERABILITY: Direct string concatenation of user input
SET @DynamicSQL = N'SELECT * FROM sys.objects WHERE name = ''' + @TargetTable + N'''';
-- Executes the concatenated command as the owner
EXEC(@DynamicSQL);
END;In the patched implementation, Microsoft removed string concatenation, replacing it with explicit parameter binding using sp_executesql. This ensures that user input is never evaluated as SQL syntax during the query compilation stage.
-- Patched stored procedure pattern
CREATE PROCEDURE sys.sp_vulnerable_metadata_helper
@TargetTable NVARCHAR(256)
WITH EXECUTE AS OWNER
AS
BEGIN
DECLARE @DynamicSQL NVARCHAR(MAX);
-- FIX: Use a parameterized query structure
SET @DynamicSQL = N'SELECT * FROM sys.objects WHERE name = @BoundTable';
-- FIX: Execute with rigid parameter definition preventing injection
EXEC sp_executesql
@DynamicSQL,
N'@BoundTable NVARCHAR(256)',
@BoundTable = @TargetTable;
END;This remediation completely closes the vulnerability vector because the query planner evaluates the parameter @BoundTable strictly as a string literal. Any attempt to supply special operators or command terminators inside the parameter results in a literal string search rather than administrative execution. The fix is considered structurally complete across the affected internal routines; however, custom database applications implementing similar dynamic patterns remain vulnerable if not manually remediated.
An attacker with minimal permissions (such as standard database-level public role access) can initiate the privilege escalation process. The attack does not require elevated server-level configuration or non-standard engine states.
The exploit payload is injected into the target stored procedure parameter. A typical exploit string terminates the primary query logic using a single quote character, inserts the malicious command, and comments out the remainder of the generated query string.
-- Example exploitation execution block
EXEC sys.sp_vulnerable_metadata_helper
@TargetTable = N"test_table'; ALTER SERVER ROLE sysadmin ADD MEMBER [low_priv_user]; --";When processed by the database engine, the resulting statement executes two distinct commands sequentially: the initial SELECT query, followed by the ALTER SERVER ROLE command. Because the entire execution occurs under the active context of OWNER, the secondary instruction succeeds, adding the attacker's database login to the highly privileged sysadmin server role.
Successful exploitation of CVE-2026-47296 results in a complete compromise of the affected database instance. The confidentiality, integrity, and availability of all data managed by the database server are impacted.
By gaining the sysadmin role, the attacker obtains the capability to read, alter, or delete any user or system database record. Furthermore, the attacker can modify instance configurations, establish persistence mechanisms, or execute arbitrary operating system commands by enabling advanced configuration options such as xp_cmdshell (if permitted by the underlying operating system service account privileges).
Although the CVSS score is 7.8 due to the local attack vector and prerequisite database authentication, the real-world risk is elevated in multi-tenant environments. In such architectures, multiple application frontends or customers share physical database instances, meaning a compromise of a single low-privileged account leads to total host exposure.
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
SQL Server 2025 Microsoft | >= 17.0.1000.7 and < 17.0.1125.2 (GDR) | 17.0.1125.2 |
SQL Server 2022 Microsoft | >= 16.0.1000.6 and < 16.0.1190.2 (GDR) | 16.0.1190.2 |
SQL Server 2019 Microsoft | >= 15.0.2000.5 and < 15.0.2180.2 (GDR) | 15.0.2180.2 |
SQL Server 2017 Microsoft | >= 14.0.1000.169 and < 14.0.2120.1 (GDR) | 14.0.2120.1 |
SQL Server 2016 SP3 Microsoft | >= 13.0.6300.2 and < 13.0.6500.1 (GDR) | 13.0.6500.1 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-89 (SQL Injection) |
| Attack Vector | Local (Authenticated) |
| CVSS v3.1 Base Score | 7.8 |
| EPSS Score | 0.00232 |
| Impact Type | Privilege Escalation (up to sysadmin) |
| Exploit Status | none (no public PoC available) |
| CISA KEV Status | Not Listed |
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
CVE-2026-70035 is a high-severity Remote Code Execution (RCE) vulnerability in Microsoft .NET Framework, .NET runtime, and Visual Studio caused by improper handling during the deserialization of untrusted data (CWE-502). An unauthenticated attacker can execute arbitrary code within the context of the affected process by delivering a crafted serialized payload.
An elevation of privilege vulnerability exists in ASP.NET Core and Microsoft Visual Studio due to improper synchronization during concurrent thread execution. Authenticated remote attackers with low privileges can exploit a timing window to manipulate shared resources and assume higher-level execution contexts.
A path traversal vulnerability (CWE-22) in Contao CMS allows unauthenticated remote attackers to bypass directory boundary restrictions in ImagesController and access files within the project directory.
Contao Open Source CMS versions 4.0.0 through 5.3.49 and 5.4.0-RC1 through 5.7.11 contain a Cross-Site Request Forgery (CSRF) vulnerability in backend parameter handling. The `RequestTokenListener` component validates anti-CSRF tokens solely for HTTP POST requests, while GET-based declarative guards run only when an `act` parameter is present in the query string. Consequently, custom backend actions dispatched via alternative parameters such as `key=` can execute without CSRF token verification when triggered by an authenticated user.
Contao CMS versions 4.1.0 through 5.3.49 and 5.4.0-RC1 through 5.7.11 fail to validate form submission tokens and enforce rate limiting when processing activation email resend requests via HTTP POST, enabling resource exhaustion and account state enumeration.
An information disclosure vulnerability in Contao CMS allows unauthenticated site visitors to view protected page titles, URLs, and text excerpts through search queries when protected page indexing is disabled after previously being enabled.