ASA-2019-00626 – Xen: add-to-physmap can be abused to Denial of Service (DoS) ARM hosts


Allele Security Alert

ASA-2019-00626

Identifier(s)

ASA-2019-00626, CVE-2019-18423, XSA-301

Title

add-to-physmap can be abused to Denial of Service (DoS) ARM hosts

Vendor(s)

The Xen Project

Product(s)

Xen

Affected version(s)

Xen version 4.8 and newer running on ARM systems

Fixed version(s)

Xen 4.11 – 4.8 with the following patches applied:

[PATCH 1/3] xen/arm: p2m: Avoid aliasing guest physical frame
https://xenbits.xen.org/xsa/xsa301-4.11-1.patch

[PATCH 2/3] xen/arm: p2m: Avoid off-by-one check on p2m->max_mapped_gfn
https://xenbits.xen.org/xsa/xsa301-4.11-2.patch

[PATCH 3/3] xen/arm: p2m: Don’t check the return of p2m_get_root_pointer() with BUG_ON()
https://xenbits.xen.org/xsa/xsa301-4.11-3.patch

Xen unstable – 4.12 with the following patches applied:

[PATCH 1/3] xen/arm: p2m: Avoid aliasing guest physical frame
https://xenbits.xen.org/xsa/xsa301-master-1.patch

[PATCH 2/3] xen/arm: p2m: Avoid off-by-one check on p2m->max_mapped_gfn
https://xenbits.xen.org/xsa/xsa301-master-2.patch

[PATCH 3/3] xen/arm: p2m: Don’t check the return of
p2m_get_root_pointer() with BUG_ON()
https://xenbits.xen.org/xsa/xsa301-master-3.patch

Proof of concept

Unknown

Description

A malicious guest administrator may cause a hypervisor crash, resulting in a Denial of Service (DoS).

Technical details

p2m->max_mapped_gfn is used by the functions p2m_resolve_translation_fault() and p2m_get_entry() to sanity check guest physical frame. The rest of the code in the two functions will assume that there is a valid root table and check that with BUG_ON().

The function p2m_get_root_pointer() will ignore the unused top bits of a guest physical frame. This means that the function p2m_set_entry() will alias the frame. However, p2m->max_mapped_gfn will be updated using the original frame.

It would be possible to set p2m->max_mapped_gfn high enough to cover a frame that would lead p2m_get_root_pointer() to return NULL in p2m_get_entry() and p2m_resolve_translation_fault().

Additionally, the sanity check on p2m->max_mapped_gfn is off-by-one allowing “highest mapped + 1” to be considered valid. However, p2m_get_root_pointer() will return NULL.

The problem could be triggered with a specially crafted hypercall XENMEM_add_to_physmap{, _batch} followed by an access to an address (via hypercall or direct access) that passes the sanity check but cause p2m_get_root_pointer() to return NULL.

Credits

Julian Grall  (Arm)

Reference(s)

XSA-301 – Xen Security Advisories
https://xenbits.xen.org/xsa/advisory-301.html

oss-security – Xen Security Advisory 301 v3 (CVE-2019-18423) – add-to-physmap
can be abused to DoS Arm hosts
https://www.openwall.com/lists/oss-security/2019/10/31/4

[PATCH 1/3] xen/arm: p2m: Avoid aliasing guest physical frame
https://xenbits.xen.org/xsa/xsa301-4.11-1.patch

[PATCH 2/3] xen/arm: p2m: Avoid off-by-one check on p2m->max_mapped_gfn
https://xenbits.xen.org/xsa/xsa301-4.11-2.patch

[PATCH 3/3] xen/arm: p2m: Don’t check the return of p2m_get_root_pointer() with BUG_ON()
https://xenbits.xen.org/xsa/xsa301-4.11-3.patch

[PATCH 1/3] xen/arm: p2m: Avoid aliasing guest physical frame
https://xenbits.xen.org/xsa/xsa301-master-1.patch

[PATCH 2/3] xen/arm: p2m: Avoid off-by-one check on p2m->max_mapped_gfn
https://xenbits.xen.org/xsa/xsa301-master-2.patch

[PATCH 3/3] xen/arm: p2m: Don’t check the return of p2m_get_root_pointer() with BUG_ON()
https://xenbits.xen.org/xsa/xsa301-master-3.patch

CVE-2019-18423
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-18423

CVE-2019-18423
https://nvd.nist.gov/vuln/detail/CVE-2019-18423

If there is any error in this alert or you wish a comprehensive analysis, let us know.

Last modified: November 12, 2019

We are not responsible for any data loss, device corruption or any other type of issue due to the use of any information mentioned in our security alerts.