Compare commits

...

12 Commits

Author SHA1 Message Date
Salvatore Bonaccorso
bd62b6b2fb Import Debian changes 1:4.2-3+deb8u4
shadow (1:4.2-3+deb8u4) jessie-security; urgency=high
.
  * Non-maintainer upload by the Security Team.
  * Reset pid_child only if waitpid was successful.
    This is a regression fix for CVE-2017-2616. If su receives a signal like
    SIGTERM, it is not propagated to the child. (Closes: #862806)
2025-04-15 13:57:33 +02:00
Balint Reczey
096c5f276b Imported Debian patch 1:4.2-3+deb8u3 2017-02-26 11:37:09 +01:00
Salvatore Bonaccorso
ba9a0dec9d Imported Debian patch 1:4.2-3+deb8u2 2017-02-26 11:36:51 +01:00
Balint Reczey
75e2a3b103 Update changelog 2017-02-24 00:58:22 +01:00
Balint Reczey
e5e623f4ca Add myself to uploaders replacing Nicolas FRANCOIS (Nekral) 2017-02-24 00:57:02 +01:00
Balint Reczey
5fd2757d66 Update changelog 2017-02-24 00:51:09 +01:00
Balint Reczey
bef0d93006 Refresh patches 2017-02-24 00:49:51 +01:00
Balint Reczey
dd729b3572 Fix integer overflow in getulong.c (CVE-2016-6252)
Closes: #832170
2017-02-24 00:41:23 +01:00
Salvatore Bonaccorso
1edacbf29a su: properly clear child PID
Closes: #855943
2017-02-24 00:27:53 +01:00
Bastian Blank
a784e094c4 Imported Debian patch 1:4.2-3+deb8u1 2017-02-24 00:16:58 +01:00
Christian Perrier
1f9119ef49 releasing version 1:4.2-3 2014-11-20 22:29:43 +01:00
Christian Perrier
654077fff8 Enforce hardened builds to workaround cdbs sometimes not building with hardening flags as in 1:4.2-2+b1 Thanks to Dr. Markus Waldeck for pointing the issue and Simon Ruderich For providing a working patch. 2014-11-19 21:51:16 +01:00
10 changed files with 228 additions and 12 deletions

40
debian/changelog vendored
View File

@@ -1,3 +1,43 @@
shadow (1:4.2-3+deb8u4) jessie-security; urgency=high
* Non-maintainer upload by the Security Team.
* Reset pid_child only if waitpid was successful.
This is a regression fix for CVE-2017-2616. If su receives a signal like
SIGTERM, it is not propagated to the child. (Closes: #862806)
-- Salvatore Bonaccorso <carnil@debian.org> Wed, 17 May 2017 12:58:54 +0200
shadow (1:4.2-3+deb8u3) jessie-security; urgency=high
* Fix integer overflow in getulong.c (CVE-2016-6252) (Closes: #832170)
* Refresh patches
* Add myself to uploaders replacing Nicolas FRANCOIS (Nekral)
-- Balint Reczey <balint@balintreczey.hu> Fri, 24 Feb 2017 00:57:31 +0100
shadow (1:4.2-3+deb8u2) jessie-security; urgency=high
* Non-maintainer upload by the Security Team.
* su: properly clear child PID (CVE-2017-2616) (Closes: #855943)
-- Salvatore Bonaccorso <carnil@debian.org> Thu, 23 Feb 2017 17:21:08 +0100
shadow (1:4.2-3+deb8u1) jessie; urgency=medium
* Non-maintainer upload.
* Fix error handling in busy user detection. (Closes: #778287)
-- Bastian Blank <bastian.blank@credativ.de> Wed, 18 Nov 2015 08:07:09 +0000
shadow (1:4.2-3) unstable; urgency=low
* Enforce hardened builds to workaround cdbs sometimes not building
with hardening flags as in 1:4.2-2+b1
Thanks to Dr. Markus Waldeck for pointing the issue and Simon Ruderich
For providing a working patch.
-- Christian Perrier <bubulle@debian.org> Wed, 19 Nov 2014 21:59:09 +0100
shadow (1:4.2-2) unstable; urgency=low
* The "Soumaintrain" release

4
debian/control vendored
View File

@@ -3,8 +3,10 @@ Section: admin
Priority: required
Maintainer: Shadow package maintainers <pkg-shadow-devel@lists.alioth.debian.org>
Standards-Version: 3.9.5
Uploaders: Christian Perrier <bubulle@debian.org>, Nicolas FRANCOIS (Nekral) <nicolas.francois@centraliens.net>
Uploaders: Christian Perrier <bubulle@debian.org>,
Balint Reczey <balint@balintreczey.hu>
Build-Depends: dh-autoreconf, gettext, libpam0g-dev, debhelper (>= 6.0.7~), quilt, dpkg-dev (>= 1.13.5), xsltproc, docbook-xsl, docbook-xml, libxml2-utils, cdbs, libselinux1-dev [linux-any], libsemanage1-dev [linux-any], gnome-doc-utils (>= 0.4.3), bison, libaudit-dev [linux-any]
,hardening-wrapper
Vcs-Git: git://anonscm.debian.org/git/pkg-shadow/shadow.git
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-shadow/shadow.git;a=summary
Homepage: http://pkg-shadow.alioth.debian.org/

View File

@@ -0,0 +1,38 @@
Description: Fix user_busy to not leave subuid open in case of error.
Author: William Grant <wgrant@ubuntu.com>
Bug: https://bugs.launchpad.net/ubuntu/vivid/+source/shadow/+bug/1436937
Index: shadow-4.2/libmisc/user_busy.c
===================================================================
--- shadow-4.2.orig/libmisc/user_busy.c
+++ shadow-4.2/libmisc/user_busy.c
@@ -175,6 +175,9 @@ static int user_busy_processes (const ch
if (stat ("/", &sbroot) != 0) {
perror ("stat (\"/\")");
(void) closedir (proc);
+#ifdef ENABLE_SUBIDS
+ sub_uid_close();
+#endif /* ENABLE_SUBIDS */
return 0;
}
@@ -212,6 +215,9 @@ static int user_busy_processes (const ch
if (check_status (name, tmp_d_name, uid) != 0) {
(void) closedir (proc);
+#ifdef ENABLE_SUBIDS
+ sub_uid_close();
+#endif /* ENABLE_SUBIDS */
fprintf (stderr,
_("%s: user %s is currently used by process %d\n"),
Prog, name, pid);
@@ -232,6 +238,9 @@ static int user_busy_processes (const ch
}
if (check_status (name, task_path+6, uid) != 0) {
(void) closedir (proc);
+#ifdef ENABLE_SUBIDS
+ sub_uid_close();
+#endif /* ENABLE_SUBIDS */
fprintf (stderr,
_("%s: user %s is currently used by process %d\n"),
Prog, name, pid);

View File

@@ -0,0 +1,59 @@
From 08fd4b69e84364677a10e519ccb25b71710ee686 Mon Sep 17 00:00:00 2001
From: Tobias Stoeckmann <tobias@stoeckmann.org>
Date: Thu, 23 Feb 2017 09:47:29 -0600
Subject: [PATCH] su: properly clear child PID
If su is compiled with PAM support, it is possible for any local user
to send SIGKILL to other processes with root privileges. There are
only two conditions. First, the user must be able to perform su with
a successful login. This does NOT have to be the root user, even using
su with the same id is enough, e.g. "su $(whoami)". Second, SIGKILL
can only be sent to processes which were executed after the su process.
It is not possible to send SIGKILL to processes which were already
running. I consider this as a security vulnerability, because I was
able to write a proof of concept which unlocked a screen saver of
another user this way.
---
src/su.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
--- a/src/su.c
+++ b/src/su.c
@@ -363,20 +363,35 @@ static void prepare_pam_close_session (v
/* wake child when resumed */
kill (pid, SIGCONT);
stop = false;
+ } else {
+ pid_child = 0;
}
} while (!stop);
}
- if (0 != caught) {
+ if (0 != caught && 0 != pid_child) {
(void) fputs ("\n", stderr);
(void) fputs (_("Session terminated, terminating shell..."),
stderr);
(void) kill (-pid_child, caught);
(void) signal (SIGALRM, kill_child);
+ (void) signal (SIGCHLD, catch_signals);
(void) alarm (2);
- (void) wait (&status);
+ sigemptyset (&ourset);
+ if ((sigaddset (&ourset, SIGALRM) != 0)
+ || (sigprocmask (SIG_BLOCK, &ourset, NULL) != 0)) {
+ fprintf (stderr, _("%s: signal masking malfunction\n"), Prog);
+ kill_child (0);
+ } else {
+ while (0 == waitpid (pid_child, &status, WNOHANG)) {
+ sigsuspend (&ourset);
+ }
+ pid_child = 0;
+ (void) sigprocmask (SIG_UNBLOCK, &ourset, NULL);
+ }
+
(void) fputs (_(" ...terminated.\n"), stderr);
}

View File

@@ -0,0 +1,46 @@
From 1d5a926cc2d6078d23a96222b1ef3e558724dad1 Mon Sep 17 00:00:00 2001
From: Sebastian Krahmer <krahmer@suse.com>
Date: Wed, 3 Aug 2016 11:51:07 -0500
Subject: [PATCH] Simplify getulong
Use strtoul to read an unsigned long, rather than reading
a signed long long and casting it.
https://bugzilla.suse.com/show_bug.cgi?id=979282
---
lib/getulong.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/lib/getulong.c b/lib/getulong.c
index 61579ca..08d2c1a 100644
--- a/lib/getulong.c
+++ b/lib/getulong.c
@@ -44,22 +44,19 @@
*/
int getulong (const char *numstr, /*@out@*/unsigned long int *result)
{
- long long int val;
+ unsigned long int val;
char *endptr;
errno = 0;
- val = strtoll (numstr, &endptr, 0);
+ val = strtoul (numstr, &endptr, 0);
if ( ('\0' == *numstr)
|| ('\0' != *endptr)
|| (ERANGE == errno)
- /*@+ignoresigns@*/
- || (val != (unsigned long int)val)
- /*@=ignoresigns@*/
) {
return 0;
}
- *result = (unsigned long int)val;
+ *result = val;
return 1;
}
--
2.1.4

View File

@@ -0,0 +1,29 @@
From 7d82f203eeec881c584b2fa06539b39e82985d97 Mon Sep 17 00:00:00 2001
From: Tobias Stoeckmann <tobias@stoeckmann.org>
Date: Sun, 14 May 2017 17:58:10 +0200
Subject: [PATCH] Reset pid_child only if waitpid was successful.
Do not reset the pid_child to 0 if the child process is still
running. This else-condition can be reached with pid being -1,
therefore explicitly test this condition.
This is a regression fix for CVE-2017-2616. If su receives a
signal like SIGTERM, it is not propagated to the child.
Reported-by: Radu Duta <raduduta@gmail.com>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
---
src/su.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/src/su.c
+++ b/src/su.c
@@ -363,7 +363,7 @@ static void prepare_pam_close_session (v
/* wake child when resumed */
kill (pid, SIGCONT);
stop = false;
- } else {
+ } else if ( (pid_t)-1 != pid) {
pid_child = 0;
}
} while (!stop);

View File

@@ -8,11 +8,9 @@ Status wrt upstream: This is a Debian specific patch.
Note: the fix of the man page is still missing.
(to be taken from the trunk)
Index: git/src/su.c
===================================================================
--- git.orig/src/su.c
+++ git/src/su.c
@@ -1152,6 +1152,35 @@
--- a/src/su.c
+++ b/src/su.c
@@ -1167,6 +1167,35 @@
argv[0] = "-c";
argv[1] = command;
}

View File

@@ -8,10 +8,8 @@ Etch.
Status wrt upstream: This patch is Debian specific.
Index: git/src/su.c
===================================================================
--- git.orig/src/su.c
+++ git/src/su.c
--- a/src/su.c
+++ b/src/su.c
@@ -104,6 +104,19 @@
/* If nonzero, change some environment vars to indicate the user su'd to. */
static bool change_environment = true;
@@ -32,7 +30,7 @@ Index: git/src/su.c
#ifdef USE_PAM
static pam_handle_t *pamh = NULL;
static int caught = 0;
@@ -949,6 +962,8 @@
@@ -964,6 +977,8 @@
int ret;
#endif /* USE_PAM */
@@ -41,7 +39,7 @@ Index: git/src/su.c
(void) setlocale (LC_ALL, "");
(void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE);
@@ -1156,7 +1171,7 @@
@@ -1171,7 +1186,7 @@
* resulting string is always given to the shell with its
* -c option.
*/

View File

@@ -4,6 +4,9 @@
503_shadowconfig.8
008_login_log_failure_in_FTMP
301-CVE-2017-2616-su-properly-clear-child-PID.patch
302-CVE-2016-6252-fix-integer-overflow.patch
303-Reset-pid_child-only-if-waitpid-was-successful.patch
429_login_FAILLOG_ENAB
401_cppw_src.dpatch
# 402 should be merged in 401, but should be reviewed by SE Linux experts first
@@ -34,3 +37,4 @@
#userns/16_add-argument-sanity-checking.patch
1000_configure_userns
1010_vietnamese_translation
1020_fix_user_busy_errors

2
debian/rules vendored
View File

@@ -3,6 +3,8 @@
DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
export DEB_BUILD_HARDENING=1
# Enable PIE, BINDNOW, and possible future flags.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all