ldapsdk
ldapsdk copied to clipboard
processSync in SimpleBindRequest allows empty password with set bindDN
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?
Thank you very much for pointing this out. It is a bug, and I've just committed a fix (https://github.com/pingidentity/ldapsdk/commit/8471904a02438c03965d21367890276bc25fa5a6) for it.
Wicked, thanks heaps for hotfixing
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.
Thanks Neil. Appreciate it, very good article