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 698DF199EB9 for ; Tue, 16 Jul 2024 12:29:04 +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=1721132944; cv=none; b=j0nDFEEDt1z/NRAGmSM+yf++N4qzcpCDC6uhDHa4gIw2Re+gnZBM5pa60mzfy5VFquY+3wIVmPwVlBkSDdvF688rIsbNVgGRJt1yo7l42f25CCVSc33KozgOdq/0owRD1uDaa7Y/dlLmCYniCId67ZjQkoLXc/tyUmdyOPGchds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721132944; c=relaxed/simple; bh=Qtt4UJN8P4+4c7hMazTg8z+66lNKjEBUAlOF/eJa5cI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=sNfvCvtNnnqSrLYpRNAKFwZtx+r7HN/QlkqSWCzRd1HSEoQsCTBdM5m4DPgM9ZhZcTc+iPbN/m2sqBaeqr3FeiIXV5cI205Eim7nB/W+7Ky69SwEwAGhiqMfVV885KkarKtSFWSvpkGHFpBqDmctjWgaxSi5BgZKCPBAGaem+7Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=l3O5QDPk; 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="l3O5QDPk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1E22C4AF0C; Tue, 16 Jul 2024 12:29:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1721132944; bh=Qtt4UJN8P4+4c7hMazTg8z+66lNKjEBUAlOF/eJa5cI=; h=From:To:Cc:Subject:Date:Reply-to:From; b=l3O5QDPkKYm2Ct/KRK4pwHoVoaAwy+DaH7b3DZc5W5DKUicCMslVLSXVKThh2UiJ4 e7H9YnVTnOSWqnICfp+kW+XuWFuJpg+U8q/GeB+uUKsl1YKybC/QqJ9dyGbWGjvkjj aAF5JcfY8ZXJgbuuy1q0O4RmomGAuhx817yJ2kLs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-48839: net/packet: fix slab-out-of-bounds access in packet_recvmsg() Date: Tue, 16 Jul 2024 14:27:24 +0200 Message-ID: <2024071621-CVE-2022-48839-09f9@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=5851; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Qtt4UJN8P4+4c7hMazTg8z+66lNKjEBUAlOF/eJa5cI=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnT0jXZ01+F7Dpp4p+qcUb2+gGvokNlnHbTFv0+/2a9z c+bRv7LOmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAi3UwMCy5u3WoayH977V+N rs+Xi+ekWVX4FjAsWL5gv6v24plvrdiSy/J2nXJucm+6CAA= 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/packet: fix slab-out-of-bounds access in packet_recvmsg() syzbot found that when an AF_PACKET socket is using PACKET_COPY_THRESH and mmap operations, tpacket_rcv() is queueing skbs with garbage in skb->cb[], triggering a too big copy [1] Presumably, users of af_packet using mmap() already gets correct metadata from the mapped buffer, we can simply make sure to clear 12 bytes that might be copied to user space later. BUG: KASAN: stack-out-of-bounds in memcpy include/linux/fortify-string.h:225 [inline] BUG: KASAN: stack-out-of-bounds in packet_recvmsg+0x56c/0x1150 net/packet/af_packet.c:3489 Write of size 165 at addr ffffc9000385fb78 by task syz-executor233/3631 CPU: 0 PID: 3631 Comm: syz-executor233 Not tainted 5.17.0-rc7-syzkaller-02396-g0b3660695e80 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xf/0x336 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 memcpy+0x39/0x60 mm/kasan/shadow.c:66 memcpy include/linux/fortify-string.h:225 [inline] packet_recvmsg+0x56c/0x1150 net/packet/af_packet.c:3489 sock_recvmsg_nosec net/socket.c:948 [inline] sock_recvmsg net/socket.c:966 [inline] sock_recvmsg net/socket.c:962 [inline] ____sys_recvmsg+0x2c4/0x600 net/socket.c:2632 ___sys_recvmsg+0x127/0x200 net/socket.c:2674 __sys_recvmsg+0xe2/0x1a0 net/socket.c:2704 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fdfd5954c29 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 15 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffcf8e71e48 EFLAGS: 00000246 ORIG_RAX: 000000000000002f RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fdfd5954c29 RDX: 0000000000000000 RSI: 0000000020000500 RDI: 0000000000000005 RBP: 0000000000000000 R08: 000000000000000d R09: 000000000000000d R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffcf8e71e60 R13: 00000000000f4240 R14: 000000000000c1ff R15: 00007ffcf8e71e54 addr ffffc9000385fb78 is located in stack of task syz-executor233/3631 at offset 32 in frame: ____sys_recvmsg+0x0/0x600 include/linux/uio.h:246 this frame has 1 object: [32, 160) 'addr' Memory state around the buggy address: ffffc9000385fa80: 00 04 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 ffffc9000385fb00: 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 >ffffc9000385fb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f3 ^ ffffc9000385fc00: f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 f1 ffffc9000385fc80: f1 f1 f1 00 f2 f2 f2 00 f2 f2 f2 00 00 00 00 00 ================================================================== The Linux kernel CVE team has assigned CVE-2022-48839 to this issue. Affected and fixed versions =========================== Issue introduced in 2.6.14 with commit 0fb375fb9b93 and fixed in 4.9.308 with commit b9d5772d60f8 Issue introduced in 2.6.14 with commit 0fb375fb9b93 and fixed in 4.14.273 with commit b1e27cda1e3c Issue introduced in 2.6.14 with commit 0fb375fb9b93 and fixed in 4.19.236 with commit a33dd1e6693f Issue introduced in 2.6.14 with commit 0fb375fb9b93 and fixed in 5.4.187 with commit 268dcf1f7b31 Issue introduced in 2.6.14 with commit 0fb375fb9b93 and fixed in 5.10.108 with commit 70b7b3c055fd Issue introduced in 2.6.14 with commit 0fb375fb9b93 and fixed in 5.15.31 with commit a055f5f2841f Issue introduced in 2.6.14 with commit 0fb375fb9b93 and fixed in 5.16.17 with commit ef591b351760 Issue introduced in 2.6.14 with commit 0fb375fb9b93 and fixed in 5.17 with commit c700525fcc06 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-48839 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/packet/af_packet.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/b9d5772d60f8e7ef34e290f72fc20e3a4883e7d0 https://git.kernel.org/stable/c/b1e27cda1e3c12b705875bb7e247a97168580e33 https://git.kernel.org/stable/c/a33dd1e6693f80d805155b3f69c18c2f642915da https://git.kernel.org/stable/c/268dcf1f7b3193bc446ec3d14e08a240e9561e4d https://git.kernel.org/stable/c/70b7b3c055fd4a464da8da55ff4c1f84269f9b02 https://git.kernel.org/stable/c/a055f5f2841f7522b44a2b1eccb1951b4b03d51a https://git.kernel.org/stable/c/ef591b35176029fdefea38e8388ffa371e18f4b2 https://git.kernel.org/stable/c/c700525fcc06b05adfea78039de02628af79e07a