zsh-users
 help / color / mirror / code / Atom feed
From: Andrew Parker <andrew.j.c.parker@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Daniel Shahaf <d.s@daniel.shahaf.name>, Zsh Users <zsh-users@zsh.org>
Subject: Re: Thoughts on protecting against PATH interception via user owned profiles
Date: Tue, 17 Dec 2019 21:34:33 +0800	[thread overview]
Message-ID: <CAG78ipWUt5yxkxousiSVco5_NbU0b87A+9CN2CC_2BjXNB8okQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7a5tt5NSAWXz_Av9KgLUSChj6mSE+Yx_H-OHOFF8Abx3A@mail.gmail.com>

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

I think there's a major difference here in the way Apple's sudo works. It's
simple to check on macOS that *sudo env* preserves PATH (but not other
variables). It can be fixed with *secure_path* in sudoers file. Possibly
other nix systems fix this with *secure_path *by default? Don't have access
to my VMs right now to check.

On Mon, Dec 16, 2019 at 3:48 AM Bart Schaefer <schaefer@brasslantern.com>
wrote:

> Daniel has pretty well summed this up, but just one thing:
>
> On Sat, Dec 14, 2019 at 11:58 PM Andrew Parker
> <andrew.j.c.parker@gmail.com> wrote:
> >
> > Consider Homebrew. The installation script calls sudo. The root shell
> > inherits my user's env. Brew them executes numerous commands that can be
> > intercepted. My system is now forever compromised.
>
> That's not how sudo normally works.  In most cases sudo discards the
> environment and replaces it with a default system-configured one.  To
> run with the user's environment, it is both necessary to invoke "sudo
> -E", and for the security policy associated with that user to permit
> preserving the environment.
>
>        -E, --preserve-env
>                    Indicates to the security policy that the user wishes to
>                    preserve their existing environment variables.  The
>                    security policy may return an error if the user does not
>                    have permission to preserve the environment.
>
> It is the responsibility of the program that escalates the privilege
> to make sure it is not making unsafe assumptions, not the
> responsibility of the shell (or any other program) in the
> non-privileged state.
>

  reply	other threads:[~2019-12-17 13:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-15  6:27 Andrew Parker
2019-12-15  7:14 ` Daniel Shahaf
2019-12-15  7:57   ` Andrew Parker
2019-12-15  8:49     ` Daniel Shahaf
2019-12-15 17:42     ` Lewis Butler
2019-12-15 18:57     ` Grant Taylor
2019-12-15 19:47     ` Bart Schaefer
2019-12-17 13:34       ` Andrew Parker [this message]
2019-12-15  8:41 ` Roman Perepelitsa
2019-12-15  8:49   ` Andrew Parker
2019-12-15 14:31   ` Andrew Parker
2019-12-15 14:43     ` Roman Perepelitsa
2019-12-17 13:35       ` Andrew Parker
2019-12-16  4:10   ` Daniel Shahaf

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

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

  git send-email \
    --in-reply-to=CAG78ipWUt5yxkxousiSVco5_NbU0b87A+9CN2CC_2BjXNB8okQ@mail.gmail.com \
    --to=andrew.j.c.parker@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.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.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).