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 6E9A015ECE3 for ; Fri, 12 Jul 2024 12:32:47 +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=1720787567; cv=none; b=Y2QrZOgLez7lv1qViZ9lsYr768Pdf+luRls/c+ZqdOAU9c1OOgi5RcUEXGybSU1/P2bBn67sSehm3Isgf59T2XOtjTSGo+BOhg+6IMFoISkM6rYsFA1wYune9BKcNucc/MIgxy2xUVUC8QiDGtLqTsdB0PiOrR37hjEC23SYB70= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720787567; c=relaxed/simple; bh=35oHvYFZIrD9VuYTeRjpxoZi2rTN/jKDvRBAg82cp/o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=joYDwISaqDHAB3NXA4vrwaWcF4U3yi8YpzES73fI5hV0DjoPyMJolzSgHbQIlyYW2h48qcqRKKSiTkgHZa7UxMR8/Abi2QyOi4Ut/DooRl5tPc+nJnNTuiBPAo84RQQA8QtgtB7kymWRNrISyO3GyKRmfTgXOQuY2ZhHEd19MH4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=o6G2zeZL; 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="o6G2zeZL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A5CDC32782; Fri, 12 Jul 2024 12:32:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720787567; bh=35oHvYFZIrD9VuYTeRjpxoZi2rTN/jKDvRBAg82cp/o=; h=From:To:Cc:Subject:Date:Reply-to:From; b=o6G2zeZLxo4L/8xH3N18FEZshvYUkQQW1+g68DtJhhux505G6RyGzCoTX+D6xr0+o npExL4hHdjxrlvDHjgw85RxxzIswud4Tun5V/y6kK2G2Rll/ziMlKHPBZB4RVzqUNV SSyIa+YyIpURZxwRikmRsWUy4EMgIK1HkGQk2sZM= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-40957: seg6: fix parameter passing when calling NF_HOOK() in End.DX4 and End.DX6 behaviors Date: Fri, 12 Jul 2024 14:32:33 +0200 Message-ID: <2024071224-CVE-2024-40957-94a5@gregkh> X-Mailer: git-send-email 2.45.2 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=4417; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=35oHvYFZIrD9VuYTeRjpxoZi2rTN/jKDvRBAg82cp/o=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkTlSJMItvuJFRdip7CJTU1/AuPzX19q+g/ssky7FoXG w8zX5raEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABO5zsiw4GzHNNFpyrLmHk2f 66Ijf97U9JGJZFhwNa+ubk2Ds05YZOfi0ICiCv+f09sB 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: seg6: fix parameter passing when calling NF_HOOK() in End.DX4 and End.DX6 behaviors input_action_end_dx4() and input_action_end_dx6() are called NF_HOOK() for PREROUTING hook, in PREROUTING hook, we should passing a valid indev, and a NULL outdev to NF_HOOK(), otherwise may trigger a NULL pointer dereference, as below: [74830.647293] BUG: kernel NULL pointer dereference, address: 0000000000000090 [74830.655633] #PF: supervisor read access in kernel mode [74830.657888] #PF: error_code(0x0000) - not-present page [74830.659500] PGD 0 P4D 0 [74830.660450] Oops: 0000 [#1] PREEMPT SMP PTI ... [74830.664953] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 [74830.666569] RIP: 0010:rpfilter_mt+0x44/0x15e [ipt_rpfilter] ... [74830.689725] Call Trace: [74830.690402] [74830.690953] ? show_trace_log_lvl+0x1c4/0x2df [74830.692020] ? show_trace_log_lvl+0x1c4/0x2df [74830.693095] ? ipt_do_table+0x286/0x710 [ip_tables] [74830.694275] ? __die_body.cold+0x8/0xd [74830.695205] ? page_fault_oops+0xac/0x140 [74830.696244] ? exc_page_fault+0x62/0x150 [74830.697225] ? asm_exc_page_fault+0x22/0x30 [74830.698344] ? rpfilter_mt+0x44/0x15e [ipt_rpfilter] [74830.699540] ipt_do_table+0x286/0x710 [ip_tables] [74830.700758] ? ip6_route_input+0x19d/0x240 [74830.701752] nf_hook_slow+0x3f/0xb0 [74830.702678] input_action_end_dx4+0x19b/0x1e0 [74830.703735] ? input_action_end_t+0xe0/0xe0 [74830.704734] seg6_local_input_core+0x2d/0x60 [74830.705782] lwtunnel_input+0x5b/0xb0 [74830.706690] __netif_receive_skb_one_core+0x63/0xa0 [74830.707825] process_backlog+0x99/0x140 [74830.709538] __napi_poll+0x2c/0x160 [74830.710673] net_rx_action+0x296/0x350 [74830.711860] __do_softirq+0xcb/0x2ac [74830.713049] do_softirq+0x63/0x90 input_action_end_dx4() passing a NULL indev to NF_HOOK(), and finally trigger a NULL dereference in rpfilter_mt()->rpfilter_is_loopback(): static bool rpfilter_is_loopback(const struct sk_buff *skb, const struct net_device *in) { // in is NULL return skb->pkt_type == PACKET_LOOPBACK || in->flags & IFF_LOOPBACK; } The Linux kernel CVE team has assigned CVE-2024-40957 to this issue. Affected and fixed versions =========================== Issue introduced in 5.15 with commit 7a3f5b0de364 and fixed in 5.15.162 with commit af90e3d73dc4 Issue introduced in 5.15 with commit 7a3f5b0de364 and fixed in 6.1.96 with commit ec4d970b597e Issue introduced in 5.15 with commit 7a3f5b0de364 and fixed in 6.6.36 with commit d62df86c1720 Issue introduced in 5.15 with commit 7a3f5b0de364 and fixed in 6.9.7 with commit 561475d53aa7 Issue introduced in 5.15 with commit 7a3f5b0de364 and fixed in 6.10-rc5 with commit 9a3bc8d16e0a Please see https://www.kernel.org for 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-2024-40957 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/ipv6/seg6_local.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/af90e3d73dc45778767b2fb6e7edd57ebe34380d https://git.kernel.org/stable/c/ec4d970b597ee5e17b0d8d73b7875197ce9a04d4 https://git.kernel.org/stable/c/d62df86c172033679d744f07d89e93e367dd11f6 https://git.kernel.org/stable/c/561475d53aa7e4511ee7cdba8728ded81cf1db1c https://git.kernel.org/stable/c/9a3bc8d16e0aacd65c31aaf23a2bced3288a7779