Skip to content

Possible HQL injection trough orderBy in QueryDSL #3693

@clementdenis

Description

@clementdenis

CVE-2024-49203 was reported on QueryDSL, involving HQL injection trough a user-specified orderBy clause: querydsl/querydsl#3757

I was wondering if Spring Data JPA was vulnerable through its QueryDSL support.

From what I see in the code, OrderSpecifiers are always built using toOrderSpecifier, which calls buildOrderPropertyPathFrom, that seem to validate that a property exists in the entity being queried.

/**
* Transforms a plain {@link Order} into a QueryDsl specific {@link OrderSpecifier}.
*
* @param order must not be {@literal null}.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private OrderSpecifier<?> toOrderSpecifier(Order order) {
return new OrderSpecifier(
order.isAscending() ? com.querydsl.core.types.Order.ASC : com.querydsl.core.types.Order.DESC,
buildOrderPropertyPathFrom(order), toQueryDslNullHandling(order.getNullHandling()));
}

A validation of my analysis from the maintainers of this project would be great :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions