Jul 20, 2026·5 min read·8 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')
Prior to version 1.2.11, the LangChain LLM framework is affected by a Server-Side Request Forgery (SSRF) vulnerability inside its image token counting mechanism. Specifically, the ChatOpenAI.get_num_tokens_from_messages() method retrieves arbitrary image_url values from user prompts without validating the destination host or IP address. Attackers can exploit this issue to scan internal infrastructure, access local services, or harvest credentials from cloud metadata services.
A security vulnerability was identified in the Astro web framework's composable integration pipeline with Hono. Due to the structural coupling of CSRF origin validation exclusively within the `middleware()` primitive, applications assembling their routing pipeline manually could execute state-mutating actions before or entirely without origin validation. This flaw allows attackers to execute blind, write-only Cross-Site Request Forgery (CSRF) attacks against state-mutating Astro Actions or endpoints on behalf of authenticated users.
Multiple cross-site request forgery (CSRF) vulnerabilities in the HTTP Administration component in Cisco IOS 12.4 on the 871 Integrated Services Router allow remote attackers to execute arbitrary commands via crafted HTTP requests. This occurs because the web administrative server fails to validate request origins or use anti-CSRF tokens, allowing an attacker to abuse an active administrative session.
An unbounded resource allocation vulnerability exists in Guzzle's cookie parsing and storage engine. Prior to version 7.15.1, Guzzle did not restrict the number or size of cookies stored within the client-side CookieJar. This lack of boundary control allows a malicious server or an intermediary proxy to poison the cookie storage with oversized or excessive Set-Cookie headers. When the client subsequently targets sibling domains or legitimate services using the same cookie jar, it transmits exceptionally large Cookie headers, triggering upstream protocol violations and resulting in Denial of Service (HTTP 431 / HTTP 400 rejection).
An information disclosure vulnerability in guzzlehttp/guzzle allows host-only cookies to be incorrectly matched and sent to subdomains. Because Guzzle failed to track whether cookies were defined without a Domain attribute, it evaluated host-only cookies using standard domain-suffix rules, widening their scope and exposing sensitive session tokens to untrusted subdomains.
An issue in Guzzle's RedirectMiddleware allows client-side URI fragments to be leaked over the network in Referer headers during same-scheme HTTP redirects.