From nobody Mon Apr 29 11:37:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558440501; cv=none; d=zoho.com; s=zohoarc; b=lKSemphlamK5MHVwp1+oCquzYQoWsjmPgYBl0axhSMhPXTThyFPtE8oBhThh8sRRXo1mhqeIR0f88ymjcAGJO6Mo5CwA9gkmz5aZ4B2szElpr+O53XJGwV5DsuF4oW8CsHJf/RDg7lzxZwwvV6VuRDaIIKA0Ap25wjOjt5NepG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558440501; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=n5FmCIFploz4YrvaakRZCO9q2fCyqr6QmWTaP2U18JM=; b=UFq5ix9WD+z6fLdsKRh2Tw5mJlS13FRLUyat1M1lzD4uaYHTBZQzoHeB9uN5S5wmlMuttze9XzWYOsd5USZsXx9W229qSLd7tn/AfC2F3bSzzeHQr9/9bRYYia98wS4iDfIvLoA72oj+F7fND2Y/DKhLS6PxjM2Vx0sU3f5qFsc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558440501735619.2279695086233; Tue, 21 May 2019 05:08:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 133567F769; Tue, 21 May 2019 12:08:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D6CC961091; Tue, 21 May 2019 12:08:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8808F1806B12; Tue, 21 May 2019 12:08:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4LC6wUF013951 for ; Tue, 21 May 2019 08:06:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4184E78421; Tue, 21 May 2019 12:06:58 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-26.ams2.redhat.com [10.36.112.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1A67643FB; Tue, 21 May 2019 12:06:56 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 21 May 2019 13:06:25 +0100 Message-Id: <20190521120626.24403-2-berrange@redhat.com> In-Reply-To: <20190521120626.24403-1-berrange@redhat.com> References: <20190521120626.24403-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?J=C3=A1n=20Tomko?= Subject: [libvirt] [PATCH 1/3] admin: reject clients unless their UID matches the current UID X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 21 May 2019 12:08:19 +0000 (UTC) The admin protocol RPC messages are only intended for use by the user running the daemon. As such they should not be allowed for any client UID that does not match the server UID. Fixes CVE-2019-10132 Reviewed-by: J=C3=A1n Tomko Signed-off-by: Daniel P. Berrang=C3=A9 --- src/admin/admin_server_dispatch.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/admin/admin_server_dispatch.c b/src/admin/admin_server_dis= patch.c index 85e693d76c..6e3b99f97d 100644 --- a/src/admin/admin_server_dispatch.c +++ b/src/admin/admin_server_dispatch.c @@ -64,6 +64,28 @@ remoteAdmClientNew(virNetServerClientPtr client ATTRIBUT= E_UNUSED, void *opaque) { struct daemonAdmClientPrivate *priv; + uid_t clientuid; + gid_t clientgid; + pid_t clientpid; + unsigned long long timestamp; + + if (virNetServerClientGetUNIXIdentity(client, + &clientuid, + &clientgid, + &clientpid, + ×tamp) < 0) + return NULL; + + VIR_DEBUG("New client pid %lld uid %lld", + (long long)clientpid, + (long long)clientuid); + + if (geteuid() !=3D clientuid) { + virReportRestrictedError(_("Disallowing client %lld with uid %lld"= ), + (long long)clientpid, + (long long)clientuid); + return NULL; + } =20 if (VIR_ALLOC(priv) < 0) return NULL; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:37:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558440491; cv=none; d=zoho.com; s=zohoarc; b=ZpDH8NijcS1rLxLSroiqXZPxuFuIp478Dp99xb6ogACnXYDlMF6LHCLU21OaF4a19+dGznRM7tyRbaC48c515aAPMQyHNslvR1kz0WyiExW+Kpr8rOKN4x4h8A200SIV5fhm/R9lYpPS4g5ehZXuaFpMSTT05zPLEgLQGNmkO6k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558440491; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=aluhpvTdjiJ5Ib4/+qSrktqipQehb9kdPHgsDUelXNM=; b=VFR4b5Gs4o+u9qITLUGMfvNfGsoi6d98sdQmKby/w5qwQ2LjJXbBA9faE5V+PPiSghX7SOz0f2PUE10HsPm6fd3YZwo05P8A4IWAsonMwBW106MX/n+dEqM3tpFWIrXmKdobArTcuzWb7rqTjfdg9ElCI+qKRtfOFtJAxHW2zxI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558440491538419.12785346813416; Tue, 21 May 2019 05:08:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BCC553004433; Tue, 21 May 2019 12:07:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 618AA600C6; Tue, 21 May 2019 12:07:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 77EFB1806B0F; Tue, 21 May 2019 12:07:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4LC70e6013964 for ; Tue, 21 May 2019 08:07:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6C09778424; Tue, 21 May 2019 12:07:00 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-26.ams2.redhat.com [10.36.112.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1B8850A63; Tue, 21 May 2019 12:06:58 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 21 May 2019 13:06:26 +0100 Message-Id: <20190521120626.24403-3-berrange@redhat.com> In-Reply-To: <20190521120626.24403-1-berrange@redhat.com> References: <20190521120626.24403-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?J=C3=A1n=20Tomko?= Subject: [libvirt] [PATCH 2/3] locking: restrict sockets to mode 0600 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 21 May 2019 12:08:10 +0000 (UTC) The virtlockd daemon's only intended client is the libvirtd daemon. As such it should never allow clients from other user accounts to connect. The code already enforces this and drops clients from other UIDs, but we can get earlier (and thus stronger) protection against DoS by setting the socket permissions to 0600 Fixes CVE-2019-10132 Reviewed-by: J=C3=A1n Tomko Signed-off-by: Daniel P. Berrang=C3=A9 --- src/locking/virtlockd-admin.socket.in | 1 + src/locking/virtlockd.socket.in | 1 + 2 files changed, 2 insertions(+) diff --git a/src/locking/virtlockd-admin.socket.in b/src/locking/virtlockd-= admin.socket.in index 2a7500f3d0..f674c492f7 100644 --- a/src/locking/virtlockd-admin.socket.in +++ b/src/locking/virtlockd-admin.socket.in @@ -5,6 +5,7 @@ Before=3Dlibvirtd.service [Socket] ListenStream=3D@localstatedir@/run/libvirt/virtlockd-admin-sock Service=3Dvirtlockd.service +SocketMode=3D0600 =20 [Install] WantedBy=3Dsockets.target diff --git a/src/locking/virtlockd.socket.in b/src/locking/virtlockd.socket= .in index 45e0f20235..d701b27516 100644 --- a/src/locking/virtlockd.socket.in +++ b/src/locking/virtlockd.socket.in @@ -4,6 +4,7 @@ Before=3Dlibvirtd.service =20 [Socket] ListenStream=3D@localstatedir@/run/libvirt/virtlockd-sock +SocketMode=3D0600 =20 [Install] WantedBy=3Dsockets.target --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 11:37:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558440582; cv=none; d=zoho.com; s=zohoarc; b=QRqYB3pfnIrJGR7zDlCxu5jPACYh9Wt9FMfcQLtD85M5//gfAE5CKCj3O05puSXosgmjZM/eUjLdGXBhGEvn0CV8xlHbL8G/jQXGgoW7a5egLnTQx7YguDYsIjpMVf4iD2zZbfs1arDquosG46x1xSR+2ogfq/NqKNCin08Qgoc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558440582; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/Y9i3iN02pkCDhq+eyX8rkBExIcNQzPNCoOX5ZiPcyE=; b=V+ch34vWEhcSpQJR9xs0fymmYi/cQMAjR28/P3L8evMsnGWiBSXlUvYR3BnWX5+ToN7k7wMRhM2WSJC9nHodF48D6zbojgdkGe1nYOGZg9Ja4HlBoxlRCX2Ke8Ct0zQBIOg8M4Z+G2McOxnG0R32xlfHMxPj+gjTID6eWhAKPxg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558440582596470.19718556042085; Tue, 21 May 2019 05:09:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3668A8046F; Tue, 21 May 2019 12:09:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F34D1001DE9; Tue, 21 May 2019 12:09:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9B0551806B0F; Tue, 21 May 2019 12:09:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4LC72xn013974 for ; Tue, 21 May 2019 08:07:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2BCE3648AB; Tue, 21 May 2019 12:07:02 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-26.ams2.redhat.com [10.36.112.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id C945E78417; Tue, 21 May 2019 12:07:00 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 21 May 2019 13:06:27 +0100 Message-Id: <20190521120626.24403-4-berrange@redhat.com> In-Reply-To: <20190521120626.24403-1-berrange@redhat.com> References: <20190521120626.24403-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?J=C3=A1n=20Tomko?= Subject: [libvirt] [PATCH 3/3] logging: restrict sockets to mode 0600 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 21 May 2019 12:09:36 +0000 (UTC) The virtlogd daemon's only intended client is the libvirtd daemon. As such it should never allow clients from other user accounts to connect. The code already enforces this and drops clients from other UIDs, but we can get earlier (and thus stronger) protection against DoS by setting the socket permissions to 0600 Fixes CVE-2019-10132 Reviewed-by: J=C3=A1n Tomko Signed-off-by: Daniel P. Berrang=C3=A9 --- src/logging/virtlogd-admin.socket.in | 1 + src/logging/virtlogd.socket.in | 1 + 2 files changed, 2 insertions(+) diff --git a/src/logging/virtlogd-admin.socket.in b/src/logging/virtlogd-ad= min.socket.in index 595e6c4c4b..5c41dfeb7b 100644 --- a/src/logging/virtlogd-admin.socket.in +++ b/src/logging/virtlogd-admin.socket.in @@ -5,6 +5,7 @@ Before=3Dlibvirtd.service [Socket] ListenStream=3D@localstatedir@/run/libvirt/virtlogd-admin-sock Service=3Dvirtlogd.service +SocketMode=3D0600 =20 [Install] WantedBy=3Dsockets.target diff --git a/src/logging/virtlogd.socket.in b/src/logging/virtlogd.socket.in index 22b9360c8d..ae48cdab9a 100644 --- a/src/logging/virtlogd.socket.in +++ b/src/logging/virtlogd.socket.in @@ -4,6 +4,7 @@ Before=3Dlibvirtd.service =20 [Socket] ListenStream=3D@localstatedir@/run/libvirt/virtlogd-sock +SocketMode=3D0600 =20 [Install] WantedBy=3Dsockets.target --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list