From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A395364E89; Wed, 20 May 2026 17:23:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779297797; cv=none; b=Vsx0vfS6f6QDVwH5i2ESNDOrhNLPqFn5/sRz0XhSG4UA35e5LYsbCtyKGsRDQaKCfeEjH+i/tncaCvD4ePDjwyUTgF1eu7KR/+475sXb3ktLqtuGFY13A0yM7oAzkXCpP8C4j7Oj68oOrK0g7vDYodA2ZzPLJwY//QncklBrkVQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779297797; c=relaxed/simple; bh=4pyUTkluEsj9zKg4IKVjjMv8LOk6yc4wxR9YaLNRmTg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gK1IVmetO0A+qc7o1N/WaGCjFzhjZ/n+2IULZyqftn17yRSOtEWWu92N7cY/y01nI7sR7rsRxGKfU13a5MCRVPXVIZB6Nno7hp7nCDe4udAo7H+QW9sfbbDx+/Ol30BIXfMjb63c/cPHdc0sDyHir7CGXq2auw/Azv5w/+UDsAM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gHxUgHqR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gHxUgHqR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFBF81F00893; Wed, 20 May 2026 17:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779297796; bh=kbC887ZzSeRaGcc4IYOJloc9WuXdi1IK7yrOkoahwD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gHxUgHqR71zaDkap/mr0nJdiN+f8WTTEaNU1uFSNN70xvvlXrTMaH/cet1H0kqvF7 8JD1MAPDytWrjnm2jgTx/6bjYqKKJclbPlR2McVAF3ALkvqH7oywBFFplFslt90+/G WVO9YMWPviougH4LYUsTIUq1NVE++dD8LtwuFLCw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Taegu Ha , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 166/957] ppp: require CAP_NET_ADMIN in target netns for unattached ioctls Date: Wed, 20 May 2026 18:10:49 +0200 Message-ID: <20260520162138.152585406@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Taegu Ha [ Upstream commit 2bb6379416fd19f44c3423a00bfd8626259f6067 ] /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: 273ec51dd7ce ("net: ppp_generic - introduce net-namespace functionality v2") Signed-off-by: Taegu Ha Link: https://patch.msgid.link/20260409071117.4354-1-hataegu0826@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ppp/ppp_generic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index f9f0f16c41d10..7ad6c241c3295 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -1057,6 +1057,9 @@ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, struct ppp_net *pn; int __user *p = (int __user *)arg; + if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) + return -EPERM; + switch (cmd) { case PPPIOCNEWUNIT: /* Create a new ppp unit */ -- 2.53.0