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

High 8.1 Published Updated

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

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

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

Which versions are affected by CVE-2022-24815?

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

PackageAffectedFixed in
generator-jhipster npmFrom 7.0.07.8.1
generator-jhipster npmFrom 7.0.07.8.1

Products include Jhipster Generator-Jhipster.

How do I fix CVE-2022-24815?

Upgrade generator-jhipster to 7.8.1 or later.

Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.

Is CVE-2022-24815 being exploited?

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

Sources

Also known as GHSA-qjmq-8hjr-qcv6.

Is CVE-2022-24815 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free