CVE-2020-25638: SQL Injection in Hibernate-Core
Summary
CVE-2020-25638: SQL injection in hibernate-core. Affects org.hibernate:hibernate-core across 2 version ranges.
< 5.3.20.Final
>= 5.4.0.Final, < 5.4.24.Final
Fixed in 5.3.20.Final or 5.4.24.Final, depending on the release line you run. How to fix ↓
Also tracked for
- libhibernate3-java · Debian:11
The same CVE-2020-25638 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Hibernate-Core is a widely used Java library that provides an object-relational mapping (ORM) framework for mapping Java objects to relational databases. It is commonly used in enterprise applications to simplify database operations and improve performance. However, versions prior to 5.3.20.Final and 5.4.0.Final up to and including 5.4.23.Final of Hibernate-Core are vulnerable to a SQL injection attack.
Vulnerability Detail
The vulnerability in Hibernate-Core arises from a flaw in the implementation of the JPA Criteria API. It allows for unsanitized literals when a literal is used in the SQL comments of a query, leading to potential SQL injection. An attacker exploiting this vulnerability can gain unauthorized access to sensitive information or perform further malicious actions. The severity of this vulnerability is rated as HIGH, with a CVSS score of 7.4, posing a significant threat to data confidentiality and integrity.
How To Fix
Latest published version: 8.0.0.Beta1 as of 22 Oct 2026
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 5.3.20.Final5.3.20.Final -
>= 5.4.0.Final, < 5.4.24.Final5.4.24.Final
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a temporary workaround, developers can manually sanitize the literals used in SQL comments to prevent SQL injection. This can be achieved by using parameterized queries or input validation to ensure that user-supplied data is properly sanitized before being included in SQL queries.
Conclusion
The SQL injection vulnerability in Hibernate-Core can have severe consequences for data confidentiality and integrity. It is crucial to promptly upgrade to the fixed versions or implement the recommended workarounds to mitigate the risk. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for org.hibernate:hibernate-core →
FAQ
Hibernate-Core is a Java library that provides an object-relational mapping (ORM) framework for mapping Java objects to relational databases. It simplifies database operations and improves performance in enterprise applications.
SQL injection is a type of security vulnerability where an attacker can insert malicious SQL code into a query, potentially gaining unauthorized access to the database or manipulating its contents.
The vulnerability in Hibernate-Core can allow an attacker to access unauthorized information or perform further attacks, compromising data confidentiality and integrity.
To fix this vulnerability, it is recommended to upgrade Hibernate-Core to the fixed versions: 5.4.24.Final or 5.3.20.Final, depending on the currently used version.
As a temporary workaround, developers can manually sanitize the literals used in SQL comments to prevent SQL injection. This involves using parameterized queries or input validation to ensure proper sanitization of user-supplied data.
References
Related vulnerabilities
Recent vulnerabilities recorded for org.hibernate:hibernate-core.