Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2024-26191

CVE-2024-26191: Microsoft SQL Server Native Scoring RCE

CVE-2024-26191 is a remote code execution vulnerability in Microsoft SQL Server Native Scoring that enables attackers to execute arbitrary code. This article covers technical details, affected versions, and mitigation.

Updated:

CVE-2024-26191 Overview

CVE-2024-26191 is a remote code execution vulnerability affecting the Native Scoring feature in Microsoft SQL Server. The flaw is categorized under [CWE-122] Heap-based Buffer Overflow and impacts SQL Server versions from 2016 through 2022. An authenticated attacker with low privileges can send crafted input to a database running the Native Scoring predict function to trigger memory corruption. Successful exploitation results in code execution in the context of the SQL Server process. Microsoft published the advisory under its security update guide, and the CVE was added to the National Vulnerability Database on September 10, 2024.

Critical Impact

An authenticated attacker over the network can execute arbitrary code within the SQL Server process, compromising confidentiality, integrity, and availability of the database instance.

Affected Products

  • Microsoft SQL Server 2016 (x64) and SQL 2016 Azure Connect Feature Pack
  • Microsoft SQL Server 2017 (x64) and SQL Server 2019 (x64)
  • Microsoft SQL Server 2022 (x64)

Discovery Timeline

  • 2024-09-10 - CVE-2024-26191 published to the National Vulnerability Database
  • 2026-08-10 - Last updated in NVD database

Technical Details for CVE-2024-26191

Vulnerability Analysis

The vulnerability resides in the Native Scoring functionality of Microsoft SQL Server. Native Scoring allows applications to run predictions against pre-trained machine learning models directly inside the database engine using the PREDICT T-SQL function. This path processes serialized model data and input rows in native code for performance. The flaw is a heap-based buffer overflow that occurs when this component parses malformed data supplied through a scoring query. An attacker who can submit queries to a vulnerable instance can corrupt heap memory and hijack execution flow within the sqlservr.exe process.

Because the vulnerable code runs inside the SQL Server service, successful exploitation yields code execution with the service account privileges. This typically provides broad access to databases hosted on the instance and, depending on configuration, to the underlying host.

Root Cause

The root cause is improper validation of size or length values when the Native Scoring code allocates and copies data on the heap. Insufficient bounds checking on attacker-controlled input during model deserialization or scoring leads to a heap-based buffer overflow classified as [CWE-122].

Attack Vector

Exploitation requires network access to a SQL Server instance and low-privilege authenticated access sufficient to invoke the PREDICT function or otherwise reach the Native Scoring code path. No user interaction is required. The attacker submits a crafted scoring request that carries malformed model or input data engineered to overflow a heap buffer inside the SQL Server process.

No verified public exploit or proof-of-concept code is available for CVE-2024-26191 at time of writing. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog. Refer to the Microsoft CVE-2024-26191 Advisory for authoritative technical details.

Detection Methods for CVE-2024-26191

Indicators of Compromise

  • Unexpected crashes or access violations in sqlservr.exe recorded in Windows Application event log, particularly with faulting modules related to Native Scoring or machine learning components.
  • Anomalous child processes spawned by sqlservr.exe, such as cmd.exe, powershell.exe, or rundll32.exe.
  • SQL sessions from low-privilege accounts issuing PREDICT statements or referencing serialized model blobs outside normal application patterns.

Detection Strategies

  • Audit SQL Server logs and Extended Events for repeated failures or unusual usage of the PREDICT function and sp_execute_external_script.
  • Monitor process ancestry for sqlservr.exe spawning shells, script interpreters, or network tools, which is atypical for a database engine.
  • Track outbound network connections initiated by the SQL Server service account to non-application destinations.

Monitoring Recommendations

  • Enable SQL Server audit for logins, role membership changes, and execution of scoring or external script procedures on affected instances.
  • Forward SQL Server error logs, Windows Application logs, and endpoint telemetry to a centralized SIEM for correlation.
  • Baseline normal Native Scoring query patterns per application account and alert on deviations in frequency, source host, or query shape.

How to Mitigate CVE-2024-26191

Immediate Actions Required

  • Apply the Microsoft security updates for SQL Server 2016, 2017, 2019, and 2022 as listed in the Microsoft CVE-2024-26191 Advisory.
  • Inventory all SQL Server instances, including Azure Connect Feature Pack deployments, and confirm patch level with SELECT @@VERSION.
  • Restrict database logins that can invoke PREDICT to only accounts that require Native Scoring functionality.

Patch Information

Microsoft has released cumulative updates and security-only patches for the affected SQL Server versions. Administrators should install the update corresponding to their SQL Server major version and cumulative update baseline. Consult the Microsoft Security Response Center advisory for the exact KB numbers and build versions that remediate CVE-2024-26191, and validate the post-patch build number matches the fixed release.

Workarounds

  • Where Native Scoring is not required, avoid granting the EXECUTE permission on the PREDICT function to application logins.
  • Enforce network segmentation and firewall rules so SQL Server TCP endpoints are reachable only from authorized application servers and administrative jump hosts.
  • Enforce least privilege on the SQL Server service account so that any code execution within sqlservr.exe has limited reach into the host operating system.
bash
# Configuration example: verify SQL Server build after patching
sqlcmd -S <server> -Q "SELECT SERVERPROPERTY('ProductVersion') AS Version, SERVERPROPERTY('ProductLevel') AS Level, SERVERPROPERTY('ProductUpdateLevel') AS CU;"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.