a2479f539e
CVE-2019-10161: arbitrary file read/exec via virDomainSaveImageGetXMLDesc API (bz #1722463, bz #1720115) CVE-2019-10166: virDomainManagedSaveDefineXML API exposed to readonly clients (bz #1722462, bz #1720114) CVE-2019-10167: arbitrary command execution via virConnectGetDomainCapabilities API (bz #1722464, bz #1720117) CVE-2019-10168: arbitrary command execution via virConnectBaselineHypervisorCPU and virConnectCompareHypervisorCPU APIs (bz #1722466, bz #1720118)
82 lines
3.0 KiB
Diff
82 lines
3.0 KiB
Diff
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
Date: Fri, 14 Jun 2019 08:47:42 +0200
|
|
Subject: [PATCH] api: disallow virDomainSaveImageGetXMLDesc on read-only
|
|
connections
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
The virDomainSaveImageGetXMLDesc API is taking a path parameter,
|
|
which can point to any path on the system. This file will then be
|
|
read and parsed by libvirtd running with root privileges.
|
|
|
|
Forbid it on read-only connections.
|
|
|
|
Fixes: CVE-2019-10161
|
|
Reported-by: Matthias Gerstner <mgerstner@suse.de>
|
|
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
(cherry picked from commit aed6a032cead4386472afb24b16196579e239580)
|
|
---
|
|
src/libvirt-domain.c | 11 ++---------
|
|
src/qemu/qemu_driver.c | 2 +-
|
|
src/remote/remote_protocol.x | 3 +--
|
|
3 files changed, 4 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
|
|
index df7e405b3e..1cc8537c04 100644
|
|
--- a/src/libvirt-domain.c
|
|
+++ b/src/libvirt-domain.c
|
|
@@ -1073,8 +1073,7 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml,
|
|
* previously by virDomainSave() or virDomainSaveFlags().
|
|
*
|
|
* No security-sensitive data will be included unless @flags contains
|
|
- * VIR_DOMAIN_SAVE_IMAGE_XML_SECURE; this flag is rejected on read-only
|
|
- * connections.
|
|
+ * VIR_DOMAIN_SAVE_IMAGE_XML_SECURE.
|
|
*
|
|
* Returns a 0 terminated UTF-8 encoded XML instance, or NULL in case of
|
|
* error. The caller must free() the returned value.
|
|
@@ -1090,13 +1089,7 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *file,
|
|
|
|
virCheckConnectReturn(conn, NULL);
|
|
virCheckNonNullArgGoto(file, error);
|
|
-
|
|
- if ((conn->flags & VIR_CONNECT_RO) &&
|
|
- (flags & VIR_DOMAIN_SAVE_IMAGE_XML_SECURE)) {
|
|
- virReportError(VIR_ERR_OPERATION_DENIED, "%s",
|
|
- _("virDomainSaveImageGetXMLDesc with secure flag"));
|
|
- goto error;
|
|
- }
|
|
+ virCheckReadOnlyGoto(conn->flags, error);
|
|
|
|
if (conn->driver->domainSaveImageGetXMLDesc) {
|
|
char *ret;
|
|
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
index 42b1ce2521..ea9a3d33a3 100644
|
|
--- a/src/qemu/qemu_driver.c
|
|
+++ b/src/qemu/qemu_driver.c
|
|
@@ -7038,7 +7038,7 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path,
|
|
if (fd < 0)
|
|
goto cleanup;
|
|
|
|
- if (virDomainSaveImageGetXMLDescEnsureACL(conn, def, flags) < 0)
|
|
+ if (virDomainSaveImageGetXMLDescEnsureACL(conn, def) < 0)
|
|
goto cleanup;
|
|
|
|
ret = qemuDomainDefFormatXML(driver, def, flags);
|
|
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
|
|
index 11f44ee267..737d67c47b 100644
|
|
--- a/src/remote/remote_protocol.x
|
|
+++ b/src/remote/remote_protocol.x
|
|
@@ -5242,8 +5242,7 @@ enum remote_procedure {
|
|
/**
|
|
* @generate: both
|
|
* @priority: high
|
|
- * @acl: domain:read
|
|
- * @acl: domain:read_secure:VIR_DOMAIN_SAVE_IMAGE_XML_SECURE
|
|
+ * @acl: domain:write
|
|
*/
|
|
REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC = 235,
|
|
|