CVE-2022-2962: High severity qemu vulnerability
A DMA reentrancy issue was found in the Tulip device emulation in QEMU. When Tulip reads or writes to the rx/tx descriptor or copies the rx/tx frame, it doesn't check whether the destination address is its own MMIO address. This can cause the device to trigger MMIO handlers multiple times, possibly leading to a stack or heap overflow. A malicious guest could use this flaw to crash the QEMU process on the host, resulting in a denial of service condition.
Other sources
When tulip reads or writes to the rx/tx descriptor or copies the rx/tx frame, it doesn't check whether the destination address is its own MMIO address. So crafted content can cause the device to trigger MMIO handlers again to modify some global variables and cause stack or heap overflow.
-- [ QEMU command line:
./qemu-system-x8664 -machine type=q35,accel=qtest -nodefaults -device tulip -qtest stdio -nographic
-- [ POC:
outl 0xcf8 0x80000804 / PCICMD—PCI Command Register / outl 0xcfc 0x107 / Enables accesses/ outl 0xcf8 0x80000814 / Memory Bar 1/ outl 0xcfc 0xfebf1000 / Set MMIO Address to 0xfebf1000/ writel 0xfebf1000 0 / tulipreset / writel 0xfebf1030 0x2001 / set csr6 flags CSR6ST|CSR6SR / writel 0xfebf1020 0xfebf1008 / set currenttxdesc to its MMIO address,and trigger tulipdescwrite /
-- [ Analysis
(1) setting s->currentrxdesc to tulip MMIO address + CSR(1). (2) Then tulipxmitlistupdate was executed, and tulipdescwrite wrote a descriptor to its MMIO address+CSR(1). (3) Tulipxmitlistupdate was called again. Then,(2)(3) was executed thousands of times until the stack overflowed.
I found that the same problem could occur in tulipreceive (it can be called by mmio write) and may cause heap overflow: (1) In tulipcopyrxbytes set s->currentrxdesc to its mmio address + CSR(1) via pcidmawrite, then s->rxframelen is set to 0. (2) When tulipdescwrite executes, another tulipreceive is called, s->rxframelen can be set to a big value. (3) But the first tulipreceive does not end,and s->rxframelen is bigger than s->rxframesize, so tulipcopyrxbytes causes heap overflow.
-- [ Reporter Siqi Chen (Shanghai Jiaotong University)
— Red Hat
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the vulnerability ID?
The vulnerability ID is CVE-2022-2962.
What is the severity of CVE-2022-2962?
The severity of CVE-2022-2962 is high with a CVSS score of 7.8.
What is the affected software?
The affected software includes QEMU versions 1:7.0+dfsg-7ubuntu2.1, 7.2.0, and versions between 4.2.0 and 7.1.0, as well as various Debian versions.
How does the vulnerability in Tulip device emulation in QEMU manifest?
The vulnerability in Tulip device emulation in QEMU allows the device to trigger MMIO handlers multiple times, potentially leading to arbitrary code execution or denial of service.
Are there any references for more information about CVE-2022-2962?
Yes, you can find more information about CVE-2022-2962 at the following references: [Link 1](https://gitlab.com/qemu-project/qemu/-/commit/36a894aeb64a2e02871016da1c37d4a4ca109182), [Link 2](https://gitlab.com/qemu-project/qemu/-/issues/1171), [Link 3](https://launchpad.net/bugs/cve/CVE-2022-2962).