CVE-2020-25638: SQL Injection in Hibernate-Core

org.hibernate:hibernate-core Updated 02 Oct 2025

Summary

09/02/2022
Yes i
High
7.4

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

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.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

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.Final 5.3.20.Final
  • >= 5.4.0.Final, < 5.4.24.Final 5.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 →

Share this vulnerability

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.

Related vulnerabilities

Recent vulnerabilities recorded for org.hibernate:hibernate-core.

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.Final 5.3.20.Final
  • >= 5.4.0.Final, < 5.4.24.Final 5.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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback