diff options
| author | Soumya Sambu <soumya.sambu@windriver.com> | 2023-10-04 11:05:58 +0000 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2023-10-11 03:54:46 -1000 |
| commit | ae2c4f104b4c5ed5d6e7fc138e34b75c44eb9d96 (patch) | |
| tree | 49aefc111eadbe03091d0a77d523bedf0c09289c | |
| parent | c71b397ea0e5853f4c6de9656af63afc89eead14 (diff) | |
| download | poky-ae2c4f104b4c5ed5d6e7fc138e34b75c44eb9d96.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
(From OE-Core rev: 2038b5e977481cac2e9e35101a467fbd5268231e)
Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-devtools/qemu/qemu.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch | 52 |
2 files changed, 53 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc index c8e1d28654..cd17a11335 100644 --- a/meta/recipes-devtools/qemu/qemu.inc +++ b/meta/recipes-devtools/qemu/qemu.inc | |||
| @@ -41,6 +41,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ | |||
| 41 | file://CVE-2023-3255.patch \ | 41 | file://CVE-2023-3255.patch \ |
| 42 | file://CVE-2023-2861.patch \ | 42 | file://CVE-2023-2861.patch \ |
| 43 | file://CVE-2023-3354.patch \ | 43 | file://CVE-2023-3354.patch \ |
| 44 | file://CVE-2023-3180.patch \ | ||
| 44 | " | 45 | " |
| 45 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" | 46 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" |
| 46 | 47 | ||
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..cd9f85fd43 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | From 9d38a8434721a6479fe03fb5afb150ca793d3980 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: zhenwei pi <pizhenwei@bytedance.com> | ||
| 3 | Date: Thu, 3 Aug 2023 10:43:13 +0800 | ||
| 4 | Subject: [PATCH] virtio-crypto: verify src&dst buffer length for sym request | ||
| 5 | |||
| 6 | For symmetric algorithms, the length of ciphertext must be as same | ||
| 7 | as the plaintext. | ||
| 8 | The missing verification of the src_len and the dst_len in | ||
| 9 | virtio_crypto_sym_op_helper() may lead buffer overflow/divulged. | ||
| 10 | |||
| 11 | This patch is originally written by Yiming Tao for QEMU-SECURITY, | ||
| 12 | resend it(a few changes of error message) in qemu-devel. | ||
| 13 | |||
| 14 | Fixes: CVE-2023-3180 | ||
| 15 | Fixes: 04b9b37e | ||
| 16 | |||
| 17 | ("virtio-crypto: add data queue processing handler") | ||
| 18 | Cc: Gonglei <arei.gonglei@huawei.com> | ||
| 19 | Cc: Mauro Matteo Cascella <mcascell@redhat.com> | ||
| 20 | Cc: Yiming Tao <taoym@zju.edu.cn> | ||
| 21 | Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> | ||
| 22 | Message-Id: <20230803024314.29962-2-pizhenwei@bytedance.com> | ||
| 23 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
| 24 | Signed-off-by: Michael S. Tsirkin <mst@redhat.com> | ||
| 25 | |||
| 26 | CVE: CVE-2023-3180 | ||
| 27 | |||
| 28 | Upstream-Status: Backport from [https://gitlab.com/qemu-project/qemu/-/commit/9d38a8434721a6479fe03fb5afb150ca793d3980] | ||
| 29 | |||
| 30 | Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com> | ||
| 31 | --- | ||
| 32 | hw/virtio/virtio-crypto.c | 5 +++++ | ||
| 33 | 1 file changed, 5 insertions(+) | ||
| 34 | |||
| 35 | diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c | ||
| 36 | index 97da74e71..fdb592861 100644 | ||
| 37 | --- a/hw/virtio/virtio-crypto.c | ||
| 38 | +++ b/hw/virtio/virtio-crypto.c | ||
| 39 | @@ -633,6 +633,11 @@ virtio_crypto_sym_op_helper(VirtIODevice *vdev, | ||
| 40 | return NULL; | ||
| 41 | } | ||
| 42 | |||
| 43 | + if (unlikely(src_len != dst_len)) { | ||
| 44 | + virtio_error(vdev, "sym request src len is different from dst len"); | ||
| 45 | + return NULL; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | max_len = (uint64_t)iv_len + aad_len + src_len + dst_len + hash_result_len; | ||
| 49 | if (unlikely(max_len > vcrypto->conf.max_size)) { | ||
| 50 | virtio_error(vdev, "virtio-crypto too big length"); | ||
| 51 | -- | ||
| 52 | 2.40.0 | ||
