Bug 1902651 (CVE-2020-27821)

Summary: CVE-2020-27821 QEMU: heap buffer overflow in msix_table_mmio_write() in hw/pci/msix.c
Product: [Other] Security Response Reporter: Mauro Matteo Cascella <mcascell>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: berrange, cfergeau, dbecker, itamar, jen, jferlan, jforbes, jjoyce, jmaloy, jschluet, knoel, lhh, lpeer, m.a.young, mburns, mkenneth, mrezanin, mst, ondrejj, pbonzini, philmd, ribarry, rjones, robinlee.sysu, sclewis, security-response-team, slinaber, virt-maint, virt-maint
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: qemu 5.2.0 Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the memory management API of QEMU during the initialization of a memory region cache. This issue could lead to an out-of-bounds write access to the MSI-X table while performing MMIO operations. A guest user may abuse this flaw to crash the QEMU process on the host, resulting in a denial of service.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 14:37:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1904126, 1904392, 1904393, 1904394, 1910660    
Bug Blocks: 1900717    

Description Mauro Matteo Cascella 2020-11-30 09:43:37 UTC
A heap buffer overflow was found in the Message Signaled Interrupt (MSI-X) device support of QEMU. The overflow could occur due to an out-of-bounds write of the MSIX table while performing MSI-X mmio operations in msix_table_mmio_write(). A guest user may exploit this flaw to crash the QEMU process on the host, resulting in a denial of service condition.

Upstream fix:
https://git.qemu.org/?p=qemu.git;a=commit;h=4bfb024bc76973d40a359476dc0291f46e435442

Comment 1 Mauro Matteo Cascella 2020-12-03 15:11:13 UTC
Acknowledgments:

Name: Alexander Bulekov

Comment 2 Mauro Matteo Cascella 2020-12-03 15:45:13 UTC
Created qemu tracking bugs for this issue:

Affects: fedora-all [bug 1904126]

Comment 4 Mauro Matteo Cascella 2020-12-04 08:51:28 UTC
In reply to comment #0:
> A heap buffer overflow was found in the Message Signaled Interrupt (MSI-X)
> device support of QEMU. The overflow could occur due to an out-of-bounds
> write of the MSIX table while performing MSI-X mmio operations in
> msix_table_mmio_write(). A guest user may exploit this flaw to crash the
> QEMU process on the host, resulting in a denial of service condition.

The root cause of this flaw is an error in the memory management API of QEMU during the initialization of a memory region cache. Specifically, the address_space_cache_init() function in softmmu/physmem.c did not properly compute the length field 'cache->len'. This could lead to subsequent out-of-bounds accesses to the cached memory region section (e.g., MSI-X table).

Comment 7 Mauro Matteo Cascella 2020-12-04 10:31:15 UTC
Statement:

This flaw did not affect the versions of `qemu-kvm` as shipped with Red Hat Enterprise Linux 6 and 7, as they did not include support for the MemoryRegionCache structure.

Comment 9 Mauro Matteo Cascella 2020-12-17 08:18:53 UTC
External References:

https://www.openwall.com/lists/oss-security/2020/12/16/6

Comment 12 Product Security DevOps Team 2021-05-18 14:37:12 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2020-27821

Comment 13 errata-xmlrpc 2021-05-18 14:51:35 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:1762 https://access.redhat.com/errata/RHSA-2021:1762