[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MITKRB5-SA-2011-005 FTP daemon fails to set effective group ID [CVE-2011-1526]

Hash: SHA1


MIT krb5 Security Advisory 2011-005
Original release: 2011-07-05

Topic: FTP daemon fails to set effective group ID


CVSSv2 Vector: AV:N/AC:L/Au:S/C:P/I:P/A:P/E:H/RL:O/RC:C

CVSSv2 Base Score:      6.5

Access Vector:          Network
Access Complexity:      Low
Authentication:         Single
Confidentiality Impact: Partial
Integrity Impact:       Partial
Availability Impact:    Partial

CVSSv2 Temporal Score:  5.7

Exploitability:         High
Remediation Level:      Official Fix
Report Confidence:      Confirmed


A remote client of the GSS-API FTP daemon in the krb5-appl
distribution can access files using the effective group ID that the
FTP daemon process had when it started.


An authenticated remote user can gain unauthorized read or write
access to files whose group owner is the initial effective group ID of
the FTP daemon process.  This is often GID 0 ("root" or "wheel").

The severity of the consequences depends heavily on the details of an
individual system's configuration.  Prudent system administration
practices concerning file permissions will largely prevent any
malicious damage from this vulnerability.

No exploit code is necessary; any user able to log into the FTP server
will gain unauthorized access.


* The GSS-API FTP daemon in all krb5-appl releases, up to and
  including krb5-appl-1.0.1, is vulnerable.


* An upcoming release of krb5-appl will contain a fix.

* Apply the following patch.  You will need to run ./autogen.sh to
  rebuild the configure script, and you should rebuild from a clean
  source tree to ensure that the correct macro definitions are

diff --git a/configure.ac b/configure.ac
index 86e23f1..2fe68ad 100644
- --- a/configure.ac
+++ b/configure.ac
@@ -107,6 +107,7 @@ AC_CHECK_FUNCS(_getpty cgetent getcwd getenv gettosbyname getusershell getutmp)
 AC_CHECK_FUNCS(getutmpx grantpt inet_aton initgroups isatty killpg killpg)
 AC_CHECK_FUNCS(line_push ptsname revoke rmufile rresvport_af)
 AC_CHECK_FUNCS(seteuid setlogin setpgid setpriority setresuid setreuid)
+AC_CHECK_FUNCS(setegid setregid setresgid)
 AC_CHECK_FUNCS(setutent setutsent setutxent strsave tcgetpgrp tcsetpgrp)
 AC_CHECK_FUNCS(ttyname unsetenv updwtmp updwtmpx utimes utmpname utmpxname)
 AC_CHECK_FUNCS(vhangup vsnprintf waitpid)
diff --git a/gssftp/ftpd/ftpd.c b/gssftp/ftpd/ftpd.c
index fe62a9c..a150819 100644
- --- a/gssftp/ftpd/ftpd.c
+++ b/gssftp/ftpd/ftpd.c
@@ -994,9 +994,14 @@ login(passwd, logincode)
- -	(void) krb5_setegid((gid_t)pw->pw_gid);
- -	(void) initgroups(pw->pw_name, pw->pw_gid);
- -
+	if (krb5_setegid((gid_t)pw->pw_gid) < 0) {
+		reply(550, "Can't set egid.");
+		goto bad;
+	}
+	if (geteuid() == 0 && initgroups(pw->pw_name, pw->pw_gid) < 0) {
+		reply(550, "Can't initgroups");
+		goto bad;
+	}
 	/* open wtmp before chroot */
 	(void) snprintf(ttyline, sizeof(ttyline), "ftp%ld", (long) getpid());
 	pty_logwtmp(ttyline, pw->pw_name, rhost_sane);
diff --git a/k5-util.h b/k5-util.h
index 7bb8cfb..64cd53d 100644
- --- a/k5-util.h
+++ b/k5-util.h
@@ -69,8 +69,7 @@
 #elif defined(HAVE_SETREUID)
 #  define krb5_seteuid(EUID)	setreuid(geteuid(), (uid_t)(EUID))
- -   /* You need to add a case to deal with this operating system.*/
- -#  define krb5_seteuid(EUID)	(errno = EPERM, -1)
+#  error "You need to add a case to deal with this operating system."
@@ -80,8 +79,7 @@
 #elif defined(HAVE_SETREGID)
 #  define krb5_setegid(EGID)	(setregid(getegid(), (gid_t)(EGID)))
- -   /* You need to add a case to deal with this operating system.*/
- -#  define krb5_setegid(EGID)	(errno = EPERM, -1)
+#  error "You need to add a case to deal with this operating system."

  This patch is also available at


  A PGP-signed patch is available at



This announcement is posted at:


This announcement and related security advisories may be found on the
MIT Kerberos security advisory page at:


The main MIT Kerberos web page is at:




CVE: CVE-2011-1526


We thank Tim Zingelman for discovering this vulnerability and
providing a preliminary patch.


The MIT Kerberos Team security contact address is
<krbcore-security@xxxxxxx>.  When sending sensitive information,
please PGP-encrypt it using the following key:

pub   2048R/56CD8F76 2010-12-29 [expires: 2012-02-01]
uid     MIT Kerberos Team Security Contact <krbcore-security@xxxxxxx>


The vulnerability results from two interacting flaws: omission of
required autoconf tests, causing krb5_setegid() to always fail, and
the FTP daemon's failure to check for the successful execution of

The FTP daemon calls the portability macro krb5_setegid() from
k5-util.h, which is intended to wrap or emulate the POSIX interface
setegid().  The definition of the macro depends on macros that the
autoconf configure script defines (based on tests of the target
platform environment) when it runs.  When the krb5 application
programs moved out of the main krb5 source tree, the new configure
script inadvertently omitted the necessary autoconf tests for
setegid() and related legacy interfaces.  If no setegid() equivalent
appears to exist on the system, k5-util.h defines krb5_setegid() to
always fail with errno EPERM.  Since the relevant autoconf tests never
execute, k5-util.h will always define krb5_setegid() to fail.

The FTP daemon does not check the return value of krb5_setegid(), so
it silently fails to set its effective GID, allowing users to gain
unauthorized access using the effective GID that the daemon process
started with.


2011-07-05      original release

Copyright (C) 2011 Massachusetts Institute of Technology
Version: GnuPG v1.4.8 (SunOS)