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

CVE-2024-37338: SQL Server Native Scoring RCE Vulnerability

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

Published:

CVE-2024-37338 Overview

CVE-2024-37338 is a remote code execution vulnerability in Microsoft SQL Server Native Scoring. The flaw stems from an out-of-bounds read condition [CWE-125] triggered during native scoring operations. An authenticated attacker with low privileges can send crafted requests over the network to execute arbitrary code in the SQL Server process context. Microsoft assigned this CVE a CVSS 3.1 base score of 8.8, reflecting network attack vector, low complexity, and high impact on confidentiality, integrity, and availability. The vulnerability affects supported editions of SQL Server 2016, 2017, 2019, and 2022, along with the SQL 2016 Azure Connect Feature Pack.

Critical Impact

Successful exploitation allows an authenticated attacker to execute arbitrary code within the SQL Server process, potentially leading to full database compromise and lateral movement.

Affected Products

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

Discovery Timeline

  • 2024-09-10 - CVE-2024-37338 published to NVD
  • 2026-08-10 - Last updated in NVD database

Technical Details for CVE-2024-37338

Vulnerability Analysis

The vulnerability resides in the Native Scoring feature of Microsoft SQL Server. Native Scoring executes pretrained machine learning models directly inside the database engine using the PREDICT T-SQL function. When SQL Server parses a serialized model or scoring input during a PREDICT call, the engine reads past the bounds of an allocated buffer. That out-of-bounds read [CWE-125] can be steered by attacker-controlled model data to leak memory or corrupt execution state and reach a code execution primitive.

Because exploitation requires authentication with only low privileges, any principal that can issue a PREDICT query against a database can attempt the attack. The EPSS score of 1.62% (74th percentile) reflects moderate exploitation likelihood relative to other published CVEs.

Root Cause

The root cause is missing bounds validation while deserializing scoring model structures inside the SQL Server engine. The parser trusts length fields embedded in the model payload without verifying them against the actual buffer size, resulting in reads beyond the allocated region during scoring.

Attack Vector

An authenticated attacker connects to a vulnerable SQL Server instance over the network using standard TDS on TCP 1433 or a configured port. The attacker then submits a PREDICT statement referencing a crafted serialized model. No user interaction is required, and the scope is unchanged, meaning execution occurs within the SQL Server service account context.

See the Microsoft Security Update Guide for the authoritative technical description.

Detection Methods for CVE-2024-37338

Indicators of Compromise

  • Unexpected PREDICT T-SQL statements originating from low-privileged accounts or application service accounts that do not normally invoke Native Scoring.
  • SQL Server process (sqlservr.exe) spawning unusual child processes such as cmd.exe, powershell.exe, or rundll32.exe.
  • Access violations, minidumps, or crash entries in the SQL Server ERRORLOG referencing scoring or PREDICT code paths.

Detection Strategies

  • Enable and review SQL Server Audit for SCHEMA_OBJECT_ACCESS_GROUP and statement-level auditing on databases where Native Scoring is enabled.
  • Alert on any process creation with sqlservr.exe as the parent, since this is anomalous under normal SQL Server operation.
  • Correlate authentication logs with PREDICT query telemetry to identify accounts using scoring features outside expected application patterns.

Monitoring Recommendations

  • Forward SQL Server error logs, extended events, and Windows process telemetry to a centralized analytics platform for correlation.
  • Baseline normal PREDICT usage per application and alert on deviations in source host, frequency, or model size.
  • Monitor east-west network flows from database servers, since post-exploitation activity frequently pivots to Active Directory or file shares.

How to Mitigate CVE-2024-37338

Immediate Actions Required

  • Apply the Microsoft security update for your SQL Server version as listed in the Microsoft Security Update Guide.
  • Inventory all SQL Server 2016, 2017, 2019, and 2022 instances, including the SQL 2016 Azure Connect Feature Pack, and confirm patch level.
  • Restrict EXECUTE permissions on the PREDICT function to accounts that require Native Scoring.
  • Enforce least privilege for application logins and remove unused database principals.

Patch Information

Microsoft released fixes as part of the September 2024 Patch Tuesday cycle. Refer to the Microsoft Security Update Guide for the specific cumulative update or GDR package matching each SQL Server build. Apply the update on all replicas, Always On availability group nodes, and failover cluster instances.

Workarounds

  • If patching cannot be performed immediately, revoke access to the PREDICT T-SQL function for non-essential principals to reduce the attack surface.
  • Restrict SQL Server network exposure so that only trusted application hosts can reach TCP 1433 or the configured listener port.
  • Disable Native Scoring where it is not in active use, and remove unused pretrained models from database catalogs.
bash
# Example: revoke PREDICT execution from a role until patching completes
sqlcmd -S <server> -Q "REVOKE EXECUTE ON sys.sp_predict FROM [AppReadRole];"

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.