summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnil Kaushik <anilkaushikwireless@gmail.com>2026-10-27 13:06:23 +0000
committerPaolo Abeni <pabeni@redhat.com>2026-10-29 15:14:50 +0100
commitdb627e71b6da4416324a2eb599d12fa96959d478 (patch)
tree4a8784c708e541d010f00e14eaab70b61f09f346
parentd7314b51341c037973ce022f12c6009fd07b021e (diff)
downloadlinux-db627e71b6da4416324a2eb599d12fa96959d478.tar.gz
linux-db627e71b6da4416324a2eb599d12fa96959d478.zip
gtp: Require 'CAP_NET_ADMIN' when joining the gtp multicast group
The gtp generic netlink family sends notifications on its "gtp" multicast group when a PDP context is added or deleted, and for GTP-U echo responses. They carry the same attributes as a GETPDP reply: the MS and peer addresses, and the TEIDs, or the TID and the flow label. GETPDP requires CAP_NET_ADMIN, but generic netlink lets any user join a multicast group by default, so an unprivileged user in the network namespace of the gtp device can read all of this. Found by code inspection. Fix by marking the group with GENL_MCAST_CAP_NET_ADMIN, like the psample "packets" group, and with uns-admin-perm in the gtp netlink spec. Only users with CAP_NET_ADMIN in the user namespace owning the network namespace can then join it. This is still weaker than the check on GETPDP, which needs CAP_NET_ADMIN in the initial user namespace: in a network namespace owned by another user namespace, its root can join the group, but not use GETPDP. Genetlink has no multicast group flag for the initial user namespace, and ioam6 pairs its ops and its group the same way. This fix blocks the unprivileged users. Tested by joining the group as root, as root without CAP_NET_ADMIN, and as an unprivileged user: Before: root: joined root without CAP_NET_ADMIN: joined nobody: joined After: root: joined root without CAP_NET_ADMIN: EPERM nobody: EPERM Fixes: 50aba46c234e ("gtp: add notification mechanism") Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: Anil Kaushik <anilkaushikwireless@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20261027130623.3136658-1-anilkaushikwireless@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r--Documentation/netlink/specs/gtp.yaml1
-rw-r--r--drivers/net/gtp.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/Documentation/netlink/specs/gtp.yaml b/Documentation/netlink/specs/gtp.yaml
index 7871f5def054..b65e18ae5df2 100644
--- a/Documentation/netlink/specs/gtp.yaml
+++ b/Documentation/netlink/specs/gtp.yaml
@@ -194,3 +194,4 @@ mcast-groups:
list:
-
name: gtp
+ flags: [uns-admin-perm]
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 86c8c88b702c..1dd32e979cf5 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -118,7 +118,8 @@ enum gtp_multicast_groups {
};
static const struct genl_multicast_group gtp_genl_mcgrps[] = {
- [GTP_GENL_MCGRP] = { .name = GTP_GENL_MCGRP_NAME },
+ [GTP_GENL_MCGRP] = { .name = GTP_GENL_MCGRP_NAME,
+ .flags = GENL_MCAST_CAP_NET_ADMIN, },
};
static void pdp_context_delete(struct pdp_ctx *pctx);