CVE-2024-39677 NHibernate SQL injection vulnerability in discriminator mappings, static fields referenced in HQL, and some utilities
Attackers can execute arbitrary SQL commands via NHibernate discriminator mappings, HQL static fields, or SQL builder utilities, compromising database integrity.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-39677?
CVE-2024-39677 is a medium-severity SQL injection vulnerability in nhibernate-core, published on 8 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
NHibernate is an object-relational mapper for the .NET framework. A SQL injection vulnerability exists in some types implementing ILiteralType.ObjectToSQLString. Callers of these methods are exposed to the vulnerability, which includes mappings using inheritance with discriminator values; HQL queries referencing a static field of the application; users of the SqlInsertBuilder and SqlUpdateBuilder utilities, calling their AddColumn overload taking a literal value; and any direct use of the ObjectToSQLString methods for building SQL queries on the user side. This vulnerability is fixed in 5.4.9 and 5.5.2.
Weakness: CWE-89
Which versions are affected by CVE-2024-39677?
4 open source packages ship an affected version, including NHibernate. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
NHibernate NuGet | All versions | 5.4.9 |
NHibernate NuGet | All versions | 5.4.9 |
NHibernate NuGet | From 5.5.0 | 5.5.2 |
NHibernate NuGet | From 5.5.0 | 5.5.2 |
Products include Nhibernate Nhibernate-Core.
How do I fix CVE-2024-39677?
Upgrade NHibernate to a fixed version for your release line: 5.4.9 or 5.5.2.
Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.
Is CVE-2024-39677 being exploited?
There is no known exploitation of CVE-2024-39677 in the wild and no public exploit code.
Sources
Also known as GHSA-fg4q-ccq8-3r5q.