The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2024-39677

CVE-2024-39677: NHibernate-Core SQL Injection Vulnerability

CVE-2024-39677 is a SQL injection flaw in NHibernate-Core affecting ILiteralType implementations. Attackers can exploit this in discriminator mappings and HQL queries. This article covers technical details, affected versions, impact, and mitigation steps.

Published: April 1, 2026

CVE-2024-39677 Overview

NHibernate, a popular object-relational mapper for the .NET framework, contains a SQL injection vulnerability in certain types implementing the ILiteralType.ObjectToSQLString interface. This vulnerability affects multiple areas of the framework including inheritance mappings with discriminator values, HQL queries referencing static application fields, and direct use of SqlInsertBuilder and SqlUpdateBuilder utilities with literal value overloads.

Critical Impact

Successful exploitation allows attackers to execute arbitrary SQL commands through the ORM layer, potentially leading to complete database compromise, data exfiltration, and unauthorized data manipulation in .NET applications using affected NHibernate versions.

Affected Products

  • NHibernate Core versions prior to 5.4.9
  • NHibernate Core versions 5.5.x prior to 5.5.2
  • Applications using ILiteralType.ObjectToSQLString methods directly

Discovery Timeline

  • July 8, 2024 - CVE-2024-39677 published to NVD
  • November 21, 2024 - Last updated in NVD database

Technical Details for CVE-2024-39677

Vulnerability Analysis

This SQL injection vulnerability (CWE-89) exists in NHibernate's type system, specifically in the implementation of ILiteralType.ObjectToSQLString methods. The flaw allows malicious input to bypass proper SQL escaping mechanisms, enabling attackers to inject arbitrary SQL commands through the ORM abstraction layer.

The vulnerability is particularly concerning because it affects core ORM functionality that developers typically trust for safe SQL generation. Applications become exposed through several common usage patterns: inheritance mappings using discriminator values, HQL queries that reference static fields, and direct usage of SQL builder utilities with literal values.

Root Cause

The root cause lies in inadequate input sanitization within the ObjectToSQLString methods of types implementing ILiteralType. When converting literal values to SQL string representations, special characters—particularly backslashes and other escape sequences—were not properly escaped before being incorporated into SQL queries. This allowed specially crafted input to break out of string contexts and inject malicious SQL commands.

Attack Vector

This vulnerability is exploitable over the network without requiring authentication or user interaction. An attacker can inject malicious SQL through:

  1. Discriminator values in inheritance mappings where user-controlled data influences discriminator selection
  2. HQL queries that reference static fields populated from external input
  3. SqlInsertBuilder/SqlUpdateBuilder calls using the AddColumn overload that accepts literal values derived from user input
  4. Direct ObjectToSQLString calls where application code passes untrusted data

The security patch introduces proper handling for backslash escaping in string literals, as shown in the configuration changes:

text
                             </para>
                         </entry>
                     </row>
+                    <row>
+                        <entry>
+                            <literal>escape_backslash_in_strings</literal>
+                        </entry>
+                        <entry>
+                            Indicates if the database needs to have backslash escaped in string literals.
+                            The default value is dialect dependant. That is <literal>false</literal> for
+                            most dialects.
+                            <para>
+                                <emphasis role="strong">eg.</emphasis> 
+                                <literal>true</literal> | <literal>false</literal>
+                            </para>
+                        </entry>
+                    </row>
                     <row>
                         <entry>
                             <literal>show_sql</literal>

Source: GitHub Commit b4a69d1a5ff5744312478d70308329af496e4ba9

Detection Methods for CVE-2024-39677

Indicators of Compromise

  • Unusual SQL queries containing escape sequences or unexpected SQL syntax in application logs
  • Database error logs showing malformed queries or SQL syntax errors originating from NHibernate operations
  • Evidence of unauthorized data access or modification through the ORM layer
  • Anomalous database activity patterns following web requests with special characters in input fields

Detection Strategies

  • Review application logs for SQL injection patterns in NHibernate-generated queries, particularly those involving string literals with backslash characters
  • Implement database query monitoring to detect anomalous SQL patterns or unauthorized data access
  • Audit code for usage of ObjectToSQLString methods, SqlInsertBuilder, and SqlUpdateBuilder with user-controlled input
  • Deploy web application firewalls (WAF) with rules targeting SQL injection payloads in requests processed by .NET applications

Monitoring Recommendations

  • Enable detailed logging for NHibernate query generation to identify potentially malicious inputs
  • Monitor database audit logs for unusual query patterns or privilege escalation attempts
  • Implement runtime application self-protection (RASP) to detect SQL injection attempts at the application layer
  • Set up alerts for database errors that may indicate exploitation attempts

How to Mitigate CVE-2024-39677

Immediate Actions Required

  • Upgrade NHibernate Core to version 5.4.9 or later for the 5.4.x branch
  • Upgrade NHibernate Core to version 5.5.2 or later for the 5.5.x branch
  • Audit all code paths using ILiteralType.ObjectToSQLString, SqlInsertBuilder, or SqlUpdateBuilder with user-supplied data
  • Implement input validation on all data that may be used in discriminator values or HQL queries

Patch Information

NHibernate has released security patches in versions 5.4.9 and 5.5.2 that address this SQL injection vulnerability. The fix introduces proper escaping of special characters, including backslashes, in string literals through a new dialect-dependent configuration option escape_backslash_in_strings. For complete details, see the GitHub Security Advisory GHSA-fg4q-ccq8-3r5q and the GitHub Pull Request #3547.

Workarounds

  • Avoid using ObjectToSQLString methods directly with untrusted input until patched versions can be deployed
  • Implement strict input validation and sanitization for any data that flows into HQL queries or inheritance discriminators
  • Use parameterized queries where possible instead of literal value methods
  • Consider implementing a custom ILiteralType with proper escaping as a temporary measure
bash
# Update NHibernate via NuGet Package Manager Console
Update-Package NHibernate -Version 5.5.2

# Or for .NET CLI
dotnet add package NHibernate --version 5.5.2

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

  • Vulnerability Details
  • TypeSQLI

  • Vendor/TechNhibernate

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability0.55%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-89
  • Technical References
  • GitHub Issue Discussion

  • GitHub Pull Request #3517
  • Vendor Resources
  • GitHub Commit Update

  • GitHub Pull Request #3547

  • GitHub Security Advisory GHSA-fg4q-ccq8-3r5q
  • Latest CVEs
  • CVE-2025-9185: Mozilla Firefox RCE Vulnerability

  • CVE-2025-9184: Mozilla Firefox RCE Vulnerability

  • CVE-2025-9180: Mozilla Firefox Auth Bypass Vulnerability

  • CVE-2025-8030: Mozilla Firefox RCE Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English