CVE-2026-59368

Authorization Bypass
Affects
Spring LDAP
in
Spring
No items found.
Versions
<=3.2.19, >=3.3.0 <=3.3.9, >=4.0.0 <=4.0.6, >=4.1.0 <=4.1.2

Patch Available.

Exclamation circle icon
Patch Available

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

Overview

Spring LDAP is a library to simplify LDAP programming in Java, built on the same principles as Spring JDBC. Its LdapQueryBuilder provides a fluent API for building LDAP search queries, including the search base, scope and filter.

An authorization bypass vulnerability (CVE-2026-59368) has been identified in Spring LDAP's LdapQueryBuilder, which allows attackers to read directory entries outside the scope an application intended. When a builder is created from an existing query, a later filter silently replaces the filter carried over from that query, so an LDAP search can run with broader criteria than intended and without any error.

Per OWASP: Access control enforces policy such that users cannot act outside of their intended permissions. Failures typically lead to unauthorized information disclosure, modification, or destruction of all data or performing a business function outside the user's limits.

This issue affects multiple versions of Spring LDAP.

Details

Module Info

Vulnerability Info

This Medium-severity vulnerability is found in the org.springframework.ldap:spring-ldap-core package in multiple versions of Spring LDAP.

LdapQueryBuilder.fromQuery(LdapQuery) creates a new builder that is seeded with the base, scope, limits, attributes and filter of an existing query. It copies the source filter straight into the builder's rootContainer, but it never sets the isFilterStarted flag that the builder uses to enforce that a filter is specified only once:

public static LdapQueryBuilder fromQuery(LdapQuery query) {
	LdapQueryBuilder builder = new LdapQueryBuilder();
	builder.rootContainer = new DefaultContainerCriteria(builder).append(query.filter());
	builder.attributes(query.attributes()).base(query.base());
	// count limit, search scope and time limit copied as well
	return builder;
}

private void initRootContainer() {
	assertFilterNotStarted();
	this.rootContainer = new DefaultContainerCriteria(this);
	this.isFilterStarted = true;
}

private void assertFilterNotStarted() {
	Assert.state(!this.isFilterStarted, "Invalid operation - filter condition specification already started");
}

Every filter entry point on the builder (where(String), filter(String), filter(Filter) and filter(String, Object...)) calls initRootContainer(). Because the flag is still false on a builder returned by fromQuery, the check passes and initRootContainer() replaces rootContainer with a fresh, empty container. The filter inherited from the source query is discarded instead of the call being rejected with an IllegalStateException.

An application that derives a builder from a query carrying a restricting filter (for example one that limits a search to a single tenant or organizational unit) and then adds a further filter will run a search that only applies the second filter. When the dropped filter was acting as an authorization boundary, an authenticated user can retrieve directory entries outside the scope the application intended. The same fromQuery pattern is used internally by LdapClient's search().query(Consumer<LdapQueryBuilder>) and by LdapTemplate.findForStream.

Steps to Reproduce

  1. Add org.springframework.ldap:spring-ldap-core at an affected version (for example 3.3.8) to a Java project. No LDAP server is needed.
  2. Run the following program, which derives a builder from a tenant-scoped query and then adds a second filter:
    import org.springframework.ldap.query.LdapQuery;
    import org.springframework.ldap.query.LdapQueryBuilder;
    
    public class Repro {
    	public static void main(String[] args) {
    		LdapQuery tenantScoped = LdapQueryBuilder.query()
    			.base("ou=people")
    			.where("ou").is("tenant-a");
    		LdapQueryBuilder derived = LdapQueryBuilder.fromQuery(tenantScoped);
    		LdapQuery search = derived.filter("(objectClass=person)");
    		System.out.println(search.filter().encode());
    	}
    }
  3. On an affected version the program prints (objectClass=person): the (ou=tenant-a) restriction has been silently dropped. On a fixed version the filter call throws an IllegalStateException instead.

Mitigation

Only recent versions of Spring LDAP receive community support. Older lines are End-of-Life and will not receive public updates to address this issue.

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

  • Upgrade to a currently supported version of Spring LDAP.
  • Leverage a commercial support partner like HeroDevs for post-EOL security support.
Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
Medium
ID
CVE-2026-59368
PROJECT Affected
Spring LDAP
Versions Affected
<=3.2.19, >=3.3.0 <=3.3.9, >=4.0.0 <=4.0.6, >=4.1.0 <=4.1.2
NES Versions Affected
Published date
November 20, 2026
≈ Fix date
Category
Authorization Bypass
Vex Document
Download VEXHow do I use it?
Sign up for the latest vulnerability alerts fixed in
NES for Spring
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.