Hibernate Validator: Improper Control of Generation of Code
CVE-2025-35036 is a high-severity improper control of generation of code vulnerability in Hibernate Validator from Hibernate, with a CVSS 3.1 base score of 7.3 out of 10. It can be exploited remotely over the network by an unauthenticated attacker, without any action from a user. The record lists versions 6.2.0, 7.0.0 as the first without the flaw, so updating Hibernate Validator to one of those releases or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 0.78% chance of exploitation within 30 days, higher than 57% of scored CVEs.
High severity with no evidence of exploitation so far.
What to do
- Update Hibernate Validator to 6.2.0 or 7.0.0, whichever matches your release line, or a later version.
- Until you can update, restrict network access to the affected service so it is not reachable from untrusted networks.
Affected products and versions
| Vendor | Product | Affected versions | Fixed in |
|---|---|---|---|
| Hibernate | Hibernate Validator | before 6.2.0; before 7.0.0 | 6.2.0, 7.0.0 |
Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.
How the severity score breaks down
- Attack vector
- NetworkCan be exploited remotely over a network, including the internet.
- Attack complexity
- LowNo special conditions are needed; the attack works reliably.
- Privileges required
- NoneNo account or login is needed.
- User interaction
- NoneNo action by a victim is required.
- Scope
- UnchangedImpact stays within the vulnerable component.
- Confidentiality
- LowSome restricted data can be read.
- Integrity
- LowLimited modification of data is possible.
- Availability
- LowPerformance or availability is reduced.
Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L. Scored by CNA.
| Scoring system | Score | Severity | Scored by |
|---|---|---|---|
| CVSS 4.0 | 6.9 | Medium | CNA |
| CVSS 3.1 | 7.3 | High | CNA |
Official description
Hibernate Validator before 6.2.0 and 7.0.0, by default and depending how it is used, may interpolate user-supplied input in a constraint violation message with Expression Language. This could allow an attacker to access sensitive information or execute arbitrary Java code. Hibernate Validator as of 6.2.0 and 7.0.0 no longer interpolates custom constraint violation messages with Expression Language and strongly recommends not allowing user-supplied input in constraint violation messages. CVE-2020-5245 and CVE-2025-4428 are examples of related, downstream vulnerabilities involving Expression Language intepolation of user-supplied data.
Source: the CVE record as published by its numbering authority, via NVD and CVE.org.
The underlying weakness: Improper Control of Generation of Code
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
How developers prevent this class of flaw
- Refactor your program so that you do not have to dynamically generate code.
- Run your code in a jail or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which code can be executed by your product. Examples include the Unix chroot jail and AppArmor. In general, managed code may provide some protection. This may not be a feasible solution, and it only limits the impact to the operating system; the rest of your application may still be subject to compromise. Be careful to avoid CWE-243 and other weaknesses related to jails.
- Use dynamic tools and techniques that interact with the product using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The product's operation may slow down, but it should not become unstable, crash, or generate incorrect results.
More Improper Control of Generation of Code vulnerabilities (CWE-94)
Timeline
- CVE record published.
- CISA published its SSVC assessment (exploitation: poc, automatable: no, technical impact: partial).
- Record last changed materially (score, affected products, status or references).
References
Patches and release notes
- github.com/hibernate/hibernate-validator/commit/05f795bb7cf18856004f40e5042709e550ed0d6e
- github.com/hibernate/hibernate-validator/commit/254858d9dcc4e7cd775d1b0f47f482218077c5e1
- github.com/hibernate/hibernate-validator/commit/d2db40b9e7d22c7a0b44d7665242dfc7b4d14d78
- github.com/hibernate/hibernate-validator/commit/e076293b0ee1bfa97b6e67d05ad9eee1ad77e893
- github.com/hibernate/hibernate-validator/compare/6.1.7.Final...6.2.0.FinalRelease Notes
- github.com/hibernate/hibernate-validator/pull/1138Issue Tracking
- hibernate.org/validator/documentation/migration-guide/#6-2-0-cr1Release Notes
- in.relation.to/2021/01/06/hibernate-validator-700-62-final-released/#expression-languageRelease Notes
Other references
- docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/#section-hibernateconstraintvalidatorco…Product
- hibernate.atlassian.net/browse/HV-1816Issue Tracking
- labs.watchtowr.com/expression-payloads-meet-mayhem-cve-2025-4427-and-cve-2025-4428/Not Applicable
- cve.org/CVERecord?id=CVE-2020-5245Not Applicable
- cve.org/CVERecord?id=CVE-2025-4428Not Applicable
Recent Improper Control of Generation of Code vulnerabilities
- 9.8 Critical severity
- 7.2 High severity
- 7.2 High severity
- 7.8 High severity
- 7.8 High severity
- 7.2 High severity
Spotted an error? Tell us.