|
|
ce426f |
#* CVE-2013-2207 Incorrectly granting access to another user's pseudo-terminal
|
|
|
ce426f |
# has been fixed by disabling the use of pt_chown (Bugzilla #15755).
|
|
|
ce426f |
# Distributions can re-enable building and using pt_chown via the new configure
|
|
|
ce426f |
# option `--enable-pt_chown'. Enabling the use of pt_chown carries with it
|
|
|
ce426f |
# considerable security risks and should only be used if the distribution
|
|
|
ce426f |
# understands and accepts the risks.
|
|
|
ce426f |
#
|
|
|
ce426f |
#2013-07-21 Siddhesh Poyarekar <siddhesh@redhat.com>
|
|
|
ce426f |
# Andreas Schwab <schwab@suse.de>
|
|
|
ce426f |
# Roland McGrath <roland@hack.frob.com>
|
|
|
ce426f |
# Joseph Myers <joseph@codesourcery.com>
|
|
|
ce426f |
# Carlos O'Donell <carlos@redhat.com>
|
|
|
ce426f |
#
|
|
|
ce426f |
# [BZ #15755]
|
|
|
ce426f |
# * config.h.in: Define HAVE_PT_CHOWN.
|
|
|
ce426f |
# * config.make.in (build-pt-chown): New variable.
|
|
|
ce426f |
# * configure.in (--enable-pt_chown): New configure option.
|
|
|
ce426f |
# * configure: Regenerate.
|
|
|
ce426f |
# * login/Makefile: Include Makeconfig. Build pt_chown only if
|
|
|
ce426f |
# build-pt-chown is enabled.
|
|
|
ce426f |
# * sysdeps/unix/grantpt.c (grantpt) [HAVE_PT_CHOWN]: Spawn
|
|
|
ce426f |
# pt_chown to fix pty ownership.
|
|
|
ce426f |
# * sysdeps/unix/sysv/linux/grantpt.c [HAVE_PT_CHOWN]: Define
|
|
|
ce426f |
# CLOSE_ALL_FDS.
|
|
|
ce426f |
# * manual/install.texi (Configuring and compiling): Mention
|
|
|
ce426f |
# --enable-pt_chown. Add @findex for grantpt.
|
|
|
ce426f |
# * INSTALL: Regenerate.
|
|
|
ce426f |
#
|
|
|
ce426f |
diff -Nru glibc-2.17-c758a686/config.h.in glibc-2.17-c758a686/config.h.in
|
|
|
ce426f |
--- glibc-2.17-c758a686/config.h.in 2012-12-24 22:02:13.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/config.h.in 2013-07-24 00:20:07.651301252 -0400
|
|
|
ce426f |
@@ -232,4 +232,7 @@
|
|
|
ce426f |
/* The ARM hard-float ABI is being used. */
|
|
|
ce426f |
#undef HAVE_ARM_PCS_VFP
|
|
|
ce426f |
|
|
|
ce426f |
+/* The pt_chown binary is being built and used by grantpt. */
|
|
|
ce426f |
+#undef HAVE_PT_CHOWN
|
|
|
ce426f |
+
|
|
|
ce426f |
#endif
|
|
|
ce426f |
diff -Nru glibc-2.17-c758a686/config.make.in glibc-2.17-c758a686/config.make.in
|
|
|
ce426f |
--- glibc-2.17-c758a686/config.make.in 2012-12-24 22:02:13.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/config.make.in 2013-07-24 00:21:15.244176098 -0400
|
|
|
ce426f |
@@ -101,6 +101,7 @@ force-install = @force_install@
|
|
|
ce426f |
link-obsolete-rpc = @link_obsolete_rpc@
|
|
|
ce426f |
build-nscd = @build_nscd@
|
|
|
ce426f |
use-nscd = @use_nscd@
|
|
|
ce426f |
+build-pt-chown = @build_pt_chown@
|
|
|
ce426f |
|
|
|
ce426f |
# Build tools.
|
|
|
ce426f |
CC = @CC@
|
|
|
ce426f |
diff -Nru glibc-2.17-c758a686/configure glibc-2.17-c758a686/configure
|
|
|
ce426f |
--- glibc-2.17-c758a686/configure 2013-07-24 00:25:10.090174244 -0400
|
|
|
ce426f |
+++ glibc-2.17-c758a686/configure 2013-07-24 00:20:07.769174345 -0400
|
|
|
ce426f |
@@ -653,6 +653,7 @@ multi_arch
|
|
|
ce426f |
base_machine
|
|
|
ce426f |
add_on_subdirs
|
|
|
ce426f |
add_ons
|
|
|
ce426f |
+build_pt_chown
|
|
|
ce426f |
build_nscd
|
|
|
ce426f |
link_obsolete_rpc
|
|
|
ce426f |
libc_cv_nss_crypt
|
|
|
ce426f |
@@ -759,6 +760,7 @@ enable_obsolete_rpc
|
|
|
ce426f |
enable_systemtap
|
|
|
ce426f |
enable_build_nscd
|
|
|
ce426f |
enable_nscd
|
|
|
ce426f |
+enable_pt_chown
|
|
|
ce426f |
with_cpu
|
|
|
ce426f |
'
|
|
|
ce426f |
ac_precious_vars='build_alias
|
|
|
ce426f |
@@ -1419,6 +1421,7 @@ Optional Features:
|
|
|
ce426f |
--enable-systemtap enable systemtap static probe points [default=no]
|
|
|
ce426f |
--disable-build-nscd disable building and installing the nscd daemon
|
|
|
ce426f |
--disable-nscd library functions will not contact the nscd daemon
|
|
|
ce426f |
+ --enable-pt_chown Enable building and installing pt_chown
|
|
|
ce426f |
|
|
|
ce426f |
Optional Packages:
|
|
|
ce426f |
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
|
|
ce426f |
@@ -3934,6 +3937,19 @@ else
|
|
|
ce426f |
fi
|
|
|
ce426f |
|
|
|
ce426f |
|
|
|
ce426f |
+# Check whether --enable-pt_chown was given.
|
|
|
ce426f |
+if test "${enable_pt_chown+set}" = set; then :
|
|
|
ce426f |
+ enableval=$enable_pt_chown; build_pt_chown=$enableval
|
|
|
ce426f |
+else
|
|
|
ce426f |
+ build_pt_chown=no
|
|
|
ce426f |
+fi
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+if test $build_pt_chown = yes; then
|
|
|
ce426f |
+ $as_echo "#define HAVE_PT_CHOWN 1" >>confdefs.h
|
|
|
ce426f |
+
|
|
|
ce426f |
+fi
|
|
|
ce426f |
+
|
|
|
ce426f |
# The way shlib-versions is used to generate soversions.mk uses a
|
|
|
ce426f |
# fairly simplistic model for name recognition that can't distinguish
|
|
|
ce426f |
# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
|
|
|
ce426f |
diff -Nru glibc-2.17-c758a686/configure.in glibc-2.17-c758a686/configure.in
|
|
|
ce426f |
--- glibc-2.17-c758a686/configure.in 2012-12-24 22:02:13.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/configure.in 2013-07-24 00:20:07.658298658 -0400
|
|
|
ce426f |
@@ -315,6 +315,16 @@ AC_ARG_ENABLE([nscd],
|
|
|
ce426f |
[use_nscd=$enableval],
|
|
|
ce426f |
[use_nscd=yes])
|
|
|
ce426f |
|
|
|
ce426f |
+AC_ARG_ENABLE([pt_chown],
|
|
|
ce426f |
+ [AS_HELP_STRING([--enable-pt_chown],
|
|
|
ce426f |
+ [Enable building and installing pt_chown])],
|
|
|
ce426f |
+ [build_pt_chown=$enableval],
|
|
|
ce426f |
+ [build_pt_chown=no])
|
|
|
ce426f |
+AC_SUBST(build_pt_chown)
|
|
|
ce426f |
+if test $build_pt_chown = yes; then
|
|
|
ce426f |
+ AC_DEFINE(HAVE_PT_CHOWN)
|
|
|
ce426f |
+fi
|
|
|
ce426f |
+
|
|
|
ce426f |
# The way shlib-versions is used to generate soversions.mk uses a
|
|
|
ce426f |
# fairly simplistic model for name recognition that can't distinguish
|
|
|
ce426f |
# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
|
|
|
ce426f |
diff -Nru glibc-2.17-c758a686/INSTALL glibc-2.17-c758a686/INSTALL
|
|
|
ce426f |
--- glibc-2.17-c758a686/INSTALL 2012-12-24 22:02:13.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/INSTALL 2013-07-24 00:20:07.650300624 -0400
|
|
|
ce426f |
@@ -128,6 +128,18 @@ will be used, and CFLAGS sets optimizati
|
|
|
ce426f |
this can be prevented though there generally is no reason since it
|
|
|
ce426f |
creates compatibility problems.
|
|
|
ce426f |
|
|
|
ce426f |
+`--enable-pt_chown'
|
|
|
ce426f |
+ The file `pt_chown' is a helper binary for `grantpt' (*note
|
|
|
ce426f |
+ Pseudo-Terminals: Allocation.) that is installed setuid root to
|
|
|
ce426f |
+ fix up pseudo-terminal ownership. It is not built by default
|
|
|
ce426f |
+ because systems using the Linux kernel are commonly built with the
|
|
|
ce426f |
+ `devpts' filesystem enabled and mounted at `/dev/pts', which
|
|
|
ce426f |
+ manages pseudo-terminal ownership automatically. By using
|
|
|
ce426f |
+ `--enable-pt_chown', you may build `pt_chown' and install it
|
|
|
ce426f |
+ setuid and owned by `root'. The use of `pt_chown' introduces
|
|
|
ce426f |
+ additional security risks to the system and you should enable it
|
|
|
ce426f |
+ only if you understand and accept those risks.
|
|
|
ce426f |
+
|
|
|
ce426f |
`--build=BUILD-SYSTEM'
|
|
|
ce426f |
`--host=HOST-SYSTEM'
|
|
|
ce426f |
These options are for cross-compiling. If you specify both
|
|
|
ce426f |
diff -Nru glibc-2.17-c758a686/login/Makefile glibc-2.17-c758a686/login/Makefile
|
|
|
ce426f |
--- glibc-2.17-c758a686/login/Makefile 2012-12-24 22:02:13.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/login/Makefile 2013-07-24 00:20:07.660298670 -0400
|
|
|
ce426f |
@@ -29,9 +29,15 @@ routines := getutent getutent_r getutid
|
|
|
ce426f |
|
|
|
ce426f |
CFLAGS-grantpt.c = -DLIBEXECDIR='"$(libexecdir)"'
|
|
|
ce426f |
|
|
|
ce426f |
-others = utmpdump pt_chown
|
|
|
ce426f |
+others = utmpdump
|
|
|
ce426f |
+
|
|
|
ce426f |
+include ../Makeconfig
|
|
|
ce426f |
+
|
|
|
ce426f |
+ifeq (yes,$(build-pt-chown))
|
|
|
ce426f |
+others += pt_chown
|
|
|
ce426f |
others-pie = pt_chown
|
|
|
ce426f |
install-others-programs = $(inst_libexecdir)/pt_chown
|
|
|
ce426f |
+endif
|
|
|
ce426f |
|
|
|
ce426f |
subdir-dirs = programs
|
|
|
ce426f |
vpath %.c programs
|
|
|
ce426f |
diff -Nru glibc-2.17-c758a686/manual/install.texi glibc-2.17-c758a686/manual/install.texi
|
|
|
ce426f |
--- glibc-2.17-c758a686/manual/install.texi 2012-12-24 22:02:13.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/manual/install.texi 2013-07-24 00:20:07.662298261 -0400
|
|
|
ce426f |
@@ -155,6 +155,20 @@ if the used tools support it. By using
|
|
|
ce426f |
prevented though there generally is no reason since it creates
|
|
|
ce426f |
compatibility problems.
|
|
|
ce426f |
|
|
|
ce426f |
+@pindex pt_chown
|
|
|
ce426f |
+@findex grantpt
|
|
|
ce426f |
+@item --enable-pt_chown
|
|
|
ce426f |
+The file @file{pt_chown} is a helper binary for @code{grantpt}
|
|
|
ce426f |
+(@pxref{Allocation, Pseudo-Terminals}) that is installed setuid root to
|
|
|
ce426f |
+fix up pseudo-terminal ownership. It is not built by default because
|
|
|
ce426f |
+systems using the Linux kernel are commonly built with the @code{devpts}
|
|
|
ce426f |
+filesystem enabled and mounted at @file{/dev/pts}, which manages
|
|
|
ce426f |
+pseudo-terminal ownership automatically. By using
|
|
|
ce426f |
+@samp{--enable-pt_chown}, you may build @file{pt_chown} and install it
|
|
|
ce426f |
+setuid and owned by @code{root}. The use of @file{pt_chown} introduces
|
|
|
ce426f |
+additional security risks to the system and you should enable it only if
|
|
|
ce426f |
+you understand and accept those risks.
|
|
|
ce426f |
+
|
|
|
ce426f |
@item --build=@var{build-system}
|
|
|
ce426f |
@itemx --host=@var{host-system}
|
|
|
ce426f |
These options are for cross-compiling. If you specify both options and
|
|
|
ce426f |
diff -Nru glibc-2.17-c758a686/sysdeps/unix/grantpt.c glibc-2.17-c758a686/sysdeps/unix/grantpt.c
|
|
|
ce426f |
--- glibc-2.17-c758a686/sysdeps/unix/grantpt.c 2012-12-24 22:02:13.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/unix/grantpt.c 2013-07-24 00:20:07.663299235 -0400
|
|
|
ce426f |
@@ -173,9 +173,10 @@ grantpt (int fd)
|
|
|
ce426f |
retval = 0;
|
|
|
ce426f |
goto cleanup;
|
|
|
ce426f |
|
|
|
ce426f |
- /* We have to use the helper program. */
|
|
|
ce426f |
+ /* We have to use the helper program if it is available. */
|
|
|
ce426f |
helper:;
|
|
|
ce426f |
|
|
|
ce426f |
+#ifdef HAVE_PT_CHOWN
|
|
|
ce426f |
pid_t pid = __fork ();
|
|
|
ce426f |
if (pid == -1)
|
|
|
ce426f |
goto cleanup;
|
|
|
ce426f |
@@ -190,9 +191,9 @@ grantpt (int fd)
|
|
|
ce426f |
if (__dup2 (fd, PTY_FILENO) < 0)
|
|
|
ce426f |
_exit (FAIL_EBADF);
|
|
|
ce426f |
|
|
|
ce426f |
-#ifdef CLOSE_ALL_FDS
|
|
|
ce426f |
+# ifdef CLOSE_ALL_FDS
|
|
|
ce426f |
CLOSE_ALL_FDS ();
|
|
|
ce426f |
-#endif
|
|
|
ce426f |
+# endif
|
|
|
ce426f |
|
|
|
ce426f |
execle (_PATH_PT_CHOWN, basename (_PATH_PT_CHOWN), NULL, NULL);
|
|
|
ce426f |
_exit (FAIL_EXEC);
|
|
|
ce426f |
@@ -231,6 +232,7 @@ grantpt (int fd)
|
|
|
ce426f |
assert(! "getpt: internal error: invalid exit code from pt_chown");
|
|
|
ce426f |
}
|
|
|
ce426f |
}
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
|
|
|
ce426f |
cleanup:
|
|
|
ce426f |
if (buf != _buf)
|
|
|
ce426f |
diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/grantpt.c glibc-2.17-c758a686/sysdeps/unix/sysv/linux/grantpt.c
|
|
|
ce426f |
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/grantpt.c 2012-12-24 22:02:13.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/grantpt.c 2013-07-24 00:20:07.664298465 -0400
|
|
|
ce426f |
@@ -11,7 +11,7 @@
|
|
|
ce426f |
|
|
|
ce426f |
#include "pty-private.h"
|
|
|
ce426f |
|
|
|
ce426f |
-
|
|
|
ce426f |
+#if HAVE_PT_CHOWN
|
|
|
ce426f |
/* Close all file descriptors except the one specified. */
|
|
|
ce426f |
static void
|
|
|
ce426f |
close_all_fds (void)
|
|
|
ce426f |
@@ -38,6 +38,7 @@ close_all_fds (void)
|
|
|
ce426f |
__dup2 (STDOUT_FILENO, STDERR_FILENO);
|
|
|
ce426f |
}
|
|
|
ce426f |
}
|
|
|
ce426f |
-#define CLOSE_ALL_FDS() close_all_fds()
|
|
|
ce426f |
+# define CLOSE_ALL_FDS() close_all_fds()
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
|
|
|
ce426f |
#include <sysdeps/unix/grantpt.c>
|