Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

processSync in SimpleBindRequest allows empty password with set bindDN #40

Open
sshkel opened this issue Mar 9, 2018 · 4 comments
Open

Comments

@sshkel
Copy link

sshkel commented Mar 9, 2018

Hey folks,
Is there a reason why check for empty password when bindDN is set comes after logic for doing processing in synchronous mode?
https://github.com/pingidentity/ldapsdk/blob/master/src/com/unboundid/ldap/sdk/SimpleBindRequest.java#L513

protected BindResult process(final LDAPConnection connection, final int depth)
            throws LDAPException
  {
    if (connection.synchronousMode())
    {
      @SuppressWarnings("deprecation")
      final boolean autoReconnect =
           connection.getConnectionOptions().autoReconnect();
      return processSync(connection, autoReconnect);
    }

    // See if a bind DN was provided without a password.  If that is the case
    // and this should not be allowed, then throw an exception.
    if (password != null)
    {
      if ((bindDN.getValue().length > 0) && (password.getValue().length == 0) &&
           connection.getConnectionOptions().bindWithDNRequiresPassword())
      {
        final LDAPException le = new LDAPException(ResultCode.PARAM_ERROR,
             ERR_SIMPLE_BIND_DN_WITHOUT_PASSWORD.get());
        debugCodingError(le);
        throw le;
      }
    }
// Async stuff

At the moment that check only applies to async mode and leaves synchronous mode open to the old and nasty behaviour. Could that entire block be moved up to cover both sync and async methods?

@dirmgr
Copy link
Collaborator

dirmgr commented Mar 9, 2018

Thank you very much for pointing this out. It is a bug, and I've just committed a fix (8471904) for it.

@sshkel
Copy link
Author

sshkel commented Mar 10, 2018

Wicked, thanks heaps for hotfixing

@dirmgr
Copy link
Collaborator

dirmgr commented Mar 19, 2018

I have just published the 4.0.5 release of the LDAP SDK, which contains the fix for this issue. I also wrote a blog post at https://nawilson.com/2018/03/19/cve-2018-1000134-and-the-unboundid-ldap-sdk-for-java/ that describes it in detail.

@sshkel
Copy link
Author

sshkel commented Mar 20, 2018

Thanks Neil. Appreciate it, very good article

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants