From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MNPEN4BdmmH1gwAAgWs5BA (envelope-from ) for ; Sun, 21 Nov 2021 15:53:52 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id aDZHM4BdmmHNHAAAbx9fmQ (envelope-from ) for ; Sun, 21 Nov 2021 14:53:52 +0000 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 9E34387F4 for ; Sun, 21 Nov 2021 15:53:52 +0100 (CET) Received: from localhost ([::1]:53296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mooE3-0004aE-QN for larch@yhetil.org; Sun, 21 Nov 2021 09:53:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mooDG-0004C6-JG for bug-guix@gnu.org; Sun, 21 Nov 2021 09:53:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:32929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mooDG-0007iC-AF for bug-guix@gnu.org; Sun, 21 Nov 2021 09:53:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mooDG-0005fw-53 for bug-guix@gnu.org; Sun, 21 Nov 2021 09:53:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#52011: pkexec: PATH environment variable Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 21 Nov 2021 14:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52011 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Hamzeh Nasajpour , 52011@debbugs.gnu.org Received: via spool by 52011-submit@debbugs.gnu.org id=B52011.163750635721783 (code B ref 52011); Sun, 21 Nov 2021 14:53:02 +0000 Received: (at 52011) by debbugs.gnu.org; 21 Nov 2021 14:52:37 +0000 Received: from localhost ([127.0.0.1]:44475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mooCr-0005fG-Dp for submit@debbugs.gnu.org; Sun, 21 Nov 2021 09:52:37 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42707) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mooCm-0005ex-6N for 52011@debbugs.gnu.org; Sun, 21 Nov 2021 09:52:35 -0500 Received: by mail-wr1-f68.google.com with SMTP id c4so27658723wrd.9 for <52011@debbugs.gnu.org>; Sun, 21 Nov 2021 06:52:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=OKggpluV2v0FgIRU5V4/ZoJ3p6nouMKd3AG8JbwWXuI=; b=dOmPhc6VUWHpBGrPqpE0LtmLWRtPT9JqdE3IfEUsu6fm6uwqLqpqdwSioyQonv8KHd VhRexQki1C3BJlQUuuH+nhCBprQksCfkUBUwV3IeFMg/HtcNQWivNk8j4agFGiLnbLXm hDQQOD6y8wRBYMvxoOwvDnvKM2Y+bC1XYnW/d4LIWBWGyvMKOOb8VjvwcAtKmnUiz9LU Kuu/BxFOz9HYVagVm+cFYw1wGOF4A5LN5QW7MzSRlXysJ+i20ULjSsliEcyXMj9utE7n HBB4IBENyjFBPS8njIJpnb3ECY7KxIKEAEYlIQJQpGpBLZxMkVeT6NkMQdd74QpcdKBu 5WVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=OKggpluV2v0FgIRU5V4/ZoJ3p6nouMKd3AG8JbwWXuI=; b=VzSkomueix/qioQeiLv7E4YvX/oKWah5M71xX3T2JuEK599Yh6MumTf7Fwr/9R2y9L 2BuoXnCrkzi0nOy2RUu+af3nNEsTqQGRl/AdT5YjiBOpURQD7Zyp3jE+kC/z7IBzGFiq 55p+bcI5icoTTE5Lmb8H65FkKasFGu69aCgzftACJPOV7swAJj1Mh4FBJ3MLg95YwaQ2 vkIjCRsDCipn1btiMDUhfu111WM0OvSqY80+7Q79DiPPrIGDN/RzX7EWMjBL7bMeZlHo EZbeG66sYwln/kM+y4z6w3VuhEPxjoP51alMXEGgl9rVuud6Nd8M+/2/dKUbK164qfuz YThw== X-Gm-Message-State: AOAM533UYLmIL89c5iKwrQKIlUIa4W2jzwFXQqQfaDcYT8JTNiYw3VSn u8zU6SQK4Ld+l5uXMqKh6QFSOFd5hsc= X-Google-Smtp-Source: ABdhPJx/bGBzsj0EdAPY3ByQEyhSKD+C/oDAgg1lXu/Sn9eqT4ntkkKyo4ghqBhuQiEikqQP2cvn0g== X-Received: by 2002:a5d:6147:: with SMTP id y7mr28209597wrt.217.1637506346193; Sun, 21 Nov 2021 06:52:26 -0800 (PST) Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id o12sm8171607wrc.85.2021.11.21.06.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 06:52:25 -0800 (PST) Message-ID: <57fde5d78af3ecc18b57191238cd81b0de65378e.camel@gmail.com> From: Liliana Marie Prikler Date: Sun, 21 Nov 2021 15:52:24 +0100 In-Reply-To: <46b16bf3-e41c-4ccf-9817-879df6eeb8cb@www.fastmail.com> References: <46b16bf3-e41c-4ccf-9817-879df6eeb8cb@www.fastmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1637506432; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=OKggpluV2v0FgIRU5V4/ZoJ3p6nouMKd3AG8JbwWXuI=; b=HonvM/D5EUHOWjIZWZrLSdz6qVSs8Gvph3cj6MHC0jWIilBcMdrEsh7PbOY9krPpkg6uHN d5YvkFrulJbrBD7/JxaOV+Uxj6ShpWZW/Pc5yzUBvuoBISZAqn6ouqEFyQ3C9eK050DJWv /Fhg0/UXMpudtKE3cnZf3w++TksqsZwW2245XQL834dYcHMJ43m4rCcjLIYKtFhL6WfVKp P784zJlKQQPngQf+iSGFvznYh7AL1HSLwS/AvUompLE7z2FiOHEt9OTMw0g5r0OOJyFr1c cx3BZ+i1ZGj0xXOFF3nY5BT4+YTMYTEnwdiOHyHGVSdVOCilUfGZTUK2oTuPgA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637506432; a=rsa-sha256; cv=none; b=tFKEn56Yp5RhZdxhlMemygBWmRPaKxRGAdOmQkbYRFmuzbnzdFsYpvozwzX+xCeAdplByn dJhDB2IDLPRy9N6v9447lXrmQQwzgzw/OgA97fxjrbli2Kh3FeL4pFZkDlO/K0UzldWxAQ X4V8nCNUmEbv+wJdFUeGNlKI0del9EvNTXmznK4SUXM97a0HVZe9xm0looRsEGM8SgvG1T uu/2IFztdpcIhLDgDUjgHlwYPXQU2AdCqoeiY9QvykUvhWJzCczl8pKu+41UMQUTeQXQoS NU81ID6ge+XX6VPLf11n0zOoIIaqdP0BUevIiOqNtHYDyvqdfUgXyF27X319Sg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=dOmPhc6V; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.78 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=dOmPhc6V; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 9E34387F4 X-Spam-Score: -1.78 X-Migadu-Scanner: scn0.migadu.com X-TUID: kr7uBRKEhkpE 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