[Bug 1103353] [NEW] Invalid GnuTLS cipher suite strings causes libldap to crash

Jouko Orava joorava at iki.fi
Wed Jan 23 07:32:10 UTC 2013

Public bug reported:

If the cipher suite string is unacceptable to GnuTLS, libldap_r-2.4
crashes due to a double free. GnuTLS is extremely picky about the cipher
suite strings it accepts; as a first measure, try LDAP cipher suite
string "SECURE256" or "NORMAL". If that stops the crash, then you have
encountered this bug.

Typically, the crash report begins with something like

*** glibc detected *** APPLICATION: double free or corruption (!prev)

The actual double free happens in
openldap/libraries/libldap/tls2.c:ldap_int_tls_init_ctx(), in the
ldap_pvt_tls_ctx_free(lo->ldo_tls_ctx); call in the error_exit: path.

The root cause of the double free is lack of GnuTLS return value checks
when calling gnutls_priority*() functions. The code simply assumes they
succeed, and when GnuTLS fails to provide a valid context due to those
failures, ldap_int_tls_init_ctx() tries to free the never-fully-
initialized context.

A simple fix is to create GnuTLS security contexts using the configured
cipher suite string, instead of "NORMAL" as
openldap/libraries/libldap/tls_g.c now does. If the cipher suite string
is invalid, then do not create the context at all. This is caught
earlier in ldap_int_tls_init_ctx(), and avoids the crash.

** Affects: openldap (Ubuntu)
     Importance: Undecided
         Status: New

** Patch added: "Suggested patch to fix libldap crash with invalid GnuTLS cipher suite strings"

You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to openldap in Ubuntu.

  Invalid GnuTLS cipher suite strings causes libldap to crash

To manage notifications about this bug go to:

More information about the Ubuntu-server-bugs mailing list