Allows to login with any password in some scenarios with LDAP

Description

One user has reported, that when setup with Apple Open Directory (LDAP) Openfire allows logging in with any password. Another user reports same issue with OpenLDAP with certain conditions:

The setup:

Openfire 4.2.3 (The corresponding code was not changed in the master)
OpenLDAP (Anonymous Login enabled)

Steps to Reproduce:

  1. set up OpenLDAP server (with users and user groups and a login for the Openfire server). Allow Anonymous Login.

  2. activate StartTLS with an SSL certificate that does not match the hostname.

  3. set up Openfire with LDAP connection to OpenLDAP (activate StartTLS).

What happens:

  1. certificate validation fails at LdapManager.java#L716 (javax.net.ssl.SSLPeerUnverifiedException: hostname of the server ‘XXXXXXXXXXXX’ does not match the hostname in the server’s certificate.)

  2. the username and password are not set at LdapManager.java#L727

  3. the exception is intercepted and logged at LdapManager.java#L733

  4. LdapManager.java#L737 should actually throw an exception, but it doesn’t, since the context is valid for anonymous login. This will cause the user to be logged in.

Possible solution:

  1. do not catch LdapManager.java#L732

  2. do not catch LdapManager.java#L823

  3. do not catch LdapManager.java#L623

For our concrete problem it helped to disable the anonymous login in the OpenLDAP server (incorrectly configured). In addition, the certificate for the LDAP server had to contain the common name and the alternative name of the host name of the server.
However, it should not be possible for such a misconfiguration to cause the fallback to make it possible to log in with any password.
With ApacheDirectoryServer we could not reproduce the problem. We think it is because OpenLDAP does not require you to set “env.put(Context.SECURITY_AUTHENTICATION, “none”);” for the anonymous login, ApacheDirectoryServer does.

Logs:

Environment

OpenLDAP, Apple Open Directory

Activity

Show:
Greg Thomas
April 26, 2019, 10:30 AM

Fixed in https://github.com/igniterealtime/Openfire/commit/7493aacb6c888ee13b134387a3035e2cf87b61d0 

 

(finger trouble meant this ticket wasn't referenced in the commit comment)

Fixed

Assignee

Greg Thomas

Reporter

wroot