From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Hamzeh Nasajpour <h.nasajpour@pantherx.org>, 52011@debbugs.gnu.org
Subject: bug#52011: pkexec: PATH environment variable
Date: Sun, 21 Nov 2021 15:52:24 +0100 [thread overview]
Message-ID: <57fde5d78af3ecc18b57191238cd81b0de65378e.camel@gmail.com> (raw)
In-Reply-To: <46b16bf3-e41c-4ccf-9817-879df6eeb8cb@www.fastmail.com>
Hi,
Am Sonntag, den 21.11.2021, 11:33 +0330 schrieb Hamzeh Nasajpour:
> The `PATH` environment variable is hard-code here:
>
> https://github.com/freedesktop/polkit/blob/master/src/programs/pkexec.c#L882-L886
>
> We don't have any executable in these paths in guix:
> ```
> /usr/sbin:/usr/bin:/sbin:/bin:/root/bin
> ```
>
> Replicate the issue:
> 1. Run the `pkexec`
> 2. Enter your password
> 3. run `echo $PATH` in the opened terminal
> 4. You will see this path: `/usr/sbin:/usr/bin:/sbin:/bin:/root/bin`
> 5. You can't run most of the commands. (`ls`, `passwd`, `chpasswd`
> and so on.)
>
> Expected Behavior:
> Running all of the commands without any error.
>
> Isn't it? Should not we patch the `PATH` environment variable in
> `pkexec` source codes? Either way, some applications like `lxqt-
> admin-user` and `lxqt-admin-time` has an issue and they can't run the
> commands via `pkexec`. I get this error when I want to change user
> password via `lxqt-admin-user`. It's using `pkexec` to change
> password.
I'm getting some flashbacks from my ITSec courses here. pkexec is
protecting itself against a malicious PATH attack. The paths are
chosen somewhat arbitrarily, but on traditional distros this ought to
ensure, that no privilege escalation occurs. We could inject
/run/current-system, given that /run likewise ought to be root-writable
only, but I'm not sure how much that helps. The obvious solution is to
use canonical (store) paths with pkexec.
Cheers
next prev parent reply other threads:[~2021-11-21 14:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-21 8:03 bug#52011: pkexec: PATH environment variable Hamzeh Nasajpour
2021-11-21 14:52 ` Liliana Marie Prikler [this message]
2021-11-28 7:39 ` Hamzeh Nasajpour
2022-09-09 16:10 ` Liliana Marie Prikler
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=57fde5d78af3ecc18b57191238cd81b0de65378e.camel@gmail.com \
--to=liliana.prikler@gmail.com \
--cc=52011@debbugs.gnu.org \
--cc=h.nasajpour@pantherx.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).