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 14E01338F39 for ; Wed, 24 Dec 2025 13:08:15 +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=1766581695; cv=none; b=EWzBFIafWDZIJrYG7mG2PqIRSrGL9gqqxTp3oD4CnFQlmmfIm7TrUPWaBATmpe/Q/VVH95J2crJuU7tZYMQ5O1DGrG8KlyNzx8rUSrGne5xKEGa7Mx9Yfowc4KlXj6xNaXAdkzzlQmhu9wx6fRQ4BRHPHSDBrgJNtj1Jlr+zp9Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766581695; c=relaxed/simple; bh=gq7XOajz7omU1AvZLXQGsOp6qTs2mp4HWNQ459PrskQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tfLgu8tHcCilaPR+cy6NNqe4NgLpAlZNV3/aXk9KA9nhMyrKkKSY9altiSbdM19iXnkiEXcY0CgIwcVv2ptPUYSXXFp5zR6VNU9CrWE535932279A8nSVXgdKwDaHLVBSF17Jm0o08fzcjWkNCEgcQ+z4GWwncS7YSMc/R9vZmE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=StWn9I/M; 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="StWn9I/M" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94737C4CEFB; Wed, 24 Dec 2025 13:08:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1766581695; bh=gq7XOajz7omU1AvZLXQGsOp6qTs2mp4HWNQ459PrskQ=; h=From:To:Cc:Subject:Date:Reply-To:From; b=StWn9I/MVtXSZk6o0uquyu3rMRepgKwe7sK00bC8wEKpbB0tQ4KxPQAop3sw4Fww9 3NYc9o6vFaAyjQNC14VqZsnS29NbPAkbvow/Prl0rlZB/c80SCmhjALoVNcGgbNwWF sxdVZB756A0kZk/CEnvinkQIHWAJBDUwrEi6JwmQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50780: net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed Date: Wed, 24 Dec 2025 14:06:31 +0100 Message-ID: <2025122401-CVE-2022-50780-bc90@gregkh> X-Mailer: git-send-email 2.52.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4891; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=vA0HXWdzxM1YvZoZi5eEkgywKRHnt0cKyxxiYqJJCw8=; b=owGbwMvMwCRo6H6F97bub03G02pJDJneTy1lr+lOvN9s5RCyN2auwd4/4rPDpx9SOnblAPf/B Z0HH67m7YhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJ3BJmmO9a4vmJ30b9gcOu 93OK6yy+T96/OJVhQfNL+333nqyrL5J38/j85lt30uy0EgA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed When the ops_init() interface is invoked to initialize the net, but ops->init() fails, data is released. However, the ptr pointer in net->gen is invalid. In this case, when nfqnl_nf_hook_drop() is invoked to release the net, invalid address access occurs. The process is as follows: setup_net() ops_init() data = kzalloc(...) ---> alloc "data" net_assign_generic() ---> assign "date" to ptr in net->gen ... ops->init() ---> failed ... kfree(data); ---> ptr in net->gen is invalid ... ops_exit_list() ... nfqnl_nf_hook_drop() *q = nfnl_queue_pernet(net) ---> q is invalid The following is the Call Trace information: BUG: KASAN: use-after-free in nfqnl_nf_hook_drop+0x264/0x280 Read of size 8 at addr ffff88810396b240 by task ip/15855 Call Trace: dump_stack_lvl+0x8e/0xd1 print_report+0x155/0x454 kasan_report+0xba/0x1f0 nfqnl_nf_hook_drop+0x264/0x280 nf_queue_nf_hook_drop+0x8b/0x1b0 __nf_unregister_net_hook+0x1ae/0x5a0 nf_unregister_net_hooks+0xde/0x130 ops_exit_list+0xb0/0x170 setup_net+0x7ac/0xbd0 copy_net_ns+0x2e6/0x6b0 create_new_namespaces+0x382/0xa50 unshare_nsproxy_namespaces+0xa6/0x1c0 ksys_unshare+0x3a4/0x7e0 __x64_sys_unshare+0x2d/0x40 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Allocated by task 15855: kasan_save_stack+0x1e/0x40 kasan_set_track+0x21/0x30 __kasan_kmalloc+0xa1/0xb0 __kmalloc+0x49/0xb0 ops_init+0xe7/0x410 setup_net+0x5aa/0xbd0 copy_net_ns+0x2e6/0x6b0 create_new_namespaces+0x382/0xa50 unshare_nsproxy_namespaces+0xa6/0x1c0 ksys_unshare+0x3a4/0x7e0 __x64_sys_unshare+0x2d/0x40 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Freed by task 15855: kasan_save_stack+0x1e/0x40 kasan_set_track+0x21/0x30 kasan_save_free_info+0x2a/0x40 ____kasan_slab_free+0x155/0x1b0 slab_free_freelist_hook+0x11b/0x220 __kmem_cache_free+0xa4/0x360 ops_init+0xb9/0x410 setup_net+0x5aa/0xbd0 copy_net_ns+0x2e6/0x6b0 create_new_namespaces+0x382/0xa50 unshare_nsproxy_namespaces+0xa6/0x1c0 ksys_unshare+0x3a4/0x7e0 __x64_sys_unshare+0x2d/0x40 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 The Linux kernel CVE team has assigned CVE-2022-50780 to this issue. Affected and fixed versions =========================== Issue introduced in 2.6.33 with commit f875bae065334907796da12523f9df85c89f5712 and fixed in 4.19.264 with commit 5a2ea549be94924364f6911227d99be86e8cf34a Issue introduced in 2.6.33 with commit f875bae065334907796da12523f9df85c89f5712 and fixed in 5.4.223 with commit 97ad240fd9aa9214497d14af2b91608e20856cac Issue introduced in 2.6.33 with commit f875bae065334907796da12523f9df85c89f5712 and fixed in 5.10.153 with commit c3edc6e808209aa705185f732e682a370981ced1 Issue introduced in 2.6.33 with commit f875bae065334907796da12523f9df85c89f5712 and fixed in 5.15.77 with commit a1e18acb0246bfb001b08b8b1b830b5ec92a0f13 Issue introduced in 2.6.33 with commit f875bae065334907796da12523f9df85c89f5712 and fixed in 6.0.7 with commit 4a4df5e78712de39d6f90d6a64b5eb48dca03bd5 Issue introduced in 2.6.33 with commit f875bae065334907796da12523f9df85c89f5712 and fixed in 6.1 with commit d266935ac43d57586e311a087510fe6a084af742 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-2022-50780 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/core/net_namespace.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/5a2ea549be94924364f6911227d99be86e8cf34a https://git.kernel.org/stable/c/97ad240fd9aa9214497d14af2b91608e20856cac https://git.kernel.org/stable/c/c3edc6e808209aa705185f732e682a370981ced1 https://git.kernel.org/stable/c/a1e18acb0246bfb001b08b8b1b830b5ec92a0f13 https://git.kernel.org/stable/c/4a4df5e78712de39d6f90d6a64b5eb48dca03bd5 https://git.kernel.org/stable/c/d266935ac43d57586e311a087510fe6a084af742