Merge branch '3.3' into 3.4
This commit is contained in:
commit
4e63666783
@ -1,2 +1,2 @@
|
||||
941ac82e8f62127cf1ec571e43769b3d filter
|
||||
dcc8bf183a83b362d37fe9ef8df1fb60 less-487.tar.gz
|
||||
6a39bccf420c946b0fd7ffc64961315b less-530.tar.gz
|
||||
|
@ -1,6 +1,6 @@
|
||||
untrusted comment: verify with /etc/ports/core.pub
|
||||
RWRJc1FUaeVeqgv2i8BKqOr3HZkL+ZT53qegqunN3P6jN/VWf6gI9n9+D7HMexSsE+uTrsV5erP/FJK8vPKR5KkM4G7NR3KpgQM=
|
||||
SHA256 (Pkgfile) = cbf6d4fde8bd66d20cf49fa10cdb8b826dee82109596fbe609211672fafada26
|
||||
RWRJc1FUaeVeqiqXHE+3blplT991WRv91byPQpjxTL5E1hLzAEgkQDq3GT0/nRhEn1Va4ZBKdGe5pqIL4cGiKDbNz5Eg8eaq9A4=
|
||||
SHA256 (Pkgfile) = 63cbfb2c7cd2199b74d9835a164e7c2e332dcac79a13241f738bc37f8c3889d1
|
||||
SHA256 (.footprint) = d91026e5d2ff4c01ff02aac7d5d2964b61bafc14f5640f5550e341af7303b79e
|
||||
SHA256 (less-487.tar.gz) = f3dc8455cb0b2b66e0c6b816c00197a71bf6d1787078adeee0bcf2aea4b12706
|
||||
SHA256 (less-530.tar.gz) = 503f91ab0af4846f34f0444ab71c4b286123f0044a4964f1ae781486c617f2e2
|
||||
SHA256 (filter) = 5d5ced375baffa004d642cf815de1c9062ee283edc7600d189aa3e146598fbd9
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Depends on: ncurses libpcre
|
||||
|
||||
name=less
|
||||
version=487
|
||||
version=530
|
||||
release=1
|
||||
source=(http://www.greenwoodsoftware.com/less/$name-$version.tar.gz \
|
||||
filter)
|
||||
|
@ -1,3 +1,4 @@
|
||||
aad42ace9b3d450717355010b9344c56 CVE-2018-7169.patch
|
||||
80756b2d5b3351b3757f48ae69fe866d login.defs
|
||||
be8f69c2701118093af3d7f3bc02af16 pwck
|
||||
c350da50c2120de6bb29177699d89fe3 shadow-4.5.tar.xz
|
||||
|
@ -1,7 +1,8 @@
|
||||
untrusted comment: verify with /etc/ports/core.pub
|
||||
RWRJc1FUaeVeqpDsCheU2Flzc0CeEsEe3NNLiW1rztqmJbdJolKG3tJmJXgvIZDG5AmhN6URgAK9BoPhy46gWxv9CRZdtZgMvwU=
|
||||
SHA256 (Pkgfile) = 28e4ab2a059acc5972ecbb882d0b08fbe36d8c6b026fc87c150df2d5f06cdc1e
|
||||
RWRJc1FUaeVeqqLpIS3LGM3rjoF0kUdbtuIDL1UilPze46/DVrHdo27qHiHPLOaN8GLLukQJFkQRq8XV9obslWlWtguLSW/uTwo=
|
||||
SHA256 (Pkgfile) = 4647cbfe01446ff33de8393e0a6d9dff1a4ac199acd417e66e6623cf6a705507
|
||||
SHA256 (.footprint) = 196891826eef19be5e249380bc5c9560b10051556be4a3be5d33e099a56f23ae
|
||||
SHA256 (shadow-4.5.tar.xz) = fc8c858381ad577a5c25ff5beb6ee60a34f8719c73e4e7c61e74188b4e54b741
|
||||
SHA256 (CVE-2018-7169.patch) = 3b8896d8ac400692af1e2da17b9b8a447aa668c09fe16c1b9cee55e923b64820
|
||||
SHA256 (pwck) = c62f1bf5785c2bb93bb269156bfa02b06728a01ff5d6c2e09cf6285701a1fda0
|
||||
SHA256 (login.defs) = a5c63da222b9dd921b60a21be8fc888726b557fd3fde9f60c8899376d0311b0b
|
||||
|
180
shadow/CVE-2018-7169.patch
Normal file
180
shadow/CVE-2018-7169.patch
Normal file
@ -0,0 +1,180 @@
|
||||
From fb28c99b8a66ff2605c5cb96abc0a4d975f92de0 Mon Sep 17 00:00:00 2001
|
||||
From: Aleksa Sarai <asarai@suse.de>
|
||||
Date: Thu, 15 Feb 2018 23:49:40 +1100
|
||||
Subject: [PATCH] newgidmap: enforce setgroups=deny if self-mapping a group
|
||||
|
||||
This is necessary to match the kernel-side policy of "self-mapping in a
|
||||
user namespace is fine, but you cannot drop groups" -- a policy that was
|
||||
created in order to stop user namespaces from allowing trivial privilege
|
||||
escalation by dropping supplementary groups that were "blacklisted" from
|
||||
certain paths.
|
||||
|
||||
This is the simplest fix for the underlying issue, and effectively makes
|
||||
it so that unless a user has a valid mapping set in /etc/subgid (which
|
||||
only administrators can modify) -- and they are currently trying to use
|
||||
that mapping -- then /proc/$pid/setgroups will be set to deny. This
|
||||
workaround is only partial, because ideally it should be possible to set
|
||||
an "allow_setgroups" or "deny_setgroups" flag in /etc/subgid to allow
|
||||
administrators to further restrict newgidmap(1).
|
||||
|
||||
We also don't write anything in the "allow" case because "allow" is the
|
||||
default, and users may have already written "deny" even if they
|
||||
technically are allowed to use setgroups. And we don't write anything if
|
||||
the setgroups policy is already "deny".
|
||||
|
||||
Ref: https://bugs.launchpad.net/ubuntu/+source/shadow/+bug/1729357
|
||||
Fixes: CVE-2018-7169
|
||||
Reported-by: Craig Furman <craig.furman89@gmail.com>
|
||||
Signed-off-by: Aleksa Sarai <asarai@suse.de>
|
||||
---
|
||||
src/newgidmap.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 80 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/newgidmap.c b/src/newgidmap.c
|
||||
index b1e33513..59a2e75c 100644
|
||||
--- a/src/newgidmap.c
|
||||
+++ b/src/newgidmap.c
|
||||
@@ -46,32 +46,37 @@
|
||||
*/
|
||||
const char *Prog;
|
||||
|
||||
-static bool verify_range(struct passwd *pw, struct map_range *range)
|
||||
+
|
||||
+static bool verify_range(struct passwd *pw, struct map_range *range, bool *allow_setgroups)
|
||||
{
|
||||
/* An empty range is invalid */
|
||||
if (range->count == 0)
|
||||
return false;
|
||||
|
||||
- /* Test /etc/subgid */
|
||||
- if (have_sub_gids(pw->pw_name, range->lower, range->count))
|
||||
+ /* Test /etc/subgid. If the mapping is valid then we allow setgroups. */
|
||||
+ if (have_sub_gids(pw->pw_name, range->lower, range->count)) {
|
||||
+ *allow_setgroups = true;
|
||||
return true;
|
||||
+ }
|
||||
|
||||
- /* Allow a process to map its own gid */
|
||||
- if ((range->count == 1) && (pw->pw_gid == range->lower))
|
||||
+ /* Allow a process to map its own gid. */
|
||||
+ if ((range->count == 1) && (pw->pw_gid == range->lower)) {
|
||||
+ /* noop -- if setgroups is enabled already we won't disable it. */
|
||||
return true;
|
||||
+ }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void verify_ranges(struct passwd *pw, int ranges,
|
||||
- struct map_range *mappings)
|
||||
+ struct map_range *mappings, bool *allow_setgroups)
|
||||
{
|
||||
struct map_range *mapping;
|
||||
int idx;
|
||||
|
||||
mapping = mappings;
|
||||
for (idx = 0; idx < ranges; idx++, mapping++) {
|
||||
- if (!verify_range(pw, mapping)) {
|
||||
+ if (!verify_range(pw, mapping, allow_setgroups)) {
|
||||
fprintf(stderr, _( "%s: gid range [%lu-%lu) -> [%lu-%lu) not allowed\n"),
|
||||
Prog,
|
||||
mapping->upper,
|
||||
@@ -89,6 +94,70 @@ static void usage(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+void write_setgroups(int proc_dir_fd, bool allow_setgroups)
|
||||
+{
|
||||
+ int setgroups_fd;
|
||||
+ char *policy, policy_buffer[4096];
|
||||
+
|
||||
+ /*
|
||||
+ * Default is "deny", and any "allow" will out-rank a "deny". We don't
|
||||
+ * forcefully write an "allow" here because the process we are writing
|
||||
+ * mappings for may have already set themselves to "deny" (and "allow"
|
||||
+ * is the default anyway). So allow_setgroups == true is a noop.
|
||||
+ */
|
||||
+ policy = "deny\n";
|
||||
+ if (allow_setgroups)
|
||||
+ return;
|
||||
+
|
||||
+ setgroups_fd = openat(proc_dir_fd, "setgroups", O_RDWR|O_CLOEXEC);
|
||||
+ if (setgroups_fd < 0) {
|
||||
+ /*
|
||||
+ * If it's an ENOENT then we are on too old a kernel for the setgroups
|
||||
+ * code to exist. Emit a warning and bail on this.
|
||||
+ */
|
||||
+ if (ENOENT == errno) {
|
||||
+ fprintf(stderr, _("%s: kernel doesn't support setgroups restrictions\n"), Prog);
|
||||
+ goto out;
|
||||
+ }
|
||||
+ fprintf(stderr, _("%s: couldn't open process setgroups: %s\n"),
|
||||
+ Prog,
|
||||
+ strerror(errno));
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Check whether the policy is already what we want. /proc/self/setgroups
|
||||
+ * is write-once, so attempting to write after it's already written to will
|
||||
+ * fail.
|
||||
+ */
|
||||
+ if (read(setgroups_fd, policy_buffer, sizeof(policy_buffer)) < 0) {
|
||||
+ fprintf(stderr, _("%s: failed to read setgroups: %s\n"),
|
||||
+ Prog,
|
||||
+ strerror(errno));
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+ if (!strncmp(policy_buffer, policy, strlen(policy)))
|
||||
+ goto out;
|
||||
+
|
||||
+ /* Write the policy. */
|
||||
+ if (lseek(setgroups_fd, 0, SEEK_SET) < 0) {
|
||||
+ fprintf(stderr, _("%s: failed to seek setgroups: %s\n"),
|
||||
+ Prog,
|
||||
+ strerror(errno));
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+ if (dprintf(setgroups_fd, "%s", policy) < 0) {
|
||||
+ fprintf(stderr, _("%s: failed to setgroups %s policy: %s\n"),
|
||||
+ Prog,
|
||||
+ policy,
|
||||
+ strerror(errno));
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ close(setgroups_fd);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* newgidmap - Set the gid_map for the specified process
|
||||
*/
|
||||
@@ -103,6 +172,7 @@ int main(int argc, char **argv)
|
||||
struct stat st;
|
||||
struct passwd *pw;
|
||||
int written;
|
||||
+ bool allow_setgroups = false;
|
||||
|
||||
Prog = Basename (argv[0]);
|
||||
|
||||
@@ -145,7 +215,7 @@ int main(int argc, char **argv)
|
||||
(unsigned long) getuid ()));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
-
|
||||
+
|
||||
/* Get the effective uid and effective gid of the target process */
|
||||
if (fstat(proc_dir_fd, &st) < 0) {
|
||||
fprintf(stderr, _("%s: Could not stat directory for target %u\n"),
|
||||
@@ -177,8 +247,9 @@ int main(int argc, char **argv)
|
||||
if (!mappings)
|
||||
usage();
|
||||
|
||||
- verify_ranges(pw, ranges, mappings);
|
||||
+ verify_ranges(pw, ranges, mappings, &allow_setgroups);
|
||||
|
||||
+ write_setgroups(proc_dir_fd, allow_setgroups);
|
||||
write_mapping(proc_dir_fd, ranges, mappings, "gid_map");
|
||||
sub_gid_close();
|
||||
|
@ -5,13 +5,17 @@
|
||||
|
||||
name=shadow
|
||||
version=4.5
|
||||
release=1
|
||||
release=2
|
||||
source=(https://github.com/shadow-maint/shadow/releases/download/$version/shadow-$version.tar.xz
|
||||
CVE-2018-7169.patch
|
||||
pwck login.defs)
|
||||
|
||||
build() {
|
||||
cd $name-$version
|
||||
|
||||
# https://bugs.launchpad.net/ubuntu/+source/shadow/+bug/1729357
|
||||
patch -p1 -i $SRC/CVE-2018-7169.patch
|
||||
|
||||
./configure --prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--disable-shared \
|
||||
|
Loading…
Reference in New Issue
Block a user