unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 37744@debbugs.gnu.org
Cc: guix-security@gnu.org
Subject: bug#37744: Per-user profile directory hijack (CVE-2019-17365 for Nix)
Date: Thu, 17 Oct 2019 18:18:49 +0200	[thread overview]
Message-ID: <87blufny52.fsf@gnu.org> (raw)
In-Reply-To: <878spksty3.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 16 Oct 2019 15:25:56 +0200")

[-- Attachment #1: Type: text/plain, Size: 777 bytes --]

Hi!

Ludovic Courtès <ludo@gnu.org> skribis:

> In addition to the news entry that ‘guix pull’ will display, we may want
> to publicize the issue.  In particular, should we:
>
>   1. Apply for a new CVE?
>
>   2. Post an article on the blog to explain in detail what happened?
>      That should probably include an analysis like that at
>      <https://www.openwall.com/lists/oss-security/2019/10/09/4>, given
>      that Guix does things not entirely like Nix here.
>
>   3. Email that analysis to oss-security?
>
>   4. Push a new release?
>
> I’m tempted to think that we should do 1 to 3, as quickly as we can.
> Help welcome, in particular on #2!

Attached is a draft based on ‘etc/news.scm’.

Let me know what you think!

Ludo’.


[-- Attachment #2: insecure-permissions.md --]
[-- Type: text/plain, Size: 3739 bytes --]

title: Insecure permissions on profile directory 
date: 2019-10-05 14:30
author: Ludovic Courtès
tags: Security
---
We have become aware of a security issue for Guix on multi-user systems
[that we have just fixed](https://issues.guix.gnu.org/issue/37744).
Anyone running Guix on a multi-user system is encouraged to upgrade
`guix-daemon`—see below for instructions.

# Context

The default user profile, `~/.guix-profile`, points to
`/var/guix/profiles/per-user/$USER`.  Until now,
`/var/guix/profiles/per-user` was world-writable, allowing the `guix`
command to create the `$USER` sub-directory.

On a multi-user system, this allowed a malicious user to create and
populate that `$USER` sub-directory for another user that had not yet
logged in.  Since `/var/…/$USER` is in `$PATH`, the target user could
end up running attacker-provided code.  See
https://issues.guix.gnu.org/issue/37744 for more information.

This issue was initially [reported by Michael Orlitzky for
Nix](https://www.openwall.com/lists/oss-security/2019/10/09/4)
([CVE-2019-17365](https://nvd.nist.gov/vuln/detail?vulnId=CVE-2019-17365)).

# Fix

The [fix](https://issues.guix.gnu.org/issue/37744) consists in letting
`guix-daemon` create these directories on behalf of users and removing
the world-writable permissions on `per-user`.

For [cluster
setups](https://hpc.guix.info/blog/2017/11/installing-guix-on-a-cluster/)
where clients connect to the daemon over TCP ([thanks to the `--listen`
option of
`guix-daemon`](https://guix.gnu.org/manual/en/html_node/Invoking-guix_002ddaemon.html)),
the fix _requires_ `guix-daemon` to be able to resolve user names so
that it can create `/var/…/per-user/$USER` with the right ownership.
Note also that the `guix` command prior to this fix would not
communicate the user name it’s running under to the daemon, thereby
preventing it from creating that directory on its behalf.

# Upgrading

On multi-user systems, we recommend upgrading the daemon now.

To upgrade the daemon on a “foreign distro”, run something along these
lines:

```
sudo guix pull
sudo systemctl restart guix-daemon.service
```

On Guix System, run:

```
guix pull
sudo guix system reconfigure /etc/config.scm
sudo herd restart guix-daemon
```

Once you’ve run `guix build hello` or any other `guix` command, you
should see that `/var/guix/profiles/per-user` is no longer
world-writable:

```
$ ls -ld /var/guix/profiles/per-user
drwxr-xr-x 5 root root 4096 Jun 23  2017 /var/guix/profiles/per-user
```

Please report any issues you may have to
[`guix-devel@gnu.org`](https://guix.gnu.org/contact/).  See the
[security web page](https://guix.gnu.org/security/) for information on
how to report security issues.

#### About GNU Guix

[GNU Guix](https://www.gnu.org/software/guix) is a transactional package
manager and an advanced distribution of the GNU system that [respects
user
freedom](https://www.gnu.org/distros/free-system-distribution-guidelines.html).
Guix can be used on top of any system running the kernel Linux, or it
can be used as a standalone operating system distribution for i686,
x86_64, ARMv7, and AArch64 machines.

In addition to standard package management features, Guix supports
transactional upgrades and roll-backs, unprivileged package management,
per-user profiles, and garbage collection.  When used as a standalone
GNU/Linux distribution, Guix offers a declarative, stateless approach to
operating system configuration management.  Guix is highly customizable
and hackable through [Guile](https://www.gnu.org/software/guile)
programming interfaces and extensions to the
[Scheme](http://schemers.org) language.

  parent reply	other threads:[~2019-10-17 16:20 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14  7:47 bug#37744: Per-user profile directory hijack (CVE-2019-17365 for Nix) Ludovic Courtès
2019-10-14  7:58 ` Ludovic Courtès
2019-10-14 11:53   ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2019-10-14 16:37     ` Maxim Cournoyer
2019-10-15 12:34     ` Ludovic Courtès
2019-10-15 14:31       ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2019-10-16  6:57         ` Ludovic Courtès
2019-10-16 10:22           ` Ludovic Courtès
2019-10-16 13:25             ` Ludovic Courtès
2019-10-16 14:22               ` pelzflorian (Florian Pelz)
2019-10-16 15:16                 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2019-10-16 15:19                   ` pelzflorian (Florian Pelz)
2019-10-16 15:23                     ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2019-10-16 17:05                       ` Ludovic Courtès
2019-10-16 19:50                         ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2019-10-16 19:55                           ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2019-10-16 21:40                             ` Ludovic Courtès
2019-10-16 21:41                             ` Ludovic Courtès
2019-10-16 19:58                         ` Julien Lepiller
2019-10-16 21:38                           ` Ludovic Courtès
2019-10-16 15:37                 ` pelzflorian (Florian Pelz)
2019-10-16 21:39                   ` Ludovic Courtès
2019-10-17  2:58                     ` pelzflorian (Florian Pelz)
2019-10-17  3:01                       ` pelzflorian (Florian Pelz)
2019-10-16 20:28               ` Ludovic Courtès
2019-10-17 16:18               ` Ludovic Courtès [this message]
2019-10-17 19:01                 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2019-10-17 20:25                   ` Ludovic Courtès
2019-10-18  2:21                     ` Bengt Richter
2019-10-18 14:36                       ` Ludovic Courtès
2019-10-19  1:32                         ` Bengt Richter
2019-10-16 14:12             ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2019-10-16 20:01               ` Ludovic Courtès
2019-10-16 16:28             ` Julien Lepiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blufny52.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=37744@debbugs.gnu.org \
    --cc=guix-security@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).