Loading...
Skip to main content

CVE-2024-49203 — Vulnerability in...

HIGH

Querydsl vulnerable to HQL injection through orderBy

Published November 27, 2024Updated October 13, 2025Source: osv

Summary

### Summary The order by method enables injecting HQL queries. This may cause blind HQL injection, which could lead to leakage of sensitive information, and potentially also Denial Of Service. This vulnerability is present since the original querydsl repository(https://github.com/querydsl/querydsl) where it was assigned preliminary CVE identifier **CVE-2024-49203**. ### Details Vulnerable code may look as follows: ``` @GetMapping public List<Test> getProducts(@RequestParam("orderBy") String orderBy) { JPAQuery<Test> query = new JPAQuery<Test>(entityManager).from(test); PathBuilder<Test> pathBuilder = new PathBuilder<>(Test.class, "test"); OrderSpecifier order = new OrderSpecifier(Order.ASC, pathBuilder.get(orderBy)); JPAQuery<Test> orderedQuery = query.orderBy(order); return orderedQuery.fetch(); } ``` Where vulnerability is either caused by ```pathBuilder.get(orderBy)``` or the ```orderBy(order)``` method itself, based on where the security checks are expected. ### PoC Full POC code is available in repository: https://github.com/CSIRTTrizna/CVE-2024-49203/ When we take a look at source code shown in Details section the functionality is as follows: 1) Create JPAQuery object instance: ``` JPAQuery<Test> query = new JPAQuery<Test>(entityManager).from(test); ``` 2) Create OrderSpecifier object instance: ``` PathBuilder<Test> pathBuilder = new PathBuilder<>(Test.class, "test"); OrderSpecifier order = new OrderSpecifier(Order.ASC, pathBuilder.get(orderBy)); ``` Where orderBy variable is user provided input. 3) order and run the query ``` JPAQuery<Test> orderedQuery = query.orderBy(order); orderedQuery.fetch(); ``` When user goes to URL ```/products?orderBy=name+INTERSECT+SELECT+t+FROM+Test+t+WHERE+(SELECT+cast(pg_sleep(10) AS text))='2'+ORDER+BY+t.id``` The generated query will look something like this: ``` select test from Test test order by test.name INTERSECT SELECT t FROM Test t WHERE (SELECT cast(pg_sleep(10) AS text))='2' ORDER BY t.id asc ``` #### Environment Library versions used in proof of concept to reproduce the vulnerability: ``` querydsl-jpa: 6.8.0 querydsl-apt: 6.8.0 hibernate-core: 6.1.1.Final jakarta.persistence-api: 3.1.0 postgresql: 42.7.4 ``` ### Impact The vulnerability is HQL injection, so anyone using source code similar to one provided in details is exposed to potentional information leakage and denial of service.

Advisory Timeline

  • First published November 27, 2024 (684 days ago).
  • Last revised October 13, 2025 — 320 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Maven
Update io.github.openfeign.querydsl:querydsl-apt to 5.6.1 or later
<!-- Update pom.xml dependency version to 5.6.1 for io.github.openfeign.querydsl:querydsl-apt -->
Maven
Update io.github.openfeign.querydsl:querydsl-jpa to 6.10.1 or later
<!-- Update pom.xml dependency version to 6.10.1 for io.github.openfeign.querydsl:querydsl-jpa -->
Maven
Update io.github.openfeign.querydsl:querydsl-apt to 6.10.1 or later
<!-- Update pom.xml dependency version to 6.10.1 for io.github.openfeign.querydsl:querydsl-apt -->
Maven
Update io.github.openfeign.querydsl:querydsl-jpa to 5.6.1 or later
<!-- Update pom.xml dependency version to 5.6.1 for io.github.openfeign.querydsl:querydsl-jpa -->

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (6)

Affects 1 ecosystem: maven (4).

PackageEcosystemAffectedFixed In
io.github.openfeign.querydsl:querydsl-apt
maven
5.0.1, 5.1, 5.1.1, 5.2 (+4 more)5.6.1
io.github.openfeign.querydsl:querydsl-jpa
maven
6.0, 6.0.0.M1, 6.0.0.M2, 6.0.0.M3 (+15 more)6.10.1
com.querydsl:querydsl-apt
maven
4.0.0, 4.0.1, 4.0.2, 4.0.3 (+20 more)Range-based data available
io.github.openfeign.querydsl:querydsl-apt
maven
6.0, 6.0.0.M1, 6.0.0.M2, 6.0.0.M3 (+15 more)6.10.1
io.github.openfeign.querydsl:querydsl-jpa
maven
5.0.1, 5.1, 5.1.1, 5.2 (+4 more)5.6.1
com.querydsl:querydsl-jpa
maven
4.0.0, 4.0.1, 4.0.2, 4.0.3 (+20 more)Range-based data available

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 8.2 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
Low

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L

Frequently Asked Questions

What is CVE-2024-49203?
Querydsl vulnerable to HQL injection through orderBy This vulnerability has been assigned a severity rating of HIGH (CVSS score: 8.2/10).
How do I check if my project is affected by CVE-2024-49203?
CVE-2024-49203 affects io.github.openfeign.querydsl:querydsl-apt, io.github.openfeign.querydsl:querydsl-jpa and com.querydsl:querydsl-apt (and 1 more). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-49203 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
8.2

High exploitability or significant impact. Prioritize remediation within days.

Also Known As

GHSA-6q3q-6v5j-h6vg

Related CVEs

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies