From nobody Wed Sep 04 19:58:25 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WzYFs3tFwz5VHKC; Wed, 04 Sep 2024 19:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WzYFs1q8Lz49V2; Wed, 4 Sep 2024 19:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725479905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FC7dnVFVX++2h1OBflhHeBd6JDrh+bwp0g4YJjTz/iU=; b=UPzNPbHwFAKy37OPpglBKsSSTnB8bB96BPmfPhxNIHO9xxX6Iihk2RfSgGvV28fFrUexf/ /wznhGYTBmUJ5PC4Nnm0gACxasLCaiwvRAz+h97iPXR6jm5h09hOjiZI3INoj2pLR/SEbo 0i6ysO5Xc5JZZqkbWsSth6CY5F6iaIHZuT1/sIbRrQgFZKqawV7VQQukwccz9+RkxsPjC9 uUz0JgVETsvpHNchO4BpQFiL2USMMyz64TatkmFZ4B2LwSmvSAW93rblxXXL0Szmye/sDC 0CSeV1lSeUMdGYZJW6lC8vDldBscjYUsy27lRGqpF0pIh37iWc5J8c+Eh6AEpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725479905; a=rsa-sha256; cv=none; b=oYGgdlvwBcwStuJpAlrYmrjNDHNHG1XwVeJ6FXc1Dn+/5Dd7M1pLEKr+SiyfhbQ7aqAJbz HNmxS2PY/IOtwtsREdNYkqsjOyoyaChmvXRTiyaYmY+kmVn+ikQ1a/aTRO26p6fC2NCob1 UeMk44QT5VimDmG1BUNEdhCx/tfQH3BkDfzvvKw3G3FbY3FBL8Tubwr9930Vge4fWvnBvT McmK63DI+n5P5NdxAzEnGMvPaRRevhT/h/ZRqyB8s3zN2co+ujvbYgINA9m8rz61IZmPB6 fj8teNpse5dd1zPBU3nBdMKDuxorNSyDQVVTHrzdo0FzNET2ndw0Fg/95e9kpQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725479905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FC7dnVFVX++2h1OBflhHeBd6JDrh+bwp0g4YJjTz/iU=; b=XfXfiKtpSz8VSYzOi3XyUiDDARvrZMAUtcePe0yIGfHXdbGWps7y0AMoeKdkNiby0p4b6g vtWDdY2vCP7xS07V+YE1y9jcvLmk7BL/nn3cJhHopqYdc/oDOm7QuPeBeb6KMhPsnzjNYt 4asi/lUF20/IPdiQmBSZqdy3HYY4COe0PgPxckO9M9901BPV7lSEQp4DBohGEB0X/IWMXv QBXCtpnwuOj48RBkXBQKDG5hY62hJP8CWq03Mu11vfMGRtVatN4WFolehv+vierYSqq7Pi gWxg0PNLBZcPw0baUHAVovfIHDXx2vhxGcfPSDYtZO8gDOnMx4aExg0JRckIEQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WzYFs1P8vzf5H; Wed, 4 Sep 2024 19:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 484JwPLU030043; Wed, 4 Sep 2024 19:58:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484JwP6C030040; Wed, 4 Sep 2024 19:58:25 GMT (envelope-from git) Date: Wed, 4 Sep 2024 19:58:25 GMT Message-Id: <202409041958.484JwP6C030040@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 004298792002 - releng/13.4 - ctl: fix Out-Of-Bounds access in ctl_report_supported_opcodes List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.4 X-Git-Reftype: branch X-Git-Commit: 00429879200207bf2d9a3fbabda3bd7d388cc891 Auto-Submitted: auto-generated The branch releng/13.4 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=00429879200207bf2d9a3fbabda3bd7d388cc891 commit 00429879200207bf2d9a3fbabda3bd7d388cc891 Author: Pierre Pronchery AuthorDate: 2024-09-04 14:38:12 +0000 Commit: Ed Maste CommitDate: 2024-09-04 19:14:25 +0000 ctl: fix Out-Of-Bounds access in ctl_report_supported_opcodes This vulnerability is directly accessible to a guest VM through the pci_virtio_scsi bhyve device. In the function ctl_report_supported_opcodes() accessible from the VM, the option RSO_OPTIONS_OC_ASA does not check the requested service_action value before accessing &ctl_cmd_table[]. Reported by: Synacktiv Reviewed by: asomers Security: FreeBSD-SA-24:11.ctl Security: CVE-2024-42416 Security: HYP-06 Sponsored by: The Alpha-Omega Project Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46027 (cherry picked from commit af438acbfde3d25dbdc82b2b3d72380f0191e9d9) (cherry picked from commit 803e0c2ab29bb6b715c38e82da4930d46590e8e0) (cherry picked from commit c8afc072690fd7541159cfe76c544797a5b37bce) Approved by: so Approved by: re (cperciva) --- sys/cam/ctl/ctl.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index f9fec62249cb..b0f34cafac80 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -7513,20 +7513,19 @@ ctl_report_supported_opcodes(struct ctl_scsiio *ctsio) case RSO_OPTIONS_OC_SA: if ((ctl_cmd_table[opcode].flags & CTL_CMD_FLAG_SA5) == 0 || service_action >= 32) { - ctl_set_invalid_field(/*ctsio*/ ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 2, - /*bit_valid*/ 1, - /*bit*/ 2); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); + goto invalid; } - /* FALLTHROUGH */ + total_len = sizeof(struct scsi_report_supported_opcodes_one) + 32; + break; case RSO_OPTIONS_OC_ASA: + if ((ctl_cmd_table[opcode].flags & CTL_CMD_FLAG_SA5) != 0 && + service_action >= 32) { + goto invalid; + } total_len = sizeof(struct scsi_report_supported_opcodes_one) + 32; break; default: +invalid: ctl_set_invalid_field(/*ctsio*/ ctsio, /*sks_valid*/ 1, /*command*/ 1,