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 90A0D477E57; Tue, 16 Jun 2026 17:37:03 +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=1781631424; cv=none; b=REASNFRNTxuIaUZjmGBg9ydHjHPxoqEcBVNHnN/0riVVCplnwHqZlJ1/sokRibgU5IkFUQJNuhZTcNnGWJjR1tqygr3cKKqMcv3UaRFP7pBIQxWCYusvTwN+MXaES5/mJO5NYFZeRM9mN8p1Ws0Q17UYUJI5dpOcLxjNibnpVX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781631424; c=relaxed/simple; bh=/N9Nkkx7Cs6HZVftl9ObDmIZkqoWNf/XBXZsfuRyW4w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CEn0vKGtjchxv26Gr6RmKvJDMU/kNSXzBznRbapW0DXH+KVEaRyaW/QWLdLlWP7gT/CcB037ieDnVeV4c1WHlBpR7yHLJUKanvSPeqLB9kfzzCkzeyteMDdjmQBAG2s6HGTwplqMDWudK+FnAOTBSNcoXDOPbkVAcl6w8p3u6RE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LcGW3WUG; 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="LcGW3WUG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B1B91F000E9; Tue, 16 Jun 2026 17:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781631423; bh=Cz9A2T033a3W2dZ0/E64LYkS4KoFSORwjo6h/eSpt2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LcGW3WUG+5z0ZhefAK7DAxwdicLy5/VrOe3MV8u+wQbni3SuW9fMDV4CzEBVEkPmF 3/ny/EouFxMVYLpnXlLmu9JEdisQP1E2Odj17XxWC7LhmzASt7pX9f3k53Pmp8YT+K Nx1UrTMilWiArJWj5EZdmdMVPCoxa/OWfjUX8YKg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tamir Shahar , Amit Klein , Eric Dumazet , David Ahern , Ido Schimmel , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 219/522] ipv4: restrict IPOPT_SSRR and IPOPT_LSRR options Date: Tue, 16 Jun 2026 20:26:06 +0530 Message-ID: <20260616145136.274382412@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145125.307082728@linuxfoundation.org> References: <20260616145125.307082728@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit d3915a1f5a4bc0ac911032903c3c6ab8df9fcc7c ] This patch restricts setting Loose Source and Record Route (LSRR) and Strict Source and Record Route (SSRR) IP options to users with CAP_NET_RAW capability. This prevents unprivileged applications from forcing packets to route through attacker-controlled nodes to leak TCP ISN and possibly other protocol information. While LSRR and SSRR are commonly filtered in many network environments, they may still be supported and forwarded along some network paths. RFC 7126 (Recommendations on Filtering of IPv4 Packets Containing IPv4 Options) recommend to drop these options in 4.3 and 4.4. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Tamir Shahar Reported-by: Amit Klein Signed-off-by: Eric Dumazet Reviewed-by: David Ahern Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/20260602161547.2642155-1-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/ip_options.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index d898e1523a453e..7a60bbf4bee3aa 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c @@ -530,6 +530,10 @@ int ip_options_get(struct net *net, struct ip_options_rcu **optp, kfree(opt); return -EINVAL; } + if (opt->opt.srr && !ns_capable(net->user_ns, CAP_NET_RAW)) { + kfree(opt); + return -EPERM; + } kfree(*optp); *optp = opt; return 0; -- 2.53.0