CVE-2024-49203

SQL Injection
Affects
Querydsl
in
Querydsl
No items found.
Versions
<=5.1.0, <5.6.1, >=6.0.0.M1 <6.10.1

Patch Available.

Exclamation circle icon
Patch Available

This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.

Overview

Querydsl is an open-source Java framework for building type-safe, SQL-like queries through a fluent API instead of inline query strings. Its modules support several backends, including JPA (querydsl-jpa), SQL (querydsl-sql), MongoDB and Java collections, and its annotation processors (querydsl-apt) generate the query types from domain classes at build time. Querydsl is published to Maven Central under com.querydsl; the OpenFeign continuation of the project publishes its modules under io.github.openfeign.querydsl with its own version numbers.

A SQL injection vulnerability (CVE-2024-49203) has been identified in the JPA query support of Querydsl, which allows attackers to inject HQL/JPQL into the order by clause of a query when an application builds the sort path from an untrusted property name. The CVE record marks this issue as disputed, because Querydsl is not designed to defend against applications that pass untrusted input directly into query construction.

Per OWASP: A SQL injection attack consists of insertion or “injection” of a SQL query via the input data from the client to the application. A successful SQL injection exploit can read sensitive data from the database, modify database data (Insert/Update/Delete), execute administration operations on the database (such as shutdown the DBMS), recover the content of a given file present on the DBMS file system and in some cases issue commands to the operating system. SQL injection attacks are a type of injection attack, in which SQL commands are injected into data-plane input in order to affect the execution of predefined SQL commands.

This issue affects all versions of Querydsl.

Details

Module Info

Vulnerability Info

This High-severity vulnerability is found in the com.querydsl:querydsl-jpa package in all versions of Querydsl.

PathBuilder creates query paths from property names given as strings. Applications use it to build dynamic queries, typically by turning a sort parameter from an HTTP request into an OrderSpecifier. Every property name passes through a PathBuilderValidator, and the constructors that take no validator use PathBuilderValidator.DEFAULT, which accepts any name:

PathBuilderValidator DEFAULT = new PathBuilderValidator() {
    @Override
    public Class<?> validate(Class<?> parent, String property, Class<?> propertyType) {
        return propertyType;
    }
};

PathBuilder.get(String) validates the name and then turns it into a property path unchanged:

public PathBuilder<Object> get(String property) {
    // ...
    if (path == null) {
        Class<?> vtype = validate(property, Object.class);
        path = new PathBuilder<Object>(vtype, forProperty(property), validator);
        // ...
    }
    // ...
}

When the query is serialized, the JPQL templates render a property path as {0}.{1s}, which writes the property name into the query string as raw text. A name that contains whitespace and further HQL, for example name INTERSECT SELECT t FROM Test t WHERE ..., therefore becomes part of the order by clause the persistence provider executes. An attacker who controls the sort property can append subqueries, such as the time-based pg_sleep probe on PostgreSQL in the published payload, to infer data the query was never meant to return.

Mitigation

The upstream Querydsl project has published no release since Querydsl 5.1.0 in January 2024, so no com.querydsl release is available to address this issue. For more information, see here.

Users of the affected components should apply one of the following mitigations:

  • Migrate affected applications to a release of the OpenFeign continuation of Querydsl (Maven groupId io.github.openfeign.querydsl) that contains the fix, such as 5.6.1 or 6.10.1.
  • Leverage a commercial support partner like HeroDevs for post-EOL security support.

Credits

Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
High
ID
CVE-2024-49203
PROJECT Affected
Querydsl
Versions Affected
<=5.1.0, <5.6.1, >=6.0.0.M1 <6.10.1
NES Versions Affected
Published date
October 14, 2026
≈ Fix date
October 14, 2026
Category
SQL Injection
Vex Document
Download VEXHow do I use it?
Sign up for the latest vulnerability alerts fixed in
NES for Querydsl
Rss feed icon
Subscribe via RSS
or

By submitting the form I acknowledge receipt of our Privacy Policy.

Thanks for signing up for our Newsletter! We look forward to connecting with you.
Oops! Something went wrong while submitting the form.