Skip to content

Commit 5013be1

Browse files
foxiraingregkh
authored andcommitted
ppp: require CAP_NET_ADMIN in target netns for unattached ioctls
[ Upstream commit 2bb6379 ] /dev/ppp open is currently authorized against file->f_cred->user_ns, while unattached administrative ioctls operate on current->nsproxy->net_ns. As a result, a local unprivileged user can create a new user namespace with CLONE_NEWUSER, gain CAP_NET_ADMIN only in that new user namespace, and still issue PPPIOCNEWUNIT, PPPIOCATTACH, or PPPIOCATTCHAN against an inherited network namespace. Require CAP_NET_ADMIN in the user namespace that owns the target network namespace before handling unattached PPP administrative ioctls. This preserves normal pppd operation in the network namespace it is actually privileged in, while rejecting the userns-only inherited-netns case. Fixes: 273ec51 ("net: ppp_generic - introduce net-namespace functionality v2") Signed-off-by: Taegu Ha <hataegu0826@gmail.com> Link: https://patch.msgid.link/20260409071117.4354-1-hataegu0826@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 6086079 commit 5013be1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/net/ppp/ppp_generic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,9 @@ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
10571057
struct ppp_net *pn;
10581058
int __user *p = (int __user *)arg;
10591059

1060+
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
1061+
return -EPERM;
1062+
10601063
switch (cmd) {
10611064
case PPPIOCNEWUNIT:
10621065
/* Create a new ppp unit */

0 commit comments

Comments
 (0)