Bug 1392938 (CVE-2016-9381, xsa197)

Summary: CVE-2016-9381 xsa197 xen: qemu incautious about shared ring processing (XSA-197)
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED UPSTREAM QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: ailan, apevec, areis, bmcclain, chrisw, crobinso, cvsbot-xmlrpc, drjones, imammedo, jen, jjoyce, jschluet, kbasil, knoel, lhh, lpeer, markmc, mburns, mkenneth, mrezanin, mst, pbonzini, ppandit, rbalakri, rbryant, rkrcmar, sclewis, security-response-team, slinaber, srevivo, tdecacqu, virt-maint, vkuznets, xen-maint, ykaul, ylavi
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-27 18:18:55 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: 1397383, 1397385    
Bug Blocks: 1392953    
Attachments:
Description Flags
qemu-upstream Xen 4.4.x
none
qemu-traditional Xen 4.5.x, Xen 4.4.x
none
qemu-upstream Xen 4.5.x
none
qemu-upstream Xen 4.6.x
none
qemu-traditional xen-unstable, Xen 4.7.x, Xen 4.6.x
none
qemu-upstream xen-unstable, Xen 4.7.x none

Description Adam Mariš 2016-11-08 13:56:49 UTC
ISSUE DESCRIPTION
=================

The compiler can emit optimizations in qemu which can lead to double
fetch vulnerabilities.  Specifically data on the rings shared between
qemu and the hypervisor (which the guest under control can obtain
mappings of) can be fetched twice (during which time the guest can
alter the contents) possibly leading to arbitrary code execution in
qemu.

IMPACT
======

Malicious administrators can exploit this vulnerability to take over
the qemu process, elevating its privilege to that of the qemu process.

In a system not using a device model stub domain (or other techniques
for deprivileging qemu), malicious guest administrators can thus
elevate their privilege to that of the host.

VULNERABLE SYSTEMS
==================

All Xen versions with all flavors of qemu are affected.

Only x86 HVM guests expose the vulnerability.  x86 PV guests do not
expose the vulnerability.

ARM systems are not vulnerable.

MITIGATION
==========

Running only PV guests will avoid the vulnerability.

Enabling stubdomains will mitigate this issue, by reducing the
escalation to only those privileges accorded to the service domain.
In a usual configuration, a service domain has only the privilege of
the guest, so this eliminates the vulnerability.

The vulnerability can be avoided if the guest kernel is controlled by
the host rather than guest administrator, provided that further steps
are taken to prevent the guest administrator from loading code into
the kernel (e.g. by disabling loadable modules etc) or from using
other mechanisms which allow them to run code at kernel privilege.

External References:

http://xenbits.xen.org/xsa/advisory-197.html

Acknowledgements:

Name: the Xen project
Upstream: yanghongke (Huawei Security Test Team)

Comment 1 Adam Mariš 2016-11-08 14:41:32 UTC
Created attachment 1218538 [details]
qemu-upstream Xen 4.4.x

Comment 2 Adam Mariš 2016-11-08 14:42:15 UTC
Created attachment 1218539 [details]
qemu-traditional Xen 4.5.x, Xen 4.4.x

Comment 3 Adam Mariš 2016-11-08 14:42:51 UTC
Created attachment 1218541 [details]
qemu-upstream Xen 4.5.x

Comment 4 Adam Mariš 2016-11-08 14:43:23 UTC
Created attachment 1218542 [details]
qemu-upstream Xen 4.6.x

Comment 5 Adam Mariš 2016-11-08 14:44:17 UTC
Created attachment 1218544 [details]
qemu-traditional xen-unstable, Xen 4.7.x, Xen 4.6.x

Comment 6 Adam Mariš 2016-11-08 14:44:45 UTC
Created attachment 1218545 [details]
qemu-upstream xen-unstable, Xen 4.7.x

Comment 7 Martin Prpič 2016-11-22 12:25:41 UTC
Created xen tracking bugs for this issue:

Affects: fedora-all [bug 1397383]

Comment 8 Martin Prpič 2016-11-22 12:25:58 UTC
Created qemu tracking bugs for this issue:

Affects: fedora-all [bug 1397385]

Comment 9 Cole Robinson 2017-01-16 18:40:26 UTC
Upstream qemu commit:

commit b85f9dfdb156ae2a2a52f39a36e9f1f270614cd2
Author: Jan Beulich <JBeulich>
Date:   Tue Nov 22 05:56:51 2016 -0700

    xen: fix ioreq handling