Issue 5341 - Invalid TLSCipherSuite causes hang
Summary: Invalid TLSCipherSuite causes hang
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.7
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-29 19:28 UTC by Quanah Gibson-Mount
Modified: 2014-08-01 21:06 UTC (History)
0 users

See Also:


Attachments
tls.patch.txt (542 bytes, text/plain)
2008-01-31 12:43 UTC, Kyle Moffett
Details
tls.patch (542 bytes, patch)
2008-01-31 05:29 UTC, Kyle Moffett
Details

Note You need to log in before you can comment on or make changes to this issue.
Description Quanah Gibson-Mount 2008-01-29 19:28:39 UTC
Full_Name: Quanah Gibson-Mount
Version: 2.4.7
OS: NA
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (24.23.156.219)


Setting TLSCipherSuite to "cipher1 cipher2" rather than "cipher1:cipher2" causes
slapd to hang on startup (at least when using GnuTLS).

It appears to be hanging indefinitely in ldap_pvt_tls_set_option()

--Quanah

Comment 1 vorlon@debian.org 2008-01-29 19:55:24 UTC
On Tue, Jan 29, 2008 at 11:31:43AM -0800, Quanah Gibson-Mount wrote:
> --On Tuesday, January 29, 2008 11:09 AM -0800 Steve Langasek 
> <vorlon@debian.org> wrote:

> > Anyway, the documented syntax for TLSCipherSuite is "$cipher1:$cipher2",
> > not "$cipher1 $cipher2"; but setting such values gives me a hang on
> > startup (which should be investigated).

> Filed upstream:

> <http://www.OpenLDAP.org/its/index.cgi?findid=5341>

Sorry, the description of this ITS is inverted.  It's *valid* ciphersuite
values (i.e., "cipher1:cipher2") that cause the hang; invalid
space-separated values are merely truncated after the first cipher in the
list, which doesn't cause a hang, it just prevents the cipher list from
being useful.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek@ubuntu.com                                     vorlon@debian.org

Comment 2 Kyle Moffett 2008-01-31 05:29:32 UTC
I ran into this problem a little while ago and scribbled up the
attached patch to fix it.  It's trivial enough and it works in my
testing here.

Cheers,
Kyle Moffett
Comment 3 Kyle Moffett 2008-01-31 12:43:33 UTC
On Jan 31, 2008 12:29 AM, Kyle Moffett <kyle@moffetthome.net> wrote:
> I ran into this problem a little while ago and scribbled up the
> attached patch to fix it.  It's trivial enough and it works in my
> testing here.

Sorry, the patch seems to have gone out MIME-encoded and mostly
useless to people who want to download it from the bug-tracker.  Let
me try again... (Sorry, still getting used to a new email client)

Cheers,
Kyle Moffett
Comment 4 Kyle Moffett 2008-01-31 12:46:07 UTC
On Jan 31, 2008 7:43 AM, Kyle Moffett <kyle@moffetthome.net> wrote:
> On Jan 31, 2008 12:29 AM, Kyle Moffett <kyle@moffetthome.net> wrote:
> > I ran into this problem a little while ago and scribbled up the
> > attached patch to fix it.  It's trivial enough and it works in my
> > testing here.
>
> Sorry, the patch seems to have gone out MIME-encoded and mostly
> useless to people who want to download it from the bug-tracker.  Let
> me try again... (Sorry, still getting used to a new email client)

Well damn, it still didn't work.  Hopefully gmail won't mangle a
pasted patch.  Again, my apologies for the mess.

Cheers,
Kyle Moffett

--- openldap-2.4.7/libraries/libldap/tls.c.orig	2007-12-21
19:24:08.000000000 -0500
+++ openldap-2.4.7/libraries/libldap/tls.c	2007-12-21 19:36:02.000000000 -0500
@@ -300,6 +300,7 @@
 		for (i=0; i<n_ciphers; i++) {
 			if ( !strncasecmp( ciphers[i].name, ptr, len )) {
 				num++;
+				ptr = end + 1;
 				break;
 			}
 		}
@@ -330,6 +331,7 @@
 			 * only appear once in each list.
 			 */
 			if ( !strncasecmp( ciphers[i].name, ptr, len )) {
+				ptr = end + 1;
 				for (j=0; j<nkx; j++)
 					if ( kx[j] == ciphers[i].kx )
 						break;

Comment 5 Hallvard Furuseth 2008-02-01 16:00:05 UTC
moved from Incoming to Software Bugs
Comment 6 vorlon@debian.org 2008-02-01 21:22:37 UTC
Hi Kyle,

On Fri, Feb 01, 2008 at 12:15:52AM -0500, Kyle Moffett wrote:
> On Jan 29, 2008 2:55 PM, Steve Langasek <vorlon@debian.org> wrote:
> > On Tue, Jan 29, 2008 at 11:31:43AM -0800, Quanah Gibson-Mount wrote:
> > > --On Tuesday, January 29, 2008 11:09 AM -0800 Steve Langasek <vorlon@debian.org> wrote:
> > > > Anyway, the documented syntax for TLSCipherSuite is "$cipher1:$cipher2",
> > > > not "$cipher1 $cipher2"; but setting such values gives me a hang on
> > > > startup (which should be investigated).

> > > Filed upstream:
> > > <http://www.OpenLDAP.org/its/index.cgi?findid=5341>

> > Sorry, the description of this ITS is inverted.  It's *valid* ciphersuite
> > values (i.e., "cipher1:cipher2") that cause the hang; invalid
> > space-separated values are merely truncated after the first cipher in the
> > list, which doesn't cause a hang, it just prevents the cipher list from
> > being useful.

> Steve, would you mind testing the patch I posted there?  It fixed the
> problem for me when I wrote it a month or two ago, hopefully it will
> fix the problem for you too.

Thanks, I can confirm this fixes the problem here.  I'm able to set multiple
ciphers in a TLSCipherSuite list, and able to connect appropriately with
ldapsearch and gnutls-cli after the change.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek@ubuntu.com                                     vorlon@debian.org

Comment 7 Howard Chu 2008-02-10 10:58:53 UTC
changed notes
changed state Open to Test
Comment 8 Quanah Gibson-Mount 2008-02-12 20:19:20 UTC
changed notes
changed state Test to Release
Comment 9 Quanah Gibson-Mount 2008-02-20 02:34:56 UTC
changed notes
changed state Release to Closed
Comment 10 Howard Chu 2009-02-17 05:23:15 UTC
moved from Software Bugs to Archive.Software Bugs
Comment 11 OpenLDAP project 2014-08-01 21:06:50 UTC
fixed in HEAD
fixed in 2.4.8