From nobody Wed Sep 4 20:29:43 2024 X-Original-To: dev-commits-src-all@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 4WzYy01svbz5VKmk; Wed, 04 Sep 2024 20:29:44 +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 4WzYy0050pz4JN1; Wed, 4 Sep 2024 20:29:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725481784; 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=spL0jfSXwuLInZO2wiAJZlkrrKUZYkvwV1G/M8b1ElQ=; b=YoyZePkU2EdhHwmIjAoXf4qpimknWa95OsQ4uYh2U/WoSxRMj+iUOYV59iUTw2QLL61Gym vliNlllqWaXhak5eA3/mhY9kbA1wO9oS4IQxThf59AQuqttORA0UNj7IYVHXUxrWRvfQ/L LGXjmBzEFxJjKZpB25hP7Pgu0ugE4TuR+3eYN/1T1TIFysEQifyvhuxVGxvhvyvYgT/0+X H+QNpHlSA3fn1l9fhzKa5DDptNiz3AFeyFqkAOyn7eh+o/JHLfB3rtRghH3aB59kajHUpc 91EqGbBLNUhowG/iN77xLDNd8GNvdEzc3TvMqL6wC0hYKdtUVwSeboWLLoaD/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725481784; a=rsa-sha256; cv=none; b=srHNHGeV+5Ia33moQ3j8SJwWruuW5dCiq6+hqFb6igGrsRkZkSuTMB9gNpa15iEGLiVR3q lQzcaChikdtg1G3hnlNM09cXbapGmoj7WRy6bX65LWGOPXnAd3aeu4f+FYqHhaZ//9qKqk 6zAAsFL1nmnedoNaVLsQw91KrQVXKGCdc/eyfKb/W6JaoZsLH+r36M6jEU902ENOINJnEz NNmU/kFxyLwOfwfK1Nm5sQPLKsb85ic0hlNUiBLzIzH/PaFEBt8XF2Jj4SjGqyfBwuIOgq eeEtii32dR+p2Wyxkvz1wDZmrkWfnz5TkGwdAjLmvtHa1YoZ6DNi4fxQYRBPxw== 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=1725481784; 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=spL0jfSXwuLInZO2wiAJZlkrrKUZYkvwV1G/M8b1ElQ=; b=EgIlgJdsuOrkVaCTZpMTFzCUH6sEetOXah2eM37EDx9WiPsWjaGJ8YACveqaDaOeD4O/Vt tXPn6ah4q8AhsvcnE2UhlTU+cCGc2vI1yfQXIGCvClNYRtvcf28qCkaEIuGJkhNA92YrGw zolOGzLPhGZCUMdhx4EUsr7BggEtMCWBjOc1YLluomB9hW5pUDtOXoxa823nm186uH3buZ 1jEh1cNYGZnxFcD9fc5J3099l4LMmrQnFlj+zKPRv9vRhtteH1zoztxuCNHPpchmbjweF+ uB2RBqJRNOEf2JUJEIfIjiSChSIya6MPYneF/9tIvmqvvf5BQlNZi6FZwe/mfw== 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 4WzYxz6k3tzfgl; Wed, 4 Sep 2024 20:29:43 +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 484KTh6P082641; Wed, 4 Sep 2024 20:29:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484KThhD082638; Wed, 4 Sep 2024 20:29:43 GMT (envelope-from git) Date: Wed, 4 Sep 2024 20:29:43 GMT Message-Id: <202409042029.484KThhD082638@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: f368a02e1013 - releng/13.3 - ctl: fix Out-Of-Bounds access in ctl_report_supported_opcodes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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.3 X-Git-Reftype: branch X-Git-Commit: f368a02e1013b0d669f77d5a606ef76468b903a1 Auto-Submitted: auto-generated The branch releng/13.3 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f368a02e1013b0d669f77d5a606ef76468b903a1 commit f368a02e1013b0d669f77d5a606ef76468b903a1 Author: Pierre Pronchery AuthorDate: 2024-09-04 14:38:12 +0000 Commit: Ed Maste CommitDate: 2024-09-04 20:29:13 +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 --- 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 6fbe6bc5a484..5d4dbd295f20 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,