CVE-2020-25638: Hibernate core SQL Injection Vulnerability
HIGHCVE-2020-25638 is a HIGH (CVSS 7.4) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Hibernate core libraries in the Maven ecosystem. The issue involves sql injection in hibernate-core. Remediation is available by upgrading affected packages to version 5.4.24.Final, 5.3.20.Final.
CVE-2020-25638 at a Glance
Security Impact
CVSS: 7.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N).
How to Fix CVE-2020-25638
To remediate this vulnerability, upgrade all affected Hibernate core dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.24.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.20.Final</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.hibernate
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2020-25638, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.hibernate
Analyze the terminal output to locate any version of Hibernate core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.4.24.Final), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.hibernate command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Hibernate core, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2020-25638 Affected Hibernate core Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.hibernate:hibernate-core
|
Maven |
≥ 5.4.0.Final
< 5.4.24.Final
|
5.4.24.Final
|
|
org.hibernate:hibernate-core
|
Maven |
< 5.3.20.Final
|
5.3.20.Final
|
References
Frequently Asked Questions
What is CVE-2020-25638?
Which Hibernate core versions are affected?
What version fixes CVE-2020-25638?
Is hibernate-core affected?
What is the CVSS score of CVE-2020-25638?
What CWE is associated with CVE-2020-25638?
How can I check Maven dependencies for CVE-2020-25638?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-j8jw-g6fq-mp7h",
"modified" : "2024-06-27T16:39:57Z",
"published" : "2022-02-09T22:57:29Z",
"aliases" : [ "CVE-2020-25638" ],
"summary" : "SQL injection in hibernate-core",
"details" : "A flaw was found in hibernate-core in versions prior to 5.3.20.Final and in 5.4.0.Final up to and including 5.4.23.Final. A SQL injection in the implementation of the JPA Criteria API can permit unsanitized literals when a literal is used in the SQL comments of the query. This flaw could allow an attacker to access unauthorized information or possibly conduct further attacks. The highest threat from this vulnerability is to data confidentiality and integrity.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.hibernate:hibernate-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.4.0.Final"
}, {
"fixed" : "5.4.24.Final"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.hibernate:hibernate-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.3.20.Final"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-25638"
}, {
"type" : "WEB",
"url" : "https://github.com/hibernate/hibernate-orm/commit/36ebf7d3836e83e99f2a91777b5389e1daf1f2b7"
}, {
"type" : "WEB",
"url" : "https://github.com/hibernate/hibernate-orm/commit/59fede7acaaa1579b561407aefa582311f7ebe78"
}, {
"type" : "WEB",
"url" : "https://github.com/hibernate/hibernate-orm/commit/d22bbb5c339c9df7712c3365bb1df97c91b35ec5"
}, {
"type" : "WEB",
"url" : "https://bugzilla.redhat.com/show_bug.cgi?id=1881353"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/hibernate/hibernate-orm"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/r833c1276e41334fa675848a08daf0c61f39009f9f9a400d9f7006d44@%3Cdev.turbine.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/rf2378209c676a28b71f9b604a3b3517c448540b85367160e558ef9df@%3Ccommits.turbine.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2021/01/msg00000.html"
}, {
"type" : "WEB",
"url" : "https://www.debian.org/security/2021/dsa-4908"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com//security-alerts/cpujul2021.html"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-89" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-04-09T22:49:21Z",
"nvd_published_at" : "2020-12-02T15:15:00Z"
}
}