Vulnerabilities in pkg:maven/io.github.openfeign.querydsl/querydsl-apt

PACKAGE
Advisory Identifier: GHSA-6q3q-6v5j-h6vg
Advisory Summary

CVE-2024-49203 is a HIGH (CVSS 8.2) querydsl vulnerable to hql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Querydsl jpa libraries in the Maven ecosystem. The issue involves querydsl vulnerable to hql injection through orderby. Remediation is available by upgrading affected packages to version 6.10.1, 5.6.1.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:maven/io.github.openfeign.querydsl/querydsl-apt

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:maven/io.github.openfeign.querydsl/querydsl-apt. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-6q3q-6v5j-h6vg CVE-2024-49203 HIGH Querydsl vulnerable to HQL injection through orderBy
GHSA-wpvf-5mc3-hv6m - CRITICAL Duplicate Advisory: Querydsl SQL/HQL injection

CVE-2024-49203 at a Glance

CVE Identifier CVE-2024-49203
GHSA Identifier GHSA-6q3q-6v5j-h6vg
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Querydsl jpa
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2024-49203

To remediate this vulnerability, upgrade all affected Querydsl jpa dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

io.github.openfeign.querydsl:querydsl-jpa fixed: 6.10.1
<dependency>
    <groupId>io.github.openfeign.querydsl</groupId>
    <artifactId>querydsl-jpa</artifactId>
    <version>6.10.1</version>
</dependency>
io.github.openfeign.querydsl:querydsl-apt fixed: 6.10.1
<dependency>
    <groupId>io.github.openfeign.querydsl</groupId>
    <artifactId>querydsl-apt</artifactId>
    <version>6.10.1</version>
</dependency>
io.github.openfeign.querydsl:querydsl-jpa fixed: 5.6.1
<dependency>
    <groupId>io.github.openfeign.querydsl</groupId>
    <artifactId>querydsl-jpa</artifactId>
    <version>5.6.1</version>
</dependency>
io.github.openfeign.querydsl:querydsl-apt fixed: 5.6.1
<dependency>
    <groupId>io.github.openfeign.querydsl</groupId>
    <artifactId>querydsl-apt</artifactId>
    <version>5.6.1</version>
</dependency>
com.querydsl:querydsl-jpa fixed: Latest secure release
<dependency>
    <groupId>com.querydsl</groupId>
    <artifactId>querydsl-jpa</artifactId>
    <version>Latest secure release</version>
</dependency>
com.querydsl:querydsl-apt fixed: Latest secure release
<dependency>
    <groupId>com.querydsl</groupId>
    <artifactId>querydsl-apt</artifactId>
    <version>Latest secure release</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=io.github.openfeign.querydsl

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2024-49203, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=io.github.openfeign.querydsl

Analyze the terminal output to locate any version of Querydsl jpa in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.10.1), your application is affected.

Note: The mvn dependency:tree -Dincludes=io.github.openfeign.querydsl command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Querydsl jpa, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.

CVE-2024-49203 Affected Querydsl jpa Versions

6 component(s)
Fixed Versions:
6.10.15.6.1
Product / Package Ecosystem Affected Versions Fixed Version
io.github.openfeign.querydsl:querydsl-jpa
Maven
≥ 6.0.0.M1
< 6.10.1
6.10.1
io.github.openfeign.querydsl:querydsl-apt
Maven
≥ 6.0.0.M1
< 6.10.1
6.10.1
io.github.openfeign.querydsl:querydsl-jpa
Maven
< 5.6.1
5.6.1
io.github.openfeign.querydsl:querydsl-apt
Maven
< 5.6.1
5.6.1
com.querydsl:querydsl-jpa
Maven
≤ 5.1.0
com.querydsl:querydsl-apt
Maven
≤ 5.1.0

References

Frequently Asked Questions

What is CVE-2024-49203?
CVE-2024-49203 is a security vulnerability in Querydsl jpa involving Querydsl vulnerable to HQL injection through orderBy under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Querydsl jpa versions are affected?
Affected versions include releases prior to 6.10.1, 5.6.1 across affected packages: io.github.openfeign.querydsl:querydsl-jpa, io.github.openfeign.querydsl:querydsl-apt, com.querydsl:querydsl-jpa, com.querydsl:querydsl-apt.
What version fixes CVE-2024-49203?
Upgrading to 6.10.1, 5.6.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is querydsl-jpa affected?
Yes, io.github.openfeign.querydsl:querydsl-jpa is affected in releases prior to 6.10.1, 5.6.1, Latest secure release. Upgrade your dependency to 6.10.1, 5.6.1, Latest secure release or later.
Is querydsl-apt affected?
Yes, io.github.openfeign.querydsl:querydsl-apt is affected in releases prior to 6.10.1, 5.6.1, Latest secure release. Upgrade your dependency to 6.10.1, 5.6.1, Latest secure release or later.
What is the CVSS score of CVE-2024-49203?
CVE-2024-49203 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L.
What CWE is associated with CVE-2024-49203?
CVE-2024-49203 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Maven dependencies for CVE-2024-49203?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=io.github.openfeign.querydsl'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-6q3q-6v5j-h6vg",
  "modified" : "2025-10-13T11:47:54Z",
  "published" : "2024-11-27T19:00:53Z",
  "aliases" : [ "CVE-2024-49203" ],
  "summary" : "Querydsl vulnerable to HQL injection through orderBy",
  "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<Test> getProducts(@RequestParam(\"orderBy\") String orderBy) {\n    JPAQuery<Test> query = new JPAQuery<Test>(entityManager).from(test);\n    PathBuilder<Test> pathBuilder = new PathBuilder<>(Test.class, \"test\");\n\n    OrderSpecifier order = new OrderSpecifier(Order.ASC, pathBuilder.get(orderBy));\n    JPAQuery<Test> 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<Test> query = new JPAQuery<Test>(entityManager).from(test);\n```\n\n2) Create OrderSpecifier object instance:\n```\nPathBuilder<Test> pathBuilder = new PathBuilder<>(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<Test> 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))='2'+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))='2' 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L"
  }, {
    "type" : "CVSS_V4",
    "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "io.github.openfeign.querydsl:querydsl-jpa"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0.M1"
      }, {
        "fixed" : "6.10.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "io.github.openfeign.querydsl:querydsl-apt"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0.M1"
      }, {
        "fixed" : "6.10.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "io.github.openfeign.querydsl:querydsl-jpa"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.6.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "io.github.openfeign.querydsl:querydsl-apt"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.6.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.querydsl:querydsl-jpa"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "5.1.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.querydsl:querydsl-apt"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "5.1.0"
      } ]
    } ]
  } ],
  "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"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-27T19:00:53Z",
    "nvd_published_at" : null
  }
}