summaryrefslogtreecommitdiffstats
path: root/netfilter-xt_osf-Add-missing-permission-checks.patch
diff options
context:
space:
mode:
authorJeremy Cline <jeremy@jcline.org>2017-12-14 09:50:53 -0500
committerJeremy Cline <jeremy@jcline.org>2017-12-14 09:50:53 -0500
commitb6e3b19cd5c54902789574a3def1787d2c143246 (patch)
treea376a89a88c6f1d98803cd69ab939fc9089904ca /netfilter-xt_osf-Add-missing-permission-checks.patch
parentaede7982b7100e8b769edff793649a9b8258348d (diff)
downloadkernel-b6e3b19cd5c54902789574a3def1787d2c143246.tar.gz
kernel-b6e3b19cd5c54902789574a3def1787d2c143246.tar.xz
kernel-b6e3b19cd5c54902789574a3def1787d2c143246.zip
Linux v4.14.5
Also fixes CVE-2017-17448, CVE-2017-17449, CVE-2017-17450
Diffstat (limited to 'netfilter-xt_osf-Add-missing-permission-checks.patch')
-rw-r--r--netfilter-xt_osf-Add-missing-permission-checks.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/netfilter-xt_osf-Add-missing-permission-checks.patch b/netfilter-xt_osf-Add-missing-permission-checks.patch
new file mode 100644
index 000000000..80cd60847
--- /dev/null
+++ b/netfilter-xt_osf-Add-missing-permission-checks.patch
@@ -0,0 +1,59 @@
+From 2af0d441c8b1151a5d8bb46ec9c58ab575fe7d6f Mon Sep 17 00:00:00 2001
+From: Kevin Cernekee <cernekee@chromium.org>
+Date: Tue, 5 Dec 2017 15:42:41 -0800
+Subject: [PATCH] netfilter: xt_osf: Add missing permission checks
+
+The capability check in nfnetlink_rcv() verifies that the caller
+has CAP_NET_ADMIN in the namespace that "owns" the netlink socket.
+However, xt_osf_fingers is shared by all net namespaces on the
+system. An unprivileged user can create user and net namespaces
+in which he holds CAP_NET_ADMIN to bypass the netlink_net_capable()
+check:
+
+ vpnns -- nfnl_osf -f /tmp/pf.os
+
+ vpnns -- nfnl_osf -f /tmp/pf.os -d
+
+These non-root operations successfully modify the systemwide OS
+fingerprint list. Add new capable() checks so that they can't.
+
+Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
+---
+ net/netfilter/xt_osf.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/net/netfilter/xt_osf.c b/net/netfilter/xt_osf.c
+index 36e14b1f061d..a34f314a8c23 100644
+--- a/net/netfilter/xt_osf.c
++++ b/net/netfilter/xt_osf.c
+@@ -19,6 +19,7 @@
+ #include <linux/module.h>
+ #include <linux/kernel.h>
+
++#include <linux/capability.h>
+ #include <linux/if.h>
+ #include <linux/inetdevice.h>
+ #include <linux/ip.h>
+@@ -70,6 +71,9 @@ static int xt_osf_add_callback(struct net *net, struct sock *ctnl,
+ struct xt_osf_finger *kf = NULL, *sf;
+ int err = 0;
+
++ if (!capable(CAP_NET_ADMIN))
++ return -EPERM;
++
+ if (!osf_attrs[OSF_ATTR_FINGER])
+ return -EINVAL;
+
+@@ -115,6 +119,9 @@ static int xt_osf_remove_callback(struct net *net, struct sock *ctnl,
+ struct xt_osf_finger *sf;
+ int err = -ENOENT;
+
++ if (!capable(CAP_NET_ADMIN))
++ return -EPERM;
++
+ if (!osf_attrs[OSF_ATTR_FINGER])
+ return -EINVAL;
+
+--
+2.14.3
+