Xen Security Advisory 29 (CVE-2012-5513) - XENMEM_exchange may overwrite hypervisor memory
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Xen Security Advisory CVE-2012-5513 / XSA-29
version 3
XENMEM_exchange may overwrite hypervisor memoryUPDATES IN VERSION 3
====================
Public release.
ISSUE DESCRIPTION
=================
The handler for XENMEM_exchange accesses guest memory without range checking the guest provided addresses, thus allowing these accesses to include the hypervisor reserved range.
IMPACT
======
A malicious guest administrator can cause Xen to crash. If the out of address space bounds access does not lead to a crash, a carefully crafted privilege escalation cannot be excluded, even though the guest doesn't itself control the values written.
VULNERABLE SYSTEMS
==================
All Xen versions are vulnerable.
The vulnerability is only exposed to PV guests.
MITIGATION
==========
Running only HVM guests, or ensuring that PV guests only use trusted kernels, will avoid this vulnerability.
RESOLUTION
==========
Applying the appropriate attached patch resolves this issue.
xsa29-4.1.patch Xen 4.1.x
xsa29-4.2-unstable.patch Xen 4.2.x, xen-unstable
$ sha256sum xsa29*.patch 7246a5534bc1e6a47bb6a860f6eb61c8353ad8b46209310783e823b4f7e2eae8 xsa29-4.1.patch 54dcd3ac5c84903bfb04f8591107a74c27b079815f2c6843212e05f776873c73 xsa29-4.2-unstable.patch $ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux)
iQEcBAEBAgAGBQJQvOJ3AAoJEIP+FMlX6CvZ7u8IAM01+jNn5fwdGmoo/LIdH885 nWr5aSc+qMqVuSvla0KKh1SOLFaVWFgovLN1Sfu2hAxLgrK3HxN86RqHU/vLo0k0 KTFM+9xQlxhJNQzyQSiDryH/qSrHTQI6ERxUEYgfjtTieK8y30SZqkd6jBmwoir/ nAMMP8oFmVevM2WfYEWjNNsWPaiUlUYP13qxiWGPcGzhcNNKRwcmrIY4N+F6kHID Ipl4l5vhoeSaQ0fKkcJKHa+3QGd+706jHZ5VTCwPdWBCnBJLFuMWbc2UlyIg2EB9 N+3Olwf3jCF0zIzBJkomA+FAg+D7kw31DCjc+y1PdGIyuoMkk+JRwYFVkZcKLi4= =pD8C
-----END PGP SIGNATURE-----
xen: add missing guest address range checks to XENMEM_exchange handlers
Ever since its existence (3.0.3 iirc) the handler for this has been using non address range checking guest memory accessors (i.e. the ones prefixed with two underscores) without first range checking the accessed space (via guest_handle_okay()), allowing a guest to access and overwrite hypervisor memory.
This is XSA-29 / CVE-2012-5513.
xen/common/compat/memory.c +6 -0
@@ -114,6 +114,12 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE(void) compat) (cmp.xchg.out.nr_extents << cmp.xchg.out.extent_order)) )return -EINVAL ; +if ( !compat_handle_okay (cmp.xchg.in.extent_start, + cmp.xchg.in.nr_extents) || + !compat_handle_okay (cmp.xchg.out.extent_start, + cmp.xchg.out.nr_extents) ) +return -EFAULT ; + start_extent = cmp.xchg.nr_exchanged; end_extent = (COMPAT_ARG_XLAT_SIZE - sizeof(*nat.xchg)) / (((1U << ABS(order_delta)) + 1) *
xen/common/memory.c +7 -0
@@ -289,6 +289,13 @@ static long memory_exchange(XEN_GUEST_HANDLE(xen_memory_exchange_t) arg) goto fail_early; } +if ( !guest_handle_okay (exch.in.extent_start, exch.in.nr_extents) || + !guest_handle_okay (exch.out.extent_start, exch.out.nr_extents) ) + { + rc = -EFAULT ; + goto fail_early; + } +/* Only privileged guests can allocate multi-page contiguous extents. */ if ( !multipage_allocation_permitted(current->domain, exch.in.extent_order) ||
xen: add missing guest address range checks to XENMEM_exchange handlers
Ever since its existence (3.0.3 iirc) the handler for this has been using non address range checking guest memory accessors (i.e. the ones prefixed with two underscores) without first range checking the accessed space (via guest_handle_okay()), allowing a guest to access and overwrite hypervisor memory.
This is XSA-29 / CVE-2012-5513.
xen/common/compat/memory.c +6 -0
@@ -115,6 +115,12 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) (cmp.xchg.out.nr_extents << cmp.xchg.out.extent_order)) )return -EINVAL ; +if ( !compat_handle_okay (cmp.xchg.in.extent_start, + cmp.xchg.in.nr_extents) || + !compat_handle_okay (cmp.xchg.out.extent_start, + cmp.xchg.out.nr_extents) ) +return -EFAULT ; + start_extent = cmp.xchg.nr_exchanged; end_extent = (COMPAT_ARG_XLAT_SIZE - sizeof(*nat.xchg)) / (((1U << ABS(order_delta)) + 1) *
xen/common/memory.c +7 -0
@@ -308,6 +308,13 @@ static long memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange_t) arg) goto fail_early; } +if ( !guest_handle_okay (exch.in.extent_start, exch.in.nr_extents) || + !guest_handle_okay (exch.out.extent_start, exch.out.nr_extents) ) + { + rc = -EFAULT ; + goto fail_early; + } +/* Only privileged guests can allocate multi-page contiguous extents. */ if ( !multipage_allocation_permitted(current->domain, exch.in.extent_order) ||
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel