# CVE-2022-24815: SQL Injection when creating an application with Reactive SQL backend

> Attackers can execute arbitrary SQL commands in JHipster-generated reactive applications using Spring WebFlux and R2DBC due to unsanitized criteria inputs.

- **Severity:** High 8.1 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 11 Apr 2022
- **Updated:** 22 Apr 2025
- **Also known as:** GHSA-qjmq-8hjr-qcv6

## What is CVE-2022-24815?

CVE-2022-24815 is a high-severity SQL injection vulnerability in generator-jhipster, published on 11 Apr 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures. SQL Injection vulnerability in entities for applications generated with the option "reactive with Spring WebFlux" enabled and an SQL database using r2dbc. Applications created without "reactive with Spring WebFlux" and applications with NoSQL databases are not affected. Users who have generated a microservice Gateway using the affected version may be impacted as Gateways are reactive by default. Currently, SQL injection is possible in the findAllBy(Pageable pageable, Criteria criteria) method of an entity repository class generated in these applications as the where clause using Criteria for queries are not sanitized and user input is passed on as it is by the criteria. This issue has been patched in v7.8.1. Users unable to upgrade should be careful when combining criterias and conditions as the root of the issue lies in the `EntityManager.java` class when creating the where clause via `Conditions.just(criteria.toString())`. `just` accepts the literal string provided. Criteria's `toString` method returns a plain string and this combination is vulnerable to sql injection as the string is not sanitized and will contain whatever used passed as input using any plain SQL.

Weakness: CWE-89 (Improper Neutralization of Special Elements used in an SQL Command)

## Which versions are affected by CVE-2022-24815?

2 open source packages ship an affected version, including generator-jhipster. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `generator-jhipster` | npm | From 7.0.0 | 7.8.1 |
| `generator-jhipster` | npm | From 7.0.0 | 7.8.1 |

Products: Jhipster Generator-Jhipster.

## How do I fix CVE-2022-24815?

Upgrade generator-jhipster to 7.8.1 or later.

## Is CVE-2022-24815 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-24815 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-24815 and fix it if it is affected.

What it is: CVE-2022-24815 is a high-severity SQL injection vulnerability in generator-jhipster, published on 11 Apr 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-24815 exists.

Affected packages and fixed versions:
- generator-jhipster (npm): affected from 7.0.0; fixed in 7.8.1
- generator-jhipster (npm): affected from 7.0.0; fixed in 7.8.1

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-2022-24815/ (Markdown: https://insights.sbomify.com/CVE-2022-24815/index.md)
```

## Sources

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

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