CVE-2024-37339 Overview
CVE-2024-37339 is a remote code execution vulnerability in the Native Scoring feature of Microsoft SQL Server. The flaw is tracked under [CWE-822: Untrusted Pointer Dereference] and affects SQL Server 2016, 2017, 2019, and 2022, as well as the SQL 2016 Azure Connect Feature Pack. An authenticated attacker with low privileges can send crafted input to the Native Scoring interface over the network to execute arbitrary code within the SQL Server process context. Microsoft published the advisory on September 10, 2024. Successful exploitation compromises confidentiality, integrity, and availability of the database instance and any data it hosts.
Critical Impact
Authenticated network-based exploitation grants arbitrary code execution inside the SQL Server process, exposing all databases on the affected instance.
Affected Products
- Microsoft SQL Server 2016 (x64) and SQL 2016 Azure Connect Feature Pack
- Microsoft SQL Server 2017 and 2019 (x64)
- Microsoft SQL Server 2022 (x64)
Discovery Timeline
- 2024-09-10 - CVE-2024-37339 published to NVD
- 2026-08-10 - Last updated in NVD database
Technical Details for CVE-2024-37339
Vulnerability Analysis
The vulnerability resides in the Native Scoring feature of Microsoft SQL Server. Native Scoring uses the PREDICT T-SQL function to run pre-trained machine learning models directly inside the database engine without launching an external R or Python process. The scoring path deserializes a model binary and processes untrusted input against it, and mishandling of pointer values during this operation produces an untrusted pointer dereference condition classified as [CWE-822]. An attacker who submits a crafted model or crafted scoring input can steer execution to attacker-controlled memory. The result is arbitrary code execution in the security context of the SQL Server service account.
Root Cause
The underlying defect is an untrusted pointer dereference within the Native Scoring code path. The engine trusts pointer-like values derived from attacker-influenced serialized model data or from parameters passed to PREDICT. Because these values are dereferenced without adequate validation, memory corruption and control-flow hijack become possible.
Attack Vector
Exploitation requires network access to the SQL Server instance and a low-privileged authenticated session, such as a database user with permission to call PREDICT or to insert a model into a table used for scoring. No user interaction is required. The attacker sends a malformed model or malicious scoring payload; the engine parses it, dereferences the crafted pointer, and executes attacker-supplied code. See the Microsoft CVE-2024-37339 Advisory for vendor-confirmed details on affected builds and preconditions.
No public proof-of-concept or in-the-wild exploitation has been reported at the time of writing. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog.
Detection Methods for CVE-2024-37339
Indicators of Compromise
- Unexpected child processes spawned by sqlservr.exe, such as cmd.exe, powershell.exe, or rundll32.exe.
- SQL Server error log entries referencing access violations, stack dumps, or minidumps generated during or immediately after PREDICT execution.
- Anomalous outbound network connections originating from the SQL Server service account host.
- New or modified rows in tables that store serialized model binaries used by Native Scoring.
Detection Strategies
- Audit T-SQL execution for use of the PREDICT function by low-privileged principals, especially against models that were recently inserted or updated.
- Alert on process-lineage anomalies where sqlservr.exe is the parent of a shell, scripting host, or LOLBin.
- Correlate SQL Server minidump generation events with subsequent authentication or network activity from the database host.
Monitoring Recommendations
- Enable SQL Server Audit for SCHEMA_OBJECT_ACCESS_GROUP and DML on model-storage tables to track model ingestion.
- Forward SQL Server error logs and Windows Security event logs to a centralized analytics platform for correlation across sessions and hosts.
- Track patch level of SQL Server instances against the fixed builds listed in the Microsoft advisory and alert on drift.
How to Mitigate CVE-2024-37339
Immediate Actions Required
- Apply the Microsoft security update for the affected SQL Server 2016, 2017, 2019, or 2022 build as documented in the vendor advisory.
- Inventory all SQL Server instances, including those bundled through the SQL 2016 Azure Connect Feature Pack, and confirm patch status.
- Restrict EXECUTE permissions on the PREDICT function and access to tables storing serialized models to trusted principals only.
- Rotate service account credentials on any instance where compromise is suspected following unexplained crashes tied to Native Scoring.
Patch Information
Microsoft released fixed builds through the September 2024 Patch Tuesday cycle. Refer to the Microsoft CVE-2024-37339 Advisory for the specific cumulative update, GDR, or security-only package corresponding to each supported SQL Server version and service pack.
Workarounds
- Where Native Scoring is not required, revoke EXECUTE on sys.sp_execute_external_script and on the PREDICT function from non-administrative roles.
- Enforce least privilege on database logins so that only vetted service accounts can insert or update model binaries used by PREDICT.
- Place SQL Server instances behind network segmentation so that only application tiers and administrative jump hosts can reach TCP/1433 or the configured SQL endpoint.
# Example T-SQL to revoke PREDICT execution from a low-privileged role
# Run in each affected database until the patch is deployed
REVOKE EXECUTE ON OBJECT::sys.sp_execute_external_script FROM [app_scoring_role];
DENY EXECUTE ON OBJECT::sys.sp_execute_external_script TO [app_scoring_role];
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

