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 30C9223D7D6 for ; Tue, 12 Aug 2025 16:02:50 +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=1755014571; cv=none; b=ZqVXJdK0IQIpmKGt55SWXtMJphMBYZ0yRef+NuE++izBUtN6ZvCh052Z1IA/AP+/95dwXUjtC19oTp9kW/rvATJCnFxayfNO/QzRMqiHERBZodQGt+HFbLWC0XwpCmrPsS4OBb414XsZ/Q7w4Y+GVSxgqRcw9U6D+BnO2dligV8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755014571; c=relaxed/simple; bh=e2Jem63BYzd+xJQ8m5sxuR/vpUYuUEW8V8VT2MKquk8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Bx2MBcqYvKHCZiQzv55nLetXbZ45QrU06EhY3H7TY25izmgk+IT7Jd2Lp9iJOCWJteczplIve69OT2c6jdSUTfgayXvXDDKS7wznAD1bduf65sMpEfAiOsLmMX0QpfaPfemvKZmV8AZWgRs8R5bUjNkcy8OlhfryR8rmnvvx0Vg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZRtEGQoo; 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="ZRtEGQoo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 580EDC4CEF0; Tue, 12 Aug 2025 16:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755014570; bh=e2Jem63BYzd+xJQ8m5sxuR/vpUYuUEW8V8VT2MKquk8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=ZRtEGQoo0ZN4QRMXeJ6Wqh8bKqiIIs0pFSjv/e3NIEcxOn79y88MzSPzNgPshyyVn QP+F7pmU3GWSRvBQA/um2uAEqRwBUX4/8CQvUloCSy7jQhooK4bpwa6cesyEhe0quY k4bhV/a160sIIPWVKA75IvryQ3J9D7FKDub+acQw= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38500: xfrm: interface: fix use-after-free after changing collect_md xfrm interface Date: Tue, 12 Aug 2025 18:02:46 +0200 Message-ID: <2025081245-CVE-2025-38500-7e22@gregkh> X-Mailer: git-send-email 2.50.1 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=5055; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=RhfGpz8A2W0rEzsBR69EmTfAAStO5QdTfGSWSYYTfVU=; b=owGbwMvMwCRo6H6F97bub03G02pJDBmzU5dyXmpx679zZuX3AqmVTQdNLWz2WUbXXJhZniL2a qdyCs+5jlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZiIWTvDfD+DB6rO4RfXvtaq OiNxZPm3eXFXIxlmsx3Y8CX48fZje78eijtjkd7wwnLuCgA= 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: xfrm: interface: fix use-after-free after changing collect_md xfrm interface collect_md property on xfrm interfaces can only be set on device creation, thus xfrmi_changelink() should fail when called on such interfaces. The check to enforce this was done only in the case where the xi was returned from xfrmi_locate() which doesn't look for the collect_md interface, and thus the validation was never reached. Calling changelink would thus errornously place the special interface xi in the xfrmi_net->xfrmi hash, but since it also exists in the xfrmi_net->collect_md_xfrmi pointer it would lead to a double free when the net namespace was taken down [1]. Change the check to use the xi from netdev_priv which is available earlier in the function to prevent changes in xfrm collect_md interfaces. [1] resulting oops: [ 8.516540] kernel BUG at net/core/dev.c:12029! [ 8.516552] Oops: invalid opcode: 0000 [#1] SMP NOPTI [ 8.516559] CPU: 0 UID: 0 PID: 12 Comm: kworker/u80:0 Not tainted 6.15.0-virtme #5 PREEMPT(voluntary) [ 8.516565] Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 8.516569] Workqueue: netns cleanup_net [ 8.516579] RIP: 0010:unregister_netdevice_many_notify+0x101/0xab0 [ 8.516590] Code: 90 0f 0b 90 48 8b b0 78 01 00 00 48 8b 90 80 01 00 00 48 89 56 08 48 89 32 4c 89 80 78 01 00 00 48 89 b8 80 01 00 00 eb ac 90 <0f> 0b 48 8b 45 00 4c 8d a0 88 fe ff ff 48 39 c5 74 5c 41 80 bc 24 [ 8.516593] RSP: 0018:ffffa93b8006bd30 EFLAGS: 00010206 [ 8.516598] RAX: ffff98fe4226e000 RBX: ffffa93b8006bd58 RCX: ffffa93b8006bc60 [ 8.516601] RDX: 0000000000000004 RSI: 0000000000000000 RDI: dead000000000122 [ 8.516603] RBP: ffffa93b8006bdd8 R08: dead000000000100 R09: ffff98fe4133c100 [ 8.516605] R10: 0000000000000000 R11: 00000000000003d2 R12: ffffa93b8006be00 [ 8.516608] R13: ffffffff96c1a510 R14: ffffffff96c1a510 R15: ffffa93b8006be00 [ 8.516615] FS: 0000000000000000(0000) GS:ffff98fee73b7000(0000) knlGS:0000000000000000 [ 8.516619] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 8.516622] CR2: 00007fcd2abd0700 CR3: 000000003aa40000 CR4: 0000000000752ef0 [ 8.516625] PKRU: 55555554 [ 8.516627] Call Trace: [ 8.516632] [ 8.516635] ? rtnl_is_locked+0x15/0x20 [ 8.516641] ? unregister_netdevice_queue+0x29/0xf0 [ 8.516650] ops_undo_list+0x1f2/0x220 [ 8.516659] cleanup_net+0x1ad/0x2e0 [ 8.516664] process_one_work+0x160/0x380 [ 8.516673] worker_thread+0x2aa/0x3c0 [ 8.516679] ? __pfx_worker_thread+0x10/0x10 [ 8.516686] kthread+0xfb/0x200 [ 8.516690] ? __pfx_kthread+0x10/0x10 [ 8.516693] ? __pfx_kthread+0x10/0x10 [ 8.516697] ret_from_fork+0x82/0xf0 [ 8.516705] ? __pfx_kthread+0x10/0x10 [ 8.516709] ret_from_fork_asm+0x1a/0x30 [ 8.516718] The Linux kernel CVE team has assigned CVE-2025-38500 to this issue. Affected and fixed versions =========================== Issue introduced in 6.1 with commit abc340b38ba25cd6c7aa2c0bd9150d30738c82d0 and fixed in 6.6.101 with commit bfebdb85496e1da21d3cf05de099210915c3e706 Issue introduced in 6.1 with commit abc340b38ba25cd6c7aa2c0bd9150d30738c82d0 and fixed in 6.12.41 with commit 5918c3f4800a3aef2173865e5903370f21e24f47 Issue introduced in 6.1 with commit abc340b38ba25cd6c7aa2c0bd9150d30738c82d0 and fixed in 6.15.9 with commit 69a31f7a6a81f5ffd3812c442e09ff0be22960f1 Issue introduced in 6.1 with commit abc340b38ba25cd6c7aa2c0bd9150d30738c82d0 and fixed in 6.16 with commit a90b2a1aaacbcf0f91d7e4868ad6c51c5dee814b 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-2025-38500 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/xfrm/xfrm_interface_core.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/bfebdb85496e1da21d3cf05de099210915c3e706 https://git.kernel.org/stable/c/5918c3f4800a3aef2173865e5903370f21e24f47 https://git.kernel.org/stable/c/69a31f7a6a81f5ffd3812c442e09ff0be22960f1 https://git.kernel.org/stable/c/a90b2a1aaacbcf0f91d7e4868ad6c51c5dee814b