CVE-2026-59368: LdapQueryBuilder Silently Discards Existing Filter When Built From Another Query in Spring LDAP
LdapQueryBuilder can lose a search filter that an application expects to be enforced, causing an LDAP search to run with broader criteria than intended.
When a builder is created from an existing query, the filter carried over from that query is not treated as established. A later call that specifies a filter then replaces the carried-over filter instead of being rejected, so the original criteria are dropped without any error. The fix turns this into an IllegalStateException .
Preconditions :
The application derives one LdapQueryBuilder from another query and then specifies a further filter on the derived builder The dropped filter is what restricts the search, for example to a single tenant, organizational unit, or set of entries When the dropped filter was acting as an authorization boundary, an authenticated user can read directory entries outside the scope the application intended.
Affected Software
Event History
Frequently Asked Questions
Which applications are exposed to unintended LDAP result disclosure?
Applications are exposed if they create an LdapQueryBuilder from an existing query and then set another filter on the derived builder. The impact is significant when the original filter limits results by tenant, organizational unit, entry set, or another authorization boundary.
What access does an attacker need to exploit this behavior?
An attacker needs authenticated access as a user able to invoke the affected LDAP search path. No user interaction is required, but the application must execute a query construction flow that drops the intended restrictive filter.
How can teams identify potentially affected code?
Review uses of LdapQueryBuilder that are initialized from an existing query, then check whether the derived builder subsequently receives a filter specification. Determine whether the inherited filter was intended to restrict visibility or enforce authorization scope.
What changes after the fix is applied?
Rather than silently replacing the filter inherited from the original query, the affected query-building sequence raises an IllegalStateException. Applications using this pattern may therefore need code changes to avoid specifying a further filter on the derived builder.