
Differential PoC lab for CVE-2026-129349: Apache Shiro DefaultLdapRealm with authentication caching accepts any password after one valid login. Includes check, exploit, and probe modes.
DefaultLdapRealm accepts any password after one successful login when authentication caching is enabled| CVE | CVE-2026-129349 |
| Component | Apache Shiro DefaultLdapRealm (also JndiLdapRealm), core/src/main/java/org/apache/shiro/realm/ldap/DefaultLdapRealm.java |
| Affected | all Apache Shiro versions through 3.0.0, only with DefaultLdapRealm/JndiLdapRealm and authenticationCachingEnabled = true (not the default) |
| Fixed in | 3.0.1 — DefaultLdapRealm's constructor no longer installs AllowAllCredentialsMatcher by default |
| CWE | CWE-287 (Improper Authentication), CWE-613 (Insufficient Session Expiration analog: stale cached authentication) |
| Impact | Authentication bypass: an attacker who knows (or guesses) any valid username can authenticate as that user with an arbitrary password — including the empty string — after that user has logged in once |
| Vector | Any authentication path backed by the affected realm configuration; network position is whatever reaches the application |
| Trigger | one valid login primes the authentication cache; every subsequent UsernamePasswordToken for the same user is accepted without an LDAP bind because the cached AuthenticationInfo is matched by AllowAllCredentialsMatcher |
| Credit | Apache Shiro security announcement (ASF thread 1whn52ht402lhc782c3s843c9hho8b4y) |
Apache Shiro's DefaultLdapRealm historically installed
AllowAllCredentialsMatcher in its constructor — "credentials matching is
not necessary, the LDAP directory will do it automatically". That
reasoning holds only while every authentication performs an LDAP bind.
When authenticationCachingEnabled = true, a cached authentication skips
the bind entirely and the matcher runs alone — and a matcher that accepts
anything turns the cache into an open door. The upstream fix
(shiro-root-3.0.0...shiro-root-3.0.1) is exactly two deleted lines:
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 laboratory runs the real DefaultLdapRealm (vulnerable 3.0.0 vs
fixed 3.0.1, the only difference between the two builds) against a real
in-memory LDAP directory (UnboundID LDAP SDK) with a real cache manager
— precisely the advisory's configuration — and proves the bypass
end-to-end.
Shiro's AuthenticatingRealm.getAuthenticationInfo(token) resolves
authentication through a cache first:
AuthenticationInfo info = getCachedAuthenticationInfo(token); // cache hit → no LDAP bind
if (info == null) {
info = doGetAuthenticationInfo(token); // the LDAP bind
cacheAuthenticationInfo(token, info); // prime the cache
}
assertCredentialsMatch(token, info); // ← the only remaining check
With DefaultLdapRealm through 3.0.0, assertCredentialsMatch consults
the constructor-installed AllowAllCredentialsMatcher, whose
doCredentialsMatch returns true unconditionally. Consequences, all
reproduced in this lab:
AuthenticationInfo in the cache;The precondition is explicit: authenticationCachingEnabled is not the
default, exactly as the advisory states ("only when using
DefaultLdapRealm (or JndiLdapRealm) with authenticationCachingEnabled set
to true, which is not the default"). Deployments that enable it — a
common performance choice — carry the bypass.
| service | image | role |
|---|---|---|
shiro-vuln | cve-2026-129349:vuln | shiro-core 3.0.0 — the realm installs AllowAllCredentialsMatcher |
shiro-fixed | cve-2026-129349:fixed | shiro-core 3.0.1 — the constructor no longer installs it (SimpleCredentialsMatcher from the base class applies) |
poc | cve-2026-129349-poc:local | stdlib-only Python driver |
Each service is a single Java process that starts (1) an UnboundID
in-memory LDAP directory (dc=lab, ou=people, uid=alice with a seeded
password, bind-DN authentication) and (2) an HTTP endpoint
(/login?username=&password=) that calls the real
realm.getAuthenticationInfo(new UsernamePasswordToken(...)). The realm
is configured exactly per the advisory: DefaultLdapRealm +
JndiLdapContextFactory (ldap://127.0.0.1:1389) +
MemoryConstrainedCacheManager + authenticationCachingEnabled(true).
The two images differ only in the shiro.version Maven property.
./run-lab.sh build # compiles the service against 3.0.0 and 3.0.1
./run-lab.sh up # cve129349lab network, shiro-vuln, shiro-fixed
./run-lab.sh sweep # check / exploit / probe / mitigation on both sides
./run-lab.sh down
Single mode against one side:
podman run --rm --network cve129349lab cve-2026-129349-poc:local \
exploit --host=shiro-vuln
poc/poc.py (stdlib only):
wrong-password, x, the empty string,
and 0; reports each accepted junk credential.| run | shiro-vuln (3.0.0) | shiro-fixed (3.0.1) |
|---|---|---|
check wrong pw before valid login | false (LDAP bind rejects) | false |
check valid login | true | true |
check wrong pw after valid login | true — bypass | false (IncorrectCredentialsException) |
exploit junk passwords | wrong-password, x, ``, 0 all accepted | none accepted |
probe empty password, warm cache | true | false |
probe unknown user | false (no cache entry → bind fails) | false |
probe wrong pw after /reset | false (cold cache again) | false |
| reported matcher | AllowAllCredentialsMatcher | SimpleCredentialsMatcher |
Captured runs: evidence/check-*-run.txt, evidence/exploit-*-run.txt,
evidence/probe-*-run.txt, evidence/mitigation-*-run.txt,
evidence/versions.txt, evidence/0day-sweep.txt.
cve129349lab network.