Skip Menu |
 

From: Russ Allbery <rra@debian.org>
To: krb5-bugs@mit.edu
Subject: kadmind crash on Debian AMD64
Date: Thu, 05 Jul 2007 15:56:57 -0700
Download (untitled) / with headers
text/plain 3.9KiB
See also http://bugs.debian.org/428732

Date: Wed, 13 Jun 2007 15:07:03 -0400
From: Andrew Reid <Andrew.Reid@nist.gov>
To: submit@bugs.debian.org
Subject: Bug#428732: kadmin crashes during password changes

Package: krb5-admin-server
Version: 1.4.4-7etch1

Hi all --

I have a distributed system with a few servers and several
clients, using Kerboros for user authentication and LDAP for
accounts. All servers are Debian "etch", and the clients are
a mix of "etch" and "sarge".

The problem described here may not occur with all clients,
but does occur with at least one client of each of the two
types.

The symptoms are:

A user on a client invokes "kpasswd" or "kpasswd <username>" to
change their password. Kpasswd prompts for their existing
password, accepts the input, then prompts twice for the new password.
It then appears to hang.

Coincident with the hang, kadmind on the server segfaults,
logging the following in /var/log/messages: ("shadrach" is
the server hostname).

Show quoted text
> Jun 13 14:16:11 shadrach kernel: kadmind[31779]: segfault at ffffffffd653bbc0 rip 00002b5fd63745d0 rsp 00007fffd52f7f58 error 4

The kpasswd process reports a time-out:
Show quoted text
> kpasswd: Connection timed out changing password
.. and the user password is not changed.


The location of the segfault appears to vary, an immediate second
attempt got a slightly different log message:

Show quoted text
> Jun 13 14:18:38 shadrach kernel: kadmind[1358]: segfault at 0000000020035bc0 rip 00002ac21fe6e5d0 rsp 00007fff8b7fe468 error 4

Issuing /etc/init.d/krb5-admin-server restarts the daemon with
no apparent additional errors.


Behavior is not 100% consistent, I am sure I have seen
instances where a convenience script named "passwd", which just
wraps a call to "exec kpasswd $(whoami)", did not crash the kadmind,
but I am unable to reproduce this desirable behavior just now,
re-running the identical script is crashing the server's kadmind.

I have never seen a direct call to kpasswd fail to crash the
kadmind, but may have always done those second in the testing
sequence.

The bad behavior is correlated with a high frequency of
password changes for a particular principal (one every 60
300 seconds or so). The initial pathology involved a user
whose (new) account was misconfigured, and whose password
was reset within a few minutes of the initial Kerberos principal
creation to facilitate account configuration testing (directly
via kadmin), and then re-reset by the user once the account
configuration was corrected, using kpasswd. This kpasswd operation
crashed the kadmin daemon.

Subsequent experiments on other accounts may have worked
initially, and then begun to fail, consistent with the difficulty
being triggered by multiple password changes within a
few-minute window. Since I have just done this testing, I cannot
immediately test this.

Kernels are stock Debian. Server is 2.6.18-4-amd64,
representative client is 2.6.18-4-k7, libc is 2.3.6.ds1-13
on client and server.

-- A.
--
Dr. Andrew C. E. Reid, Guest Researcher
Center for Theoretical and Computational Materials Science
National Institute of Standards and Technology, Mail Stop 8910
Gaithersburg MD 20899 USA
andrew.reid@nist.gov


Date: Thu, 14 Jun 2007 10:54:18 -0400
From: Andrew Reid <Andrew.Reid@nist.gov>
To: 428732@bugs.debian.org
Subject: Bug#428732: Kadmin crash, additional info

I've had a chance to experiment a little more, and it's
clear that what is crashing the kadmind is a second or
subsequent kpasswd attempt for a given principal a short
time after a (successful) first change.

It's as though there's some time window after a kpasswd
invocation on a principal during which additional kpasswd
invocations will crash the server's admin daemon. It
seems to be independent of the particular principal or
client machine.

-- A.
--
Dr. Andrew C. E. Reid, Guest Researcher
Center for Theoretical and Computational Materials Science
National Institute of Standards and Technology, Mail Stop 8910
Gaithersburg MD 20899 USA
andrew.reid@nist.gov
From: Ken Raeburn <raeburn@MIT.EDU>
Subject: Re: Bug#428732: [krbdev.mit.edu #5593] kadmin crashes during password changes
Date: Fri, 6 Jul 2007 19:53:46 -0400
To: Russ Allbery <rra@debian.org>, Andrew.Reid@nist.gov
CC: krb5-bugs@MIT.EDU, 428732@bugs.debian.org
RT-Send-Cc:
Download (untitled) / with headers
text/plain 1.7KiB
I just tried on our x86_64 etch system (1.4.4-7etch1 kadmind
installed), and with a few simple tests, couldn't reproduce the
problem. I set up a realm FOOBAR.X with a user principal ken with
admin privileges, ran "kadmin -p ken -q 'cpw ken'" and then "kpasswd"
a few times, sometimes re-using the same password, sometimes trying
different passwords (all short).

However, after a reminder from Tom Yu that we had some int/pointer
problems fixed in that code a while back, I built -7etch1 (since
-7etch2 doesn't seem to be on the servers I'm using?), worked out a
rough function call stack from the stack trace in the Debian bug
report, and found this once I knew where to look:

../../../src/kadmin/server/misc.c:148: warning: assignment makes
pointer from integer without a cast

Line 148: time_string = ctime(&until);

