Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A48C9535BB for ; Tue, 27 Feb 2024 06:54:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709016859; cv=none; b=qJ58HRYRz/aUb4V13JdqxgQIA6CJpWKWvMlEsn6brvUEbdE7poPYXnqS6qX013z5tN6VzCWWM955AFhwu9XIZMGAPTfnqTIzPBtQZQucz7yA11oLHj69xmQww/bPhYDOgOtndPboScGp80UN9jYymSnv6Xpsmv5IGdfmwiiodxU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709016859; c=relaxed/simple; bh=ceMUttdCmNOdCFHg1FbZCwusMiVT16NGsXiGu+V82+k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=kfflKDAXyheJkJkwMntO8Dcxb/KJCGiWZKlqPI6dKAjFz8jGT75IfhaDjv+XWN+JQflwBwkO874TxlBnzA2avJhXJOts+pFkMEdRxnO28N39ey8DT2sqx4xwHEINMVnOCdA+3fHXWVuYYgIutCKvVvcu+H79Plri+4WfPZsGoiE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YVIqEDCE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="YVIqEDCE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 199FBC43390; Tue, 27 Feb 2024 06:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709016859; bh=ceMUttdCmNOdCFHg1FbZCwusMiVT16NGsXiGu+V82+k=; h=From:To:Cc:Subject:Date:Reply-to:From; b=YVIqEDCEUxWmSTpJWH2JxJziXlDWS7h8ToRVFhFnh13g9dwXJe0GC8RIIG9Mmgffe ghrs+ANfPB3W51tcABR3chxlbDWJGZKywsNvVFs+1sIaqGJ2k79wJpLjYTgWC4wdCa 8TDtK0ct0WkxW7ltqmZl96VOvkya7sgw0jWuNRTE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-46912: net: Make tcp_allowed_congestion_control readonly in non-init netns Date: Tue, 27 Feb 2024 07:54:09 +0100 Message-ID: <2024022708-CVE-2021-46912-d07b@gregkh> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3265; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ceMUttdCmNOdCFHg1FbZCwusMiVT16NGsXiGu+V82+k=; b=owGbwMvMwCRo6H6F97bub03G02pJDKl32wXkehTvacyL2n5ig5OOUu/WxbWbrEuzdq4+7GO83 +9UqvumjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhIgybDggVaXZzFl7dm77Lp 2+wfWHq0PpOLmWF+kYfVaX3FzRJO2qelVJV3cd057SUCAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: net: Make tcp_allowed_congestion_control readonly in non-init netns Currently, tcp_allowed_congestion_control is global and writable; writing to it in any net namespace will leak into all other net namespaces. tcp_available_congestion_control and tcp_allowed_congestion_control are the only sysctls in ipv4_net_table (the per-netns sysctl table) with a NULL data pointer; their handlers (proc_tcp_available_congestion_control and proc_allowed_congestion_control) have no other way of referencing a struct net. Thus, they operate globally. Because ipv4_net_table does not use designated initializers, there is no easy way to fix up this one "bad" table entry. However, the data pointer updating logic shouldn't be applied to NULL pointers anyway, so we instead force these entries to be read-only. These sysctls used to exist in ipv4_table (init-net only), but they were moved to the per-net ipv4_net_table, presumably without realizing that tcp_allowed_congestion_control was writable and thus introduced a leak. Because the intent of that commit was only to know (i.e. read) "which congestion algorithms are available or allowed", this read-only solution should be sufficient. The logic added in recent commit 31c4d2f160eb: ("net: Ensure net namespace isolation of sysctls") does not and cannot check for NULL data pointers, because other table entries (e.g. /proc/sys/net/netfilter/nf_log/) have .data=NULL but use other methods (.extra2) to access the struct net. The Linux kernel CVE team has assigned CVE-2021-46912 to this issue. Affected and fixed versions =========================== Issue introduced in 5.7 with commit 9cb8e048e5d9 and fixed in 5.10.32 with commit 35d7491e2f77 Issue introduced in 5.7 with commit 9cb8e048e5d9 and fixed in 5.11.16 with commit 1ccdf1bed140 Issue introduced in 5.7 with commit 9cb8e048e5d9 and fixed in 5.12 with commit 97684f0970f6 Please see https://www.kernel.org or a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2021-46912 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: net/ipv4/sysctl_net_ipv4.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/35d7491e2f77ce480097cabcaf93ed409e916e12 https://git.kernel.org/stable/c/1ccdf1bed140820240e383ba0accc474ffc7f006 https://git.kernel.org/stable/c/97684f0970f6e112926de631fdd98d9693c7e5c1