lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date: Tue, 05 Jul 2011 14:06:39 -0400
From: Tom Yu <tlyu@....EDU>
To: bugtraq@...urityfocus.com
Subject: MITKRB5-SA-2011-005 FTP daemon fails to set effective group ID [CVE-2011-1526]


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

MITKRB5-SA-2011-005

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

Topic: FTP daemon fails to set effective group ID

CVE-2011-1526

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

SUMMARY
=======

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.

IMPACT
======

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.

AFFECTED SOFTWARE
=================

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

FIXES
=====

* 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
  compiled.

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)
 #endif
 	}
 
- -	(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))
 #else
- -   /* 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."
 #endif
 
 #ifdef HAVE_SETEGID
@@ -80,8 +79,7 @@
 #elif defined(HAVE_SETREGID)
 #  define krb5_setegid(EGID)	(setregid(getegid(), (gid_t)(EGID)))
 #else
- -   /* 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."
 #endif
 
 #endif

  This patch is also available at

  http://web.mit.edu/kerberos/advisories/2011-005-patch.txt

  A PGP-signed patch is available at

  http://web.mit.edu/kerberos/advisories/2011-005-patch.txt.asc

REFERENCES
==========

This announcement is posted at:

  http://web.mit.edu/kerberos/advisories/MITKRB5-SA-2011-005.txt

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

        http://web.mit.edu/kerberos/advisories/index.html

The main MIT Kerberos web page is at:

        http://web.mit.edu/kerberos/index.html

CVSSv2:

    http://www.first.org/cvss/cvss-guide.html
    http://nvd.nist.gov/cvss.cfm?calculator&adv&version=2

CVE: CVE-2011-1526
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1526

ACKNOWLEDGMENTS
===============

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

CONTACT
=======

The MIT Kerberos Team security contact address is
<krbcore-security@....edu>.  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@....edu>

DETAILS
=======

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
krb5_setegid().

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.

REVISION HISTORY
================

2011-07-05      original release

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

iEYEARECAAYFAk4TT7IACgkQSO8fWy4vZo7ttQCglKWLu47znBVfeGXl3LlnZtF2
llIAoNgVuCYIdVWcMEJaZ0oBp9RxhkzJ
=RUE/
-----END PGP SIGNATURE-----


Powered by blists - more mailing lists