A disassembly confirms that the compiler is widening the assumed int
return value from ctime, from 32 to 64 bits, when in fact it's a 64-
bit pointer. I tried calling ctime under gdb, and it showed me a 32-
bit value with the high bit set. Whether that's the true value, or
gdb was confused about the return type and truncated to 32 bits, I
don't know. But either way, that high bit in the low 32 is going to
get copied into the upper 32 bits, probably not what we want.

This code path requires that the principal in question have a policy
dictating a minimum time before the password can be changed, and a
password change made before that time has elapsed. (I should've
thought of that given the description of changing passwords
specifically in a short time.) Andrew, does that describe your
situation? If so, changing src/kadmin/server/misc.c to include
<time.h> could fix the problem.

Ken
Date: Mon, 9 Jul 2007 08:55:05 -0400
From: Andrew Reid <Andrew.Reid@nist.gov>
To: Ken Raeburn <raeburn@MIT.EDU>
Subject: Re: Bug#428732: [krbdev.mit.edu #5593] kadmin crashes during password changes
CC: 428732@bugs.debian.org, Russ Allbery <rra@debian.org>, krb5-bugs@MIT.EDU
RT-Send-Cc:
On Fri, Jul 06, 2007 at 07:53:46PM -0400, Ken Raeburn wrote:
Show quoted text
> This code path requires that the principal in question have a policy
> dictating a minimum time before the password can be changed, and a
> password change made before that time has elapsed. (I should've
> thought of that given the description of changing passwords
> specifically in a short time.) Andrew, does that describe your
> situation? If so, changing src/kadmin/server/misc.c to include
> <time.h> could fix the problem.

Yes, this describes our situation precisely -- I also had
forgotten about the minimum password lifetime in the policy,
even though I myself remarked on the time-dependent character.

-- A.
--
Dr. Andrew C. E. Reid, Guest Researcher
Center for Theoretical and Computational Materials Science
National Institute of Standards and Technology, Mail Stop 8910
Gaithersburg MD 20899 USA
andrew.reid@nist.gov
From: Russ Allbery <rra@debian.org>
To: Andrew Reid <Andrew.Reid@nist.gov>
Subject: Re: Bug#428732: [krbdev.mit.edu #5593] kadmin crashes during password changes
Date: Mon, 09 Jul 2007 12:01:16 -0700
CC: Ken Raeburn <raeburn@mit.edu>, krb5-bugs@mit.edu, 428732@bugs.debian.org
RT-Send-Cc:
Andrew Reid <Andrew.Reid@nist.gov> writes:

Show quoted text
> Will there be an "etch" security patch for this for amd64? The daemon
> runs as root, so there's a potential exploit opportunity, and even if
> there weren't, it's a possible DOS attack.

It's a DoS attack really more than an exploit (sign extension bugs on
internal calls that don't use user-supplied data, which I believe is a
correct characterization of this problem, are unlikely to be exploitable),
and I don't think the Debian security folks will consider it worth an
advisory. I will, however, check with the stable release managers about
uploading a fixed package for the next stable point release.

Ken, I assume from the previous bug discussion that this was already fixed
in 1.6? It looks like that file now includes k5-int.h and k5-int.h now
includes time.h.

--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>
Date: Mon, 9 Jul 2007 14:52:35 -0400
From: Andrew Reid <Andrew.Reid@nist.gov>
To: Ken Raeburn <raeburn@MIT.EDU>
Subject: Re: Bug#428732: [krbdev.mit.edu #5593] kadmin crashes during password changes
CC: 428732@bugs.debian.org, Russ Allbery <rra@debian.org>, krb5-bugs@MIT.EDU
RT-Send-Cc:
Download (untitled) / with headers
text/plain 1.3KiB
On Fri, Jul 06, 2007 at 07:53:46PM -0400, Ken Raeburn wrote:
Show quoted text
> This code path requires that the principal in question have a policy
> dictating a minimum time before the password can be changed, and a
> password change made before that time has elapsed. (I should've
> thought of that given the description of changing passwords
> specifically in a short time.) Andrew, does that describe your
> situation? If so, changing src/kadmin/server/misc.c to include
> <time.h> could fix the problem.

That's some nice shooting, Ken -- making the suggested change
(adding a <time.h> include) is a fix.

I built a new kadmind binary from the source tree for the -7etch2
version of the Debian package (with helpful instructions, thanks Russ),
and ran it on our server. Now rapid-fire password changes get
a correct response from the server that the minimum password lifetime
has not expired, and the daemon continues to run.

Will there be an "etch" security patch for this for amd64? The daemon
runs as root, so there's a potential exploit opportunity, and even if there
weren't, it's a possible DOS attack.

-- A.
--
Dr. Andrew C. E. Reid, Guest Researcher
Center for Theoretical and Computational Materials Science
National Institute of Standards and Technology, Mail Stop 8910
Gaithersburg MD 20899 USA
andrew.reid@nist.gov
From: Ken Raeburn <raeburn@MIT.EDU>
Subject: Re: Bug#428732: [krbdev.mit.edu #5593] kadmin crashes during password changes
Date: Mon, 9 Jul 2007 14:07:00 -0700
To: Russ Allbery <rra@debian.org>
CC: Andrew Reid <andrew.reid@nist.gov>, krb5-bugs@MIT.EDU, 428732@bugs.debian.org
RT-Send-Cc:
On Jul 9, 2007, at 12:01, Russ Allbery wrote:
Show quoted text
> Ken, I assume from the previous bug discussion that this was
> already fixed
> in 1.6? It looks like that file now includes k5-int.h and k5-int.h
> now
> includes time.h.

Yes, that's correct, this shouldn't be a problem in the 1.6 branch.

Ken
Already fixed in 1.6, and bugs.debian.org indicates they've got the appropriate patch
incorporated.