The vulnerability, CVE-2026-49268, is an LDAP injection flaw in Apache Shiro's DefaultLdapRealm and its subclass ActiveDirectoryRealm. The root cause is the direct concatenation of unescaped user-provided input (username/principal) into the Distinguished Name (DN) used for LDAP authentication. This allows an attacker to inject special characters as defined in RFC 2253, altering the structure of the LDAP query and potentially bypassing authentication or impersonating other users.
The analysis of the patch between the vulnerable version (2.2.0) and the fixed version (2.2.1) reveals the exact fix. The commit 9063406e70acbb90a6d1c1f3c69e01b8893bd1dd introduces input sanitization in two key methods. In DefaultLdapRealm.java, the getUserDn method was modified to escape the principal using javax.naming.ldap.Rdn.escapeValue(). Similarly, in ActiveDirectoryRealm.java, the getUsernameWithSuffix method was changed to escape the username before any string manipulation. These functions are the points where the malicious input is processed and used to construct the LDAP DN, making them the primary indicators of exploitation in a runtime profile.