diff --git a/qemu.spec b/qemu.spec index 1293241f4cb531cef00ae3872a74a09f10f6985b..ba4358dbaa1ed7e60c07148e583c16100142d1a8 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,6 +1,6 @@ Name: qemu Version: 6.2.0 -Release: 52 +Release: 53 Epoch: 10 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 @@ -316,6 +316,7 @@ Patch0303: qom-assert-integer-does-not-overflow.patch Patch0304: pci-expose-TYPE_XIO3130_DOWNSTREAM-name.patch Patch0305: acpi-pcihp-pcie-set-power-on-cap-on-parent-slot.patch Patch0306: hw-display-ati_2d-Fix-buffer-overflow-in-ati_2d_blt-.patch +Patch0307: ui-vnc-clipboard-fix-integer-underflow-in-vnc_client.patch BuildRequires: flex BuildRequires: gcc @@ -828,6 +829,9 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Fri Oct 21 2022 yezengruan - 10:6.2.0-53 +- ui/vnc-clipboard: fix integer underflow in vnc_client_cut_text_ext (CVE-2022-3165) + * Fri Sep 30 2022 wanbo - 10:6.2.0-52 - job.c: add missing notifier initialization - uas: add missing return diff --git a/ui-vnc-clipboard-fix-integer-underflow-in-vnc_client.patch b/ui-vnc-clipboard-fix-integer-underflow-in-vnc_client.patch new file mode 100644 index 0000000000000000000000000000000000000000..0fdcda62f03bc1fc1fbf418fc009c9eae5b92161 --- /dev/null +++ b/ui-vnc-clipboard-fix-integer-underflow-in-vnc_client.patch @@ -0,0 +1,55 @@ +From d307040b18bfcb1393b910f1bae753d5c12a4dc7 Mon Sep 17 00:00:00 2001 +From: Mauro Matteo Cascella +Date: Sun, 25 Sep 2022 22:45:11 +0200 +Subject: [PATCH] ui/vnc-clipboard: fix integer underflow in + vnc_client_cut_text_ext + +Extended ClientCutText messages start with a 4-byte header. If len < 4, +an integer underflow occurs in vnc_client_cut_text_ext. The result is +used to decompress data in a while loop in inflate_buffer, leading to +CPU consumption and denial of service. Prevent this by checking dlen in +protocol_client_msg. + +Fixes: CVE-2022-3165 +Fixes: 0bf41cab93e5 ("ui/vnc: clipboard support") +Reported-by: TangPeng +Signed-off-by: Mauro Matteo Cascella +Message-Id: <20220925204511.1103214-1-mcascell@redhat.com> +Signed-off-by: Gerd Hoffmann +--- + ui/vnc.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/ui/vnc.c b/ui/vnc.c +index 6a05d06147..acb3629cd8 100644 +--- a/ui/vnc.c ++++ b/ui/vnc.c +@@ -2442,8 +2442,8 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len) + if (len == 1) { + return 8; + } ++ uint32_t dlen = abs(read_s32(data, 4)); + if (len == 8) { +- uint32_t dlen = abs(read_s32(data, 4)); + if (dlen > (1 << 20)) { + error_report("vnc: client_cut_text msg payload has %u bytes" + " which exceeds our limit of 1MB.", dlen); +@@ -2456,8 +2456,13 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len) + } + + if (read_s32(data, 4) < 0) { +- vnc_client_cut_text_ext(vs, abs(read_s32(data, 4)), +- read_u32(data, 8), data + 12); ++ if (dlen < 4) { ++ error_report("vnc: malformed payload (header less than 4 bytes)" ++ " in extended clipboard pseudo-encoding."); ++ vnc_client_error(vs); ++ break; ++ } ++ vnc_client_cut_text_ext(vs, dlen, read_u32(data, 8), data + 12); + break; + } + vnc_client_cut_text(vs, read_u32(data, 4), data + 8); +-- +2.27.0 +