Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1881037 (CVE-2020-25637) - CVE-2020-25637 libvirt: double free in qemuAgentGetInterfaces() in qemu_agent.c
Summary: CVE-2020-25637 libvirt: double free in qemuAgentGetInterfaces() in qemu_agent.c
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2020-25637
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1910617 1881899 1881900 1881902 1881903 1881904 1882721 1883864 1883865 1896789
Blocks: 1878876
TreeView+ depends on / blocked
 
Reported: 2020-09-21 12:18 UTC by Mauro Matteo Cascella
Modified: 2021-05-18 14:51 UTC (History)
20 users (show)

Fixed In Version: libvirt 6.8.0
Doc Type: If docs needed, set a value
Doc Text:
A double free memory issue was found to occur in the libvirt API responsible for requesting information about network interfaces of a running QEMU domain. This flaw affects the polkit access control driver. Specifically, clients connecting to the read-write socket with limited ACL permissions could use this flaw to crash the libvirt daemon, resulting in a denial of service, or potentially escalate their privileges on the system. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability.
Clone Of:
Environment:
Last Closed: 2020-11-10 14:21:34 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2020:5040 0 None None None 2020-11-10 13:13:40 UTC
Red Hat Product Errata RHSA-2020:5111 0 None None None 2020-11-16 09:10:11 UTC

Description Mauro Matteo Cascella 2020-09-21 12:18:32 UTC
A double free vulnerability was found in libvirt while requesting information about the network interfaces of a running domain. The flaw lies in qemuAgentGetInterfaces() in qemu/qemu_agent.c. More specifically, this function interacts with the guest agent and receives JSON data from the agent that contains network interface information. It enumerates the interfaces one by one, using a pointer to a pointers to hold a split interface name (ifname). At some point in every iteration ifname is free'd. If an error occurs right after this, there is a 'goto error', the error handler at this label will free ifname again, leading to a double free. Depending on the ability of the attacker to control and shape the heap state when the second free happens, this flaw may be exploited to achieve code execution.

Comment 1 Mauro Matteo Cascella 2020-09-21 12:18:37 UTC
Acknowledgments:

Name: Ilja Van Sprundel (IOActive)

Comment 3 Mauro Matteo Cascella 2020-09-21 13:37:32 UTC
Seems like this flaw was introduced way back in libvirt v1.2.14 with the following commit:
  -> https://libvirt.org/git/?p=libvirt.git;a=commit;h=0977b8aa071de550e1a013d35e2c72615e65d520

As a side note, a recent update in version 6.7.0 replaced virStringListFree (responsible for freeing ifname) with g_strfreev():
  -> https://libvirt.org/git/?p=libvirt.git;a=commit;h=ee247e1d3fbfcf8d2aaff9447b79a65910bcf026

This change didn't have any repercussions on the impact of this flaw, though.

Comment 4 Mauro Matteo Cascella 2020-09-21 13:59:40 UTC
Statement:

Red Hat Enterprise Linux 5 and 6 are not affected by this issue as they shipped an older version of `libvirt` which did not include the vulnerable code. This flaw affects versions of the `libvirt` package as shipped with Red Hat Enterprise Linux 7 and 8 as well as Red Hat Enterprise Linux Advanced Virtualization 8. Future `libvirt` package updates for these products may address this issue.

Comment 7 Mauro Matteo Cascella 2020-09-28 08:17:42 UTC
The check in virDomainInterfaceAddresses() in libvirt-domain.c prevents read-only clients from exploiting this flaw:

```
if (source == VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT)
    virCheckReadOnlyGoto(dom->conn->flags, error);
```

This issue mostly involves a security boundary violation in the polkit access control driver: https://libvirt.org/aclpolkit.html.
Specifically, clients connecting to the read-write socket with limited ACL permissions (i.e., read-only) could use this flaw to crash the libvirt daemon, resulting in a denial of service, or potentially escalate their privileges on the system.

Comment 9 Mauro Matteo Cascella 2020-09-30 12:30:06 UTC
Created libvirt tracking bugs for this issue:

Affects: fedora-all [bug 1883864]


Created mingw-libvirt tracking bugs for this issue:

Affects: fedora-all [bug 1883865]

Comment 12 errata-xmlrpc 2020-11-10 13:13:37 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2020:5040 https://access.redhat.com/errata/RHSA-2020:5040

Comment 13 Product Security DevOps Team 2020-11-10 14:21:34 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-25637

Comment 14 errata-xmlrpc 2020-11-16 09:10:02 UTC
This issue has been addressed in the following products:

  Advanced Virtualization for RHEL 8.2.1

Via RHSA-2020:5111 https://access.redhat.com/errata/RHSA-2020:5111

Comment 16 errata-xmlrpc 2021-05-18 14:51:05 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


Note You need to log in before you can comment on or make changes to this bug.