CVE-2026-129349
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
Apache Shiro is an open-source Java security framework that performs authentication, authorization, cryptography, and session management for applications ranging from small mobile apps to large web and enterprise systems. It exposes a single Subject-centric API that applications use to log users in, check roles and permissions, and manage sessions independently of any servlet or EJB container, and integrates with common Java stacks through modules such as shiro-web, shiro-spring, and shiro-guice.
An authorization bypass vulnerability (CVE-2026-129349) has been identified in the DefaultLdapRealm and JndiLdapRealm LDAP realms of Apache Shiro, which allows attackers who know a valid username to log in as that user with any password once the user has authenticated successfully. The flaw applies only when authentication caching is enabled on the LDAP realm, which is not the default.
Per OWASP: Confirmation of the user's identity, authentication, and session management is critical to protect against authentication-related attacks.
This issue affects all versions of Apache Shiro before 3.0.1.
Details
Module Info
- Product: Apache Shiro
- Affected packages:
org.apache.shiro:shiro-core - Affected versions: <3.0.1
- GitHub repository: https://github.com/apache/shiro
- Published packages: https://central.sonatype.com/artifact/org.apache.shiro/shiro-core
- Package manager: Maven
- Fixed in:
- OSS Apache Shiro 3.0.1
- NES for Apache Shiro
Vulnerability Info
This Critical-severity vulnerability is found in the org.apache.shiro:shiro-core package in all versions of Apache Shiro before 3.0.1.
DefaultLdapRealm, and JndiLdapRealm, which extends it, authenticate a user by binding to the LDAP directory with the submitted principal and credentials. Because the directory checks the password during the bind, the realm's constructor installs an AllowAllCredentialsMatcher, which accepts any credentials:
public DefaultLdapRealm() {
//Credentials Matching is not necessary - the LDAP directory will do it automatically:
setCredentialsMatcher(new AllowAllCredentialsMatcher());
//Any Object principal and Object credentials may be passed to the LDAP provider, so accept any token:
setAuthenticationTokenClass(AuthenticationToken.class);
this.contextFactory = new JndiLdapContextFactory();
}
That assumption holds only while every login reaches the directory. When authenticationCachingEnabled is set to true, AuthenticatingRealm.getAuthenticationInfo first looks up a cached AuthenticationInfo for the submitted principal and, on a cache hit, skips doGetAuthenticationInfo and the LDAP bind entirely:
AuthenticationInfo info = getCachedAuthenticationInfo(token);
if (info == null) {
//otherwise not cached, perform the lookup:
info = doGetAuthenticationInfo(token);
...
}
if (info != null) {
assertCredentialsMatch(token, info);
}
The only remaining check is assertCredentialsMatch, which delegates to the realm's AllowAllCredentialsMatcher and always succeeds. As a result, after a user has logged in successfully once and their authentication info has been cached, any later login attempt for that username succeeds regardless of the password supplied, letting an attacker who knows or guesses a valid username authenticate as that user.
Mitigation
Apache Shiro 1.x is End-of-Life and no longer receives open-source updates to address this issue. The final 1.x release was 1.13.0; as of February 28, 2024, Shiro v1 was superseded by v2.
Until an upgrade is possible, keep authentication caching disabled on the LDAP realm (the default), or configure a credentials matcher, such as SimpleCredentialsMatcher, that verifies the submitted credentials against the cached authentication info. For example, in shiro.ini:
ldapRealm.authenticationCachingEnabled = false
Users of the affected components should apply one of the following mitigations:
- Upgrade Apache Shiro to a currently supported release line that contains the fix, first shipped upstream in Apache Shiro 3.0.1 (requires Java 17+).
- Leverage a commercial support partner like HeroDevs for post-EOL security support.
Credits
- Joshua Rogers (finder)