GHSA-6Q3Q-6V5J-H6VG
Vulnerability from github – Published: 2024-11-27 19:00 – Updated: 2025-10-13 11:47Summary
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.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "io.github.openfeign.querydsl:querydsl-jpa"
},
"ranges": [
{
"events": [
{
"introduced": "6.0.0.M1"
},
{
"fixed": "6.10.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "io.github.openfeign.querydsl:querydsl-apt"
},
"ranges": [
{
"events": [
{
"introduced": "6.0.0.M1"
},
{
"fixed": "6.10.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "io.github.openfeign.querydsl:querydsl-jpa"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "5.6.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "io.github.openfeign.querydsl:querydsl-apt"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "5.6.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "com.querydsl:querydsl-jpa"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "5.1.0"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "com.querydsl:querydsl-apt"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "5.1.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2024-49203"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": true,
"github_reviewed_at": "2024-11-27T19:00:53Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "### Summary\nThe 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**.\n\n### Details\nVulnerable code may look as follows:\n```\n@GetMapping\npublic List\u003cTest\u003e getProducts(@RequestParam(\"orderBy\") String orderBy) {\n JPAQuery\u003cTest\u003e query = new JPAQuery\u003cTest\u003e(entityManager).from(test);\n PathBuilder\u003cTest\u003e pathBuilder = new PathBuilder\u003c\u003e(Test.class, \"test\");\n\n OrderSpecifier order = new OrderSpecifier(Order.ASC, pathBuilder.get(orderBy));\n JPAQuery\u003cTest\u003e orderedQuery = query.orderBy(order);\n return orderedQuery.fetch();\n}\n```\nWhere vulnerability is either caused by ```pathBuilder.get(orderBy)``` or the ```orderBy(order)``` method itself, based on where the security checks are expected.\n\n### PoC\nFull POC code is available in repository:\nhttps://github.com/CSIRTTrizna/CVE-2024-49203/\nWhen we take a look at source code shown in Details section the functionality is as follows:\n\n1) Create JPAQuery object instance:\n```\nJPAQuery\u003cTest\u003e query = new JPAQuery\u003cTest\u003e(entityManager).from(test);\n```\n\n2) Create OrderSpecifier object instance:\n```\nPathBuilder\u003cTest\u003e pathBuilder = new PathBuilder\u003c\u003e(Test.class, \"test\");\nOrderSpecifier order = new OrderSpecifier(Order.ASC, pathBuilder.get(orderBy));\n```\nWhere orderBy variable is user provided input.\n\n3) order and run the query\n```\nJPAQuery\u003cTest\u003e orderedQuery = query.orderBy(order);\norderedQuery.fetch();\n```\n\nWhen user goes to URL \n```/products?orderBy=name+INTERSECT+SELECT+t+FROM+Test+t+WHERE+(SELECT+cast(pg_sleep(10) AS text))=\u00272\u0027+ORDER+BY+t.id```\nThe generated query will look something like this:\n```\nselect test \nfrom Test test\norder by test.name INTERSECT SELECT t FROM Test t WHERE (SELECT cast(pg_sleep(10) AS text))=\u00272\u0027 ORDER BY t.id asc\n```\n\n#### Environment\n\nLibrary versions used in proof of concept to reproduce the vulnerability:\n```\nquerydsl-jpa: 6.8.0\nquerydsl-apt: 6.8.0\nhibernate-core: 6.1.1.Final\njakarta.persistence-api: 3.1.0\npostgresql: 42.7.4\n```\n\n### Impact\nThe 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.",
"id": "GHSA-6q3q-6v5j-h6vg",
"modified": "2025-10-13T11:47:54Z",
"published": "2024-11-27T19:00:53Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/OpenFeign/querydsl/security/advisories/GHSA-6q3q-6v5j-h6vg"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-49203"
},
{
"type": "WEB",
"url": "https://github.com/querydsl/querydsl/issues/3757"
},
{
"type": "WEB",
"url": "https://github.com/CSIRTTrizna/CVE-2024-49203"
},
{
"type": "PACKAGE",
"url": "https://github.com/OpenFeign/querydsl"
},
{
"type": "WEB",
"url": "https://github.com/OpenFeign/querydsl/releases/tag/5.6.1"
},
{
"type": "WEB",
"url": "https://github.com/OpenFeign/querydsl/releases/tag/6.10.1"
},
{
"type": "WEB",
"url": "https://github.com/querydsl/querydsl/releases/tag/QUERYDSL_5_1_0"
},
{
"type": "WEB",
"url": "https://www.csirt.sk/querydsl-java-library-vulnerability-permits-sql-hql-injection.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L",
"type": "CVSS_V3"
},
{
"score": "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",
"type": "CVSS_V4"
}
],
"summary": "Querydsl vulnerable to HQL injection through orderBy"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.