From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#37744: Per-user profile directory hijack (CVE-2019-17365 for Nix) Date: Wed, 16 Oct 2019 22:01:37 +0200 Message-ID: <87a7a0jw7y.fsf@gnu.org> References: <87o8yjsr8o.fsf@gnu.org> <87blujsqq0.fsf@gnu.org> <87y2xno85o.fsf@nckx> <87d0eyuqzd.fsf@gnu.org> <87mue2nkrj.fsf@nckx> <8736fttby6.fsf@gnu.org> <87tv89rnva.fsf@gnu.org> <87imoook2l.fsf@nckx> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:37676) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKpUi-0004Ig-5Z for bug-guix@gnu.org; Wed, 16 Oct 2019 16:02:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKpUh-0007Eb-66 for bug-guix@gnu.org; Wed, 16 Oct 2019 16:02:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37792) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iKpUh-0007EX-3W for bug-guix@gnu.org; Wed, 16 Oct 2019 16:02:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iKpUg-0001bN-TV for bug-guix@gnu.org; Wed, 16 Oct 2019 16:02:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87imoook2l.fsf@nckx> (Tobias Geerinckx-Rice's message of "Wed, 16 Oct 2019 16:12:50 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Tobias Geerinckx-Rice Cc: 37744@debbugs.gnu.org, guix-security@gnu.org Tobias Geerinckx-Rice skribis: > Ludovic Court=C3=A8s =E5=86=99=E9=81=93=EF=BC=9A >> diff --git a/nix/libstore/local-store.cc >> b/nix/libstore/local-store.cc >> index 3b08492c64..3793382361 100644 >> --- a/nix/libstore/local-store.cc >> +++ b/nix/libstore/local-store.cc >> @@ -88,8 +88,9 @@ LocalStore::LocalStore(bool reserveSpace) >> Path perUserDir =3D profilesDir + "/per-user"; >> createDirs(perUserDir); >> - if (chmod(perUserDir.c_str(), 01777) =3D=3D -1) >> - throw SysError(format("could not set permissions on >> '%1%' to 1777") % perUserDir); >> + if (chmod(perUserDir.c_str(), 0755) =3D=3D -1) >> + throw SysError(format("could not set permissions on >> '%1%' to 755") >> + % perUserDir); >> mode_t perm =3D 01775; > > This is inside > > if (getuid() =3D=3D 0 && settings.buildUsersGroup !=3D "") { > =E2=80=A6 > } > > It's not clear to me why the second condition here is relevant, but I > don't have the big picture. Nor do I suspect I want it. Yeah =E2=80=98settings.buildUsersGroup !=3D ""=E2=80=99 probably doesn=E2= =80=99t make all that much sense here but it was already there and we strongly discourage against root without =E2=80=98--build-users-group=E2=80=99 anyway. Thanks for having lynx eyes! :-) Ludo=E2=80=99.