From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id gHgxEi+D72VhTgAA62LTzQ:P1 (envelope-from ) for ; Mon, 11 Mar 2024 23:18:23 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id gHgxEi+D72VhTgAA62LTzQ (envelope-from ) for ; Mon, 11 Mar 2024 23:18:23 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="YPePDT/Z"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1710195503; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=j/akcUHUAvI4THZtkZCkVLgwpU2kzI8sAPSrOYEipgs=; b=uYTITcmCx4kspp4uxSwKNUYgCuzKr03fT4caNilW42ezjpxiNk0TfyxOlhB+MocmfChjSk iqnQ9W2dVn/APVtjy4a7OoWGGYCnv+eYXrTJF9LMTSfUAayoCvvtb8PvP06VdvvYrHy6bR l0MSt8bWvhpq+22BSNqfgxccihwHzm+1ri2nxlYmv9S0VOX9M78qsj7B9aIw8jksOxDiaz +D6MFqP4bXKVqfnmP17T1LZJ2aZqj+MEN07gu5w5co5J0aOn+Sg0XQ69JuFMCgfT56/wZu tYaFiW2+r8HIeQnYrCLF6elgc8uIfbLzCSe3F0Q7sWjq5RZ4MtVyp2Cd+ldHnQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="YPePDT/Z"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1710195503; a=rsa-sha256; cv=none; b=ZQhw4p2pwQL3/dcoVfuzjKQBuQPVLz76UVIXR2UDdBlGNc+qlTkzhSha7YSTCEHfPrHzUM c2A230HPbw0sOoxVjGJoc6Au/eSruY2EqwDUXHY1Wj2J78NG64r+cUlR1U01ArFknSu5SZ rlqNRN1iND+Grk/ZLpk4Cf4R//hKmPGeTYuc+Za1tGYrFbDVh1+MQ+3ILFe4Bt4pkanlhZ cqeLlIDfr4F+CEeyj6crTfRWPAjrmWnM2uW1rdogUb0SITH/FO/WoDc14g8ffSrI/sZV6z ckpiCwAayKfJdevyvslUifHYTqT5MFJ5oz+v6Sv6InM+8+XhRciF2RLFKSH9xw== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A295D362B5 for ; Mon, 11 Mar 2024 23:18:22 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjnxx-0007Dd-Ss; Mon, 11 Mar 2024 18:17:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjnxa-0007A7-HY for guix-patches@gnu.org; Mon, 11 Mar 2024 18:17:36 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjnxY-0006xj-DZ for guix-patches@gnu.org; Mon, 11 Mar 2024 18:17:29 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rjny6-00027A-1L for guix-patches@gnu.org; Mon, 11 Mar 2024 18:18:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69728] [PATCH security] daemon: Protect against FD escape when building fixed-output derivations (CVE-2024-27297). Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 11 Mar 2024 22:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69728 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch security To: 69728@debbugs.gnu.org Cc: Picnoir , =?UTF-8?Q?Th=C3=A9ophane?= Hufschmitt , guix-security@gnu.org Received: via spool by 69728-submit@debbugs.gnu.org id=B69728.17101954448077 (code B ref 69728); Mon, 11 Mar 2024 22:18:02 +0000 Received: (at 69728) by debbugs.gnu.org; 11 Mar 2024 22:17:24 +0000 Received: from localhost ([127.0.0.1]:41442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rjnxT-00026D-RK for submit@debbugs.gnu.org; Mon, 11 Mar 2024 18:17:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56458) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rjnxQ-00025x-Io for 69728@debbugs.gnu.org; Mon, 11 Mar 2024 18:17:21 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjnwm-0006tT-Bc; Mon, 11 Mar 2024 18:16:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=j/akcUHUAvI4THZtkZCkVLgwpU2kzI8sAPSrOYEipgs=; b=YPePDT/ZHqT3pBBlsQa7 tSSUu484hLnh/12JWGriEen3148AxlzX0yk3eaiT3oHTN/sd3FBuvP8CxbzjLWCZrLIwIDtaL4Xcf IyqUvWQafJwAnh8Q2QV4AtyopLP4/EPWQ1/PCp2Pu3VQuBpAUfCJ1/3gXgtBoP9Vf5nR2Z+NDczD/ O5x8V+u2hRIyUR8A52Qk10l/dNL6P3ig2TAS/fF7PuoKrRR24g+nvFfeKWF9CAuVjNWTLBLYeRXvp VuOee8WWiFiSxIua3EHNSKo1KfNYHmXpnGOgLp8B46m6rMNnGs6yi4mDCeY72u6WvgUPtl4jzsz5h jA2jcd7j4/4huA==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 11 Mar 2024 11:54:00 +0100") References: Date: Mon, 11 Mar 2024 23:16:31 +0100 Message-ID: <87frwwo1mo.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -7.18 X-Spam-Score: -7.18 X-Migadu-Queue-Id: A295D362B5 X-TUID: PM5pqY77BedZ Ludovic Court=C3=A8s skribis: > This fixes a security issue (CVE-2024-27297) whereby a fixed-output > derivation build process could open a writable file descriptor to its > output, send it to some outside process for instance over an abstract > AF_UNIX socket, which would then allow said process to modify the file > in the store after it has been marked as =E2=80=9Cvalid=E2=80=9D. > > Nix security advisory: > https://github.com/NixOS/nix/security/advisories/GHSA-2ffj-w4mj-pg37 > > * nix/libutil/util.cc (readDirectory): Add variants that take a DIR* and > a file descriptor. Rewrite the =E2=80=98Path=E2=80=99 variant accordingl= y. > (copyFile, copyFileRecursively): New functions. > * nix/libutil/util.hh (copyFileRecursively): New declaration. > * nix/libstore/build.cc (DerivationGoal::buildDone): When =E2=80=98fixedO= utput=E2=80=99 > is true, call =E2=80=98copyFileRecursively=E2=80=99 followed by =E2=80=98= rename=E2=80=99 on each output. > > Change-Id: I7952d41093eed26e123e38c14a4c1424be1ce1c4 > > Reported-by: Picnoir , Th=C3=A9ophane Hufschmi= tt > Change-Id: Idb5f2757f35af86b032a9851cecb19b70227bd88 > --- > nix/libstore/build.cc | 16 ++++++ > nix/libutil/util.cc | 112 ++++++++++++++++++++++++++++++++++++++++-- > nix/libutil/util.hh | 6 +++ > 3 files changed, 129 insertions(+), 5 deletions(-) Pushed (with a slightly different commit message) as 8f4ffb3fae133bb21d7991e97c2f19a7108b1143. Updated the =E2=80=98guix=E2=80=99 package in b8954a7faeccae11c32add7cd0f40= 8d139af3a43: Guix System users can now reconfigure! Added a news entry in 4003c60abf7a6e59e47cc2deb9eef2f104ebb994. Ludo=E2=80=99.