# CVE-2023-1932: Hibernate-validator: rendering of invalid html with safehtml leads to html injection and xss

> Attackers can bypass SafeHtml validation to inject malicious HTML and execute scripts in user browsers via Hibernate Validator.

- **Severity:** Medium 6.1 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 7 Nov 2024
- **Updated:** 7 Nov 2024
- **Also known as:** CLSA-2026-1792693332, DEBIAN-CVE-2023-1932, GHSA-x83m-pf6f-pf9g, UBUNTU-CVE-2023-1932

## What is CVE-2023-1932?

CVE-2023-1932 is a medium-severity cross-site scripting vulnerability in Redhat Jboss Enterprise Application Platform, published on 7 Nov 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

A flaw was found in hibernate-validator's 'isValid' method in the org.hibernate.validator.internal.constraintvalidators.hv.SafeHtmlValidator class, which can be bypassed by omitting the tag ending in a less-than character. Browsers may render an invalid html, allowing HTML injection or Cross-Site-Scripting (XSS) attacks.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation)

## Which versions are affected by CVE-2023-1932?

4 open source packages ship an affected version, including org.hibernate.validator:hibernate-validator and org.hibernate:hibernate-validator. It affects 5 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.hibernate.validator:hibernate-validator` | Maven | All versions | 6.2.0.Final |
| `org.hibernate.validator:hibernate-validator` | Maven | All versions | 6.2.0.Final |
| `org.hibernate:hibernate-validator` | Maven | All versions | 6.2.0.Final |
| `org.hibernate:hibernate-validator` | Maven | All versions | 6.2.0.Final |

Products: Hibernate Hibernate-Validator, Redhat Codeready Studio, Redhat Jboss Enterprise Application Platform, Redhat Openstack Platform, Redhat Single Sign-On.

## How do I fix CVE-2023-1932?

Upgrade org.hibernate.validator:hibernate-validator to 6.2.0.Final or later.

## Is CVE-2023-1932 being exploited?

There is no known exploitation of CVE-2023-1932 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-1932 and fix it if it is affected.

What it is: CVE-2023-1932 is a medium-severity cross-site scripting vulnerability in Redhat Jboss Enterprise Application Platform, published on 7 Nov 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2023-1932 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.hibernate.validator:hibernate-validator (Maven): affected all versions; fixed in 6.2.0.Final
- org.hibernate.validator:hibernate-validator (Maven): affected all versions; fixed in 6.2.0.Final
- org.hibernate:hibernate-validator (Maven): affected all versions; fixed in 6.2.0.Final
- org.hibernate:hibernate-validator (Maven): affected all versions; fixed in 6.2.0.Final

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-1932/ (Markdown: https://insights.sbomify.com/CVE-2023-1932/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-1932
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-1932
- OSV: https://osv.dev/vulnerability/CVE-2023-1932

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-1932/
Summaries are generated and may contain mistakes; the official description above is the record.
