Bug 1187539 - (CVE-2021-3607) VUL-1: CVE-2021-3607: qemu: pvrdma: unchecked malloc size due to integer overflow in init_dev_ring()
(CVE-2021-3607)
VUL-1: CVE-2021-3607: qemu: pvrdma: unchecked malloc size due to integer over...
Status: RESOLVED FIXED
Classification: Novell Products
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents
unspecified
Other Other
: P4 - Low : Minor
: ---
Assigned To: Security Team bot
Security Team bot
https://smash.suse.de/issue/302501/
CVSSv3.1:SUSE:CVE-2021-3607:3.2:(AV:L...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-06-21 09:34 UTC by Gianluca Gabrielli
Modified: 2021-08-26 19:17 UTC (History)
2 users (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gianluca Gabrielli 2021-06-21 09:34:21 UTC
An integer overflow was found in the QEMU implementation of VMWare's paravirtual RDMA device. It could occur while handling a "PVRDMA_REG_DSRHIGH" write from the guest due to improper input validation. More specifically, the init_dev_ring() function in pvrdma_main.c does not validate the guest supplied 'num_pages' which is subsequently decremented and used in pvrdma_ring_init() to allocate dynamic memory via g_malloc(). This could result in a NULL pointer dereference issue (if g_malloc returns NULL) or allocation of large amount of memory and out-of-bounds read access. A privileged guest user could exploit this flaw to crash the QEMU process on the host, resulting in a denial of service condition.

static int init_dev_ring(..., uint32_t num_pages) {
  ...
  rc = pvrdma_ring_init(..., (dma_addr_t)num_pages - 1); // guest may provide num_pages = 0
  ...
}

int pvrdma_ring_init(..., uint32_t npages) {
  ...
  ring->pages = g_malloc(npages * sizeof(void *)); // npages may be -1 here
  for (i = 0; i < npages; i++) {
    ...
    ring->pages[i] = rdma_pci_dma_map(dev, tbl[i], TARGET_PAGE_SIZE);
  ...
}

References:
https://bugzilla.redhat.com/show_bug.cgi?id=1973349
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-3607
Comment 1 Gianluca Gabrielli 2021-06-21 09:34:39 UTC
The PVRDMA support is only present in the following packages, but before start to analyze the code I'd like to ask to the qemu maintainers if we do compile the PVRDMA support in qemu. If not, I can easily flag this as not affecting us.

 - SUSE:SLE-12-SP5:Update/qemu     3.1.1.1
 - SUSE:SLE-15-SP1:Update/qemu     3.1.1.1
 - SUSE:SLE-15-SP2:Update/qemu     4.2.1
 - SUSE:SLE-15-SP3:Update/qemu     5.2.0
Comment 2 Gianluca Gabrielli 2021-07-01 06:35:37 UTC
The upstream patch [0] would easily apply to the following packages:
 - SUSE:SLE-15-SP2:Update/qemu     4.2.1
 - SUSE:SLE-15-SP3:Update/qemu     5.2.0

While it requires a small change for the following, still vulnerable, packages:
 - SUSE:SLE-12-SP5:Update/qemu     3.1.1.1
 - SUSE:SLE-15-SP1:Update/qemu     3.1.1.1

[0] https://lists.gnu.org/archive/html/qemu-devel/2021-06/msg07926.html
Comment 3 Gianluca Gabrielli 2021-07-01 06:36:56 UTC
(In reply to Gianluca Gabrielli from comment #2)
> 
> [0] https://lists.gnu.org/archive/html/qemu-devel/2021-06/msg07926.html
>

I pasted the wrong URL for the patch, please use the following one:

https://lists.gnu.org/archive/html/qemu-devel/2021-06/msg07925.html
Comment 5 Swamp Workflow Management 2021-07-21 16:19:19 UTC
SUSE-SU-2021:2442-1: An update that fixes four vulnerabilities is now available.

Category: security (important)
Bug References: 1187499,1187529,1187538,1187539
CVE References: CVE-2021-3582,CVE-2021-3607,CVE-2021-3608,CVE-2021-3611
JIRA References: 
Sources used:
SUSE Linux Enterprise Module for Server Applications 15-SP3 (src):    qemu-5.2.0-23.1
SUSE Linux Enterprise Module for Basesystem 15-SP3 (src):    qemu-5.2.0-23.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 6 Swamp Workflow Management 2021-07-21 16:23:13 UTC
openSUSE-SU-2021:2442-1: An update that fixes four vulnerabilities is now available.

Category: security (important)
Bug References: 1187499,1187529,1187538,1187539
CVE References: CVE-2021-3582,CVE-2021-3607,CVE-2021-3608,CVE-2021-3611
JIRA References: 
Sources used:
openSUSE Leap 15.3 (src):    qemu-5.2.0-23.1
Comment 7 Swamp Workflow Management 2021-07-22 13:18:19 UTC
SUSE-SU-2021:2448-1: An update that solves 8 vulnerabilities and has one errata is now available.

Category: security (important)
Bug References: 1185591,1187364,1187365,1187366,1187367,1187499,1187529,1187538,1187539
CVE References: CVE-2021-3582,CVE-2021-3592,CVE-2021-3593,CVE-2021-3594,CVE-2021-3595,CVE-2021-3607,CVE-2021-3608,CVE-2021-3611
JIRA References: 
Sources used:
SUSE Linux Enterprise Server 12-SP5 (src):    qemu-3.1.1.1-54.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 9 OBSbugzilla Bot 2021-07-23 23:00:14 UTC
This is an autogenerated message for OBS integration:
This bug (1187539) was mentioned in
https://build.opensuse.org/request/show/908025 Factory / qemu
https://build.opensuse.org/request/show/908026 Factory / qemu
Comment 10 Swamp Workflow Management 2021-07-27 13:18:44 UTC
SUSE-SU-2021:2474-1: An update that fixes 8 vulnerabilities is now available.

Category: security (important)
Bug References: 1187364,1187365,1187366,1187367,1187499,1187529,1187538,1187539
CVE References: CVE-2021-3582,CVE-2021-3592,CVE-2021-3593,CVE-2021-3594,CVE-2021-3595,CVE-2021-3607,CVE-2021-3608,CVE-2021-3611
JIRA References: 
Sources used:
SUSE MicroOS 5.0 (src):    qemu-4.2.1-11.25.2
SUSE Linux Enterprise Module for Server Applications 15-SP2 (src):    qemu-4.2.1-11.25.2
SUSE Linux Enterprise Module for Basesystem 15-SP2 (src):    qemu-4.2.1-11.25.2

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 11 Swamp Workflow Management 2021-07-27 13:21:52 UTC
openSUSE-SU-2021:2474-1: An update that fixes 8 vulnerabilities is now available.

Category: security (important)
Bug References: 1187364,1187365,1187366,1187367,1187499,1187529,1187538,1187539
CVE References: CVE-2021-3582,CVE-2021-3592,CVE-2021-3593,CVE-2021-3594,CVE-2021-3595,CVE-2021-3607,CVE-2021-3608,CVE-2021-3611
JIRA References: 
Sources used:
openSUSE Leap 15.3 (src):    qemu-4.2.1-11.25.2
Comment 13 Swamp Workflow Management 2021-08-02 16:18:56 UTC
openSUSE-SU-2021:2591-1: An update that solves 9 vulnerabilities and has two fixes is now available.

Category: security (important)
Bug References: 1176681,1185591,1186290,1187364,1187365,1187366,1187367,1187499,1187529,1187538,1187539
CVE References: CVE-2020-25085,CVE-2021-3582,CVE-2021-3592,CVE-2021-3593,CVE-2021-3594,CVE-2021-3595,CVE-2021-3607,CVE-2021-3608,CVE-2021-3611
JIRA References: 
Sources used:
openSUSE Leap 15.3 (src):    qemu-3.1.1.1-9.30.2
Comment 14 Swamp Workflow Management 2021-08-02 16:21:16 UTC
SUSE-SU-2021:2591-1: An update that solves 9 vulnerabilities and has two fixes is now available.

Category: security (important)
Bug References: 1176681,1185591,1186290,1187364,1187365,1187366,1187367,1187499,1187529,1187538,1187539
CVE References: CVE-2020-25085,CVE-2021-3582,CVE-2021-3592,CVE-2021-3593,CVE-2021-3594,CVE-2021-3595,CVE-2021-3607,CVE-2021-3608,CVE-2021-3611
JIRA References: 
Sources used:
SUSE Manager Server 4.0 (src):    qemu-3.1.1.1-9.30.2
SUSE Manager Retail Branch Server 4.0 (src):    qemu-3.1.1.1-9.30.2
SUSE Manager Proxy 4.0 (src):    qemu-3.1.1.1-9.30.2
SUSE Linux Enterprise Server for SAP 15-SP1 (src):    qemu-3.1.1.1-9.30.2
SUSE Linux Enterprise Server 15-SP1-LTSS (src):    qemu-3.1.1.1-9.30.2
SUSE Linux Enterprise Server 15-SP1-BCL (src):    qemu-3.1.1.1-9.30.2
SUSE Linux Enterprise High Performance Computing 15-SP1-LTSS (src):    qemu-3.1.1.1-9.30.2
SUSE Linux Enterprise High Performance Computing 15-SP1-ESPOS (src):    qemu-3.1.1.1-9.30.2
SUSE Enterprise Storage 6 (src):    qemu-3.1.1.1-9.30.2
SUSE CaaS Platform 4.0 (src):    qemu-3.1.1.1-9.30.2

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 15 Swamp Workflow Management 2021-08-26 19:17:57 UTC
# maintenance_jira_update_notice
openSUSE-SU-2021:1202-1: An update that fixes 15 vulnerabilities is now available.

Category: security (important)
Bug References: 1180432,1180433,1180434,1180435,1182651,1186012,1187364,1187365,1187366,1187367,1187499,1187529,1187538,1187539,1189145
CVE References: CVE-2020-35503,CVE-2020-35504,CVE-2020-35505,CVE-2020-35506,CVE-2021-20255,CVE-2021-3527,CVE-2021-3582,CVE-2021-3592,CVE-2021-3593,CVE-2021-3594,CVE-2021-3595,CVE-2021-3607,CVE-2021-3608,CVE-2021-3611,CVE-2021-3682
JIRA References: 
Sources used:
openSUSE Leap 15.2 (src):    qemu-4.2.1-lp152.9.20.1, qemu-linux-user-4.2.1-lp152.9.20.1, qemu-testsuite-4.2.1-lp152.9.20.1