summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorArchana Polampalli <archana.polampalli@windriver.com>2023-08-14 07:42:27 +0000
committerSteve Sakoman <steve@sakoman.com>2023-08-19 05:56:58 -1000
commit0ffefc4b62d7f863885cecb6b1d7b54b42852255 (patch)
tree0b5ce8857f3218999bb881d26d51c787f4870e62 /meta/recipes-devtools
parentef8a18fd3b9a766ddf541b38832f11db95aee014 (diff)
downloadpoky-0ffefc4b62d7f863885cecb6b1d7b54b42852255.tar.gz
qemu: fix CVE-2023-3180
A flaw was found in the QEMU virtual crypto device while handling data encryption/decryption requests in virtio_crypto_handle_sym_req. There is no check for the value of `src_len` and `dst_len` in virtio_crypto_sym_op_helper, potentially leading to a heap buffer overflow when the two values differ. References: https://nvd.nist.gov/vuln/detail/CVE-2023-3180 Upstream patches: https://gitlab.com/qemu-project/qemu/-/commit/49f1e02bac166821c712534aaa775f50e1afe17f (From OE-Core rev: de421cab92c49ba0f068eae9d6b458a0368fcd03) Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/qemu/qemu.inc1
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch50
2 files changed, 51 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 3347a99e19..d77c376bb6 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -99,6 +99,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
99 file://CVE-2023-2861.patch \ 99 file://CVE-2023-2861.patch \
100 file://CVE-2020-14394.patch \ 100 file://CVE-2020-14394.patch \
101 file://CVE-2023-3354.patch \ 101 file://CVE-2023-3354.patch \
102 file://CVE-2023-3180.patch \
102 " 103 "
103UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" 104UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
104 105
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch b/meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch
new file mode 100644
index 0000000000..30080924c8
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch
@@ -0,0 +1,50 @@
1From 49f1e02bac166821c712534aaa775f50e1afe17f Mon Sep 17 00:00:00 2001
2From: zhenwei pi <pizhenwei@bytedance.com>
3Date: Thu, 3 Aug 2023 10:43:13 +0800
4Subject: [PATCH] virtio-crypto: verify src&dst buffer length for sym request
5
6For symmetric algorithms, the length of ciphertext must be as same
7as the plaintext.
8The missing verification of the src_len and the dst_len in
9virtio_crypto_sym_op_helper() may lead buffer overflow/divulged.
10
11This patch is originally written by Yiming Tao for QEMU-SECURITY,
12resend it(a few changes of error message) in qemu-devel.
13
14Fixes: CVE-2023-3180
15Fixes: 04b9b37edda("virtio-crypto: add data queue processing handler")
16Cc: Gonglei <arei.gonglei@huawei.com>
17Cc: Mauro Matteo Cascella <mcascell@redhat.com>
18Cc: Yiming Tao <taoym@zju.edu.cn>
19Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
20Message-Id: <20230803024314.29962-2-pizhenwei@bytedance.com>
21Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
22Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
23(cherry picked from commit 9d38a8434721a6479fe03fb5afb150ca793d3980)
24Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
25
26Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/49f1e02bac166821c712534aaa775f50e1afe17f]
27CVE: CVE-2023-3180
28Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
29---
30 hw/virtio/virtio-crypto.c | 5 +++++
31 1 file changed, 5 insertions(+)
32
33diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
34index a1d122b9aa..ccaa704530 100644
35--- a/hw/virtio/virtio-crypto.c
36+++ b/hw/virtio/virtio-crypto.c
37@@ -635,6 +635,11 @@ virtio_crypto_sym_op_helper(VirtIODevice *vdev,
38 return NULL;
39 }
40
41+ if (unlikely(src_len != dst_len)) {
42+ virtio_error(vdev, "sym request src len is different from dst len");
43+ return NULL;
44+ }
45+
46 max_len = (uint64_t)iv_len + aad_len + src_len + dst_len + hash_result_len;
47 if (unlikely(max_len > vcrypto->conf.max_size)) {
48 virtio_error(vdev, "virtio-crypto too big length");
49--
502.40.0