LdapQueryBuilder Silently Discards Existing Filter When Built From Another Query in Spring LDAP

MEDIUM | NOVEMBER 19, 2026 | CVE-2026-59368

Description

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 Spring Products and Versions

Spring LDAP:

  • 4.1.0 - 4.1.2
  • 4.0.0 - 4.0.6
  • 3.3.0 - 3.3.9
  • 3.2.19 and earlier

Mitigation

Users of affected versions should upgrade to the corresponding fixed version.
Fix versionAvailability
4.1.3OSS
4.1.2.1Enterprise Support Only
4.0.7OSS
4.0.6.1Enterprise Support Only
3.3.10Enterprise Support Only
3.2.20Enterprise Support Only

In the fixed versions, a builder created with LdapQueryBuilder.fromQuery(LdapQuery) rejects a subsequent filter specification with an IllegalStateException instead of silently replacing the filter it was seeded with. fromQuery(LdapQuery) is also deprecated in favor of the new LdapQueryBuilder.withQuery(LdapQuery), which copies everything from the source query except its filter.

Applications that specify a new filter on a builder derived from another query should switch to withQuery(LdapQuery). Applications that want to keep the source query's filter should pass it explicitly to the new builder.

History

  • 2026-11-19: Initial vulnerability report published.

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

TrueSource Spring Enterprise offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all