LWN: Comments on "Fedora and pkexec" https://lwn.net/Articles/883547/ This is a special feed containing comments posted to the individual LWN article titled "Fedora and pkexec". en-us Tue, 16 Sep 2025 11:05:50 +0000 Tue, 16 Sep 2025 11:05:50 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Fedora and pkexec https://lwn.net/Articles/885463/ https://lwn.net/Articles/885463/ cortana <div class="FormattedComment"> Perfect example of why maaaaybe JavaScript was not the best choice of language for extending PolKit. :)<br> </div> Sat, 19 Feb 2022 12:13:59 +0000 Fedora and pkexec https://lwn.net/Articles/885263/ https://lwn.net/Articles/885263/ mathstuf <div class="FormattedComment"> <font class="QuotedText">&gt; But then the problem resides in the libraries itself. reading that it sounds like polkit is just &#x27;patch&#x27; for bad written libraries.</font><br> <p> Badly written libraries are everywhere. Even so, it misses the case where the process doing the check needs higher permissions to be able to read some configuration file. Running every PAM-using process as `suid` on the off-chance a configuration file is not world-readable sounds like a terrible solution.<br> <p> <font class="QuotedText">&gt; Could you be more specific? Who shares permissions with whom in that example?</font><br> <p> Instead of having to have a way for a WINE process to load a PAM module to be able to check a password, you can implement &quot;talk to a socket&quot; without having to port some (typically very-Unixy) code over to Windows-isms. Rather, you just implement &quot;list users&quot; and &quot;authenticate this user&quot; APIs in terms of socket communication which sounds…way nicer IMO.<br> <p> <font class="QuotedText">&gt; I don&#x27;t really follow. Could you explain?</font><br> <p> C and C++ have terrible package management. How to use package $x differs based on the build system you use as well as the project you would like to consume. Alas, solving this is *hard* because C and C++ developers have gotten accustomed to all the power that &quot;make my own command line&quot; offers.<br> <p> Now, any C or C++-specific way that goes down a similar path as Python&#x27;s PyPI, Rust&#x27;s cargo, or Node&#x27;s NPM will have the issues of those ecosystems: that using any interface that is not the language under consideration is extremely hard. Sure `pip install h5py` works, but if I have another library that wants to use HDF5&#x27;s C interfaces, I&#x27;m SOL because `pip` has no way for such a thing to be offered or expressed as a strict enough dependency that ABI considerations require. NumPy is the only one that does it well and that&#x27;s because it is *only* a Python package, not another package being stuffed into the Python world.<br> </div> Fri, 18 Feb 2022 18:08:38 +0000 Fedora and pkexec https://lwn.net/Articles/885270/ https://lwn.net/Articles/885270/ cortana <div class="FormattedComment"> <font class="QuotedText">&gt; How do traditional Unix permissions encode things like &quot;Is this user currently logged in at a physical console&quot;?</font><br> <p> Another case where we could have learned from Windows. Handwaving a bit here but I believe you can create an ACE for S-1-2-1 (&quot;Console logon&quot;), which will be present in the token of all processes started by a user with a physical console logon session.<br> <p> (I&#x27;ve no idea how this handles revocation).<br> </div> Fri, 18 Feb 2022 14:09:18 +0000 Fedora and pkexec https://lwn.net/Articles/885258/ https://lwn.net/Articles/885258/ farnz <p>As an example of where the local process over UNIX Domain Sockets approach is strictly better than the library approach: there are ways to authenticate via a remote RADIUS server where I use machine secrets to establish an encrypted session with the remote server, and then send the user's credentials over that tunnel. If you do this via a library, then all processes on the system that need to authenticate need to be able to read the machine secrets, which implies that the machine secrets are world-readable. If, instead, you use a local process over a socket, that process can run as root, and the machine secrets need only be readable by root. Fri, 18 Feb 2022 11:29:41 +0000 Fedora and pkexec https://lwn.net/Articles/885257/ https://lwn.net/Articles/885257/ CodingVoid <div class="FormattedComment"> <font class="QuotedText">&gt; As someone who would like their program to be more robust, not having to load in arbitrary code into my process space makes me feel a lot better. Loading PAM or NSS plugins to do things on my behalf sounds a lot worse when they can take my process down instead of giving me back an error that I can explicitly handle. Some PAM plugins don&#x27;t even work as intended because their configuration files aren&#x27;t world-readable, so a separate process is just a better way with them.</font><br> But then the problem resides in the libraries itself. reading that it sounds like polkit is just &#x27;patch&#x27; for bad written libraries.<br> <p> <font class="QuotedText">&gt; Additionally, if one is running something like WINE or other architectures (QEMU or whatever), there can be more sharing of permissions instead of having to figure out how to make them load compatible plugins/configurations as well.</font><br> Could you be more specific? Who shares permissions with whom in that example?<br> <p> <font class="QuotedText">&gt; Sure, you can also link to these libraries at build time, but &quot;loading libraries&quot; is usually done in languages with…sad package management.</font><br> I don&#x27;t really follow. Could you explain?<br> </div> Fri, 18 Feb 2022 11:01:32 +0000 Fedora and pkexec https://lwn.net/Articles/885253/ https://lwn.net/Articles/885253/ farnz <p>That change happened in the days when systems were relatively static compared to today's setups. So your groups vector would be the same whether you were logged in or not, and thus a SGID binary wouldn't elevate <em>your</em> permissions; you could only use it as a way to elevate someone else to your permissions. <p>In contrast, giving away files to someone else is a hole in the world where everything's static; it lets you claim their quota, for a start. Fri, 18 Feb 2022 10:38:24 +0000 Fedora and pkexec https://lwn.net/Articles/885201/ https://lwn.net/Articles/885201/ nix <div class="FormattedComment"> <font class="QuotedText">&gt; but then they can create a sgid binary that would allow them to retain access</font><br> <p> I have long wondered why the ability to do this as a regular user didn&#x27;t go away at the same time as the ability to give away things with chown as a regular user. They seem to enable the same sort of evasive behaviour...<br> </div> Thu, 17 Feb 2022 20:14:22 +0000 Fedora and pkexec https://lwn.net/Articles/885061/ https://lwn.net/Articles/885061/ mjg59 <div class="FormattedComment"> That&#x27;s still not something you can encode as a permission - you&#x27;d have to look it up after determining which user has connected to the socket.<br> </div> Thu, 17 Feb 2022 02:12:19 +0000 Fedora and pkexec https://lwn.net/Articles/885034/ https://lwn.net/Articles/885034/ flussence <div class="FormattedComment"> <font class="QuotedText">&gt; How do traditional Unix permissions encode things like &quot;Is this user currently logged in at a physical console&quot;?</font><br> <p> I really wish the answer was as simple as `fuser -u /dev/tty* | grep $USER`. It isn&#x27;t, because X, but it could&#x27;ve been. Doesn&#x27;t even have to be a device file.<br> </div> Wed, 16 Feb 2022 19:11:59 +0000 Fedora and pkexec https://lwn.net/Articles/885023/ https://lwn.net/Articles/885023/ mathstuf <div class="FormattedComment"> <font class="QuotedText">&gt; I guess it&#x27;s all personal preference and all but I am more into using libraries instead of having 10 socket connections to some priviledged daemons, which do the stuff for me.</font><br> <p> As someone who would like their program to be more robust, not having to load in arbitrary code into my process space makes me feel a lot better. Loading PAM or NSS plugins to do things on my behalf sounds a lot worse when they can take my process down instead of giving me back an error that I can explicitly handle. Some PAM plugins don&#x27;t even work as intended because their configuration files aren&#x27;t world-readable, so a separate process is just a better way with them.<br> <p> Additionally, if one is running something like WINE or other architectures (QEMU or whatever), there can be more sharing of permissions instead of having to figure out how to make them load compatible plugins/configurations as well.<br> <p> There are tradeoffs, but given that `dlopen` can just run arbitrary code, I don&#x27;t like it for &quot;must not fail&quot; processes at all. Sure, you can also link to these libraries at build time, but &quot;loading libraries&quot; is usually done in languages with…sad package management.<br> </div> Wed, 16 Feb 2022 17:25:55 +0000 Fedora and pkexec https://lwn.net/Articles/884935/ https://lwn.net/Articles/884935/ CodingVoid <div class="FormattedComment"> I see your point.<br> I guess the root of the problem resides in the fact, that one needs to communicate with a daemon/priviledged process in the first case. First thing I do on my personal system, after installing my distribution of choice is disable/mask 80% of all systemd services/timers/sockets (of course I check whether I need the services features before disabling).<br> I guess it&#x27;s all personal preference and all but I am more into using libraries instead of having 10 socket connections to some priviledged daemons, which do the stuff for me.<br> </div> Wed, 16 Feb 2022 14:42:43 +0000 Fedora and pkexec https://lwn.net/Articles/884844/ https://lwn.net/Articles/884844/ sammythesnake <div class="FormattedComment"> CEL as in <a rel="nofollow" href="https://github.com/google/cel-spec">https://github.com/google/cel-spec</a> ?<br> <p> It took me a while to find the (hopefully) right &quot;CEL&quot; - it doesn&#x27;t appear to be on acronym finder or Wikipedia which usually find these things for me, so I thought out might be useful for others similarly out of the loop :-P<br> </div> Tue, 15 Feb 2022 15:51:13 +0000 Fedora and pkexec https://lwn.net/Articles/884702/ https://lwn.net/Articles/884702/ cortana <blockquote><p>You could have an acl on the socket and add them to that for the duration of their login period, but then we're already outside traditional Unix permissions and also they could just open the socket with a process that survives them logging out, and given there's no revoke() syscall in Linux you can't take that away from them.</blockquote> <p>As an aside, I have always wondered if the way udev grants console users access to <code>uaccess</code>-tagged devices is vulnerable to this problem. <pre>$ getfacl -p /dev/snd/pcmC0D0p # file: /dev/snd/pcmC0D0p # owner: root # group: audio user::rw- user:sam:rw- group::rw- mask::rw- other::--- </pre> <p>I presume that if I lock my screen, my processes will still have access to the audio/video devices and I could use them to spy on the next user who logs in... Mon, 14 Feb 2022 11:15:27 +0000 Fedora and pkexec https://lwn.net/Articles/884660/ https://lwn.net/Articles/884660/ mjg59 <div class="FormattedComment"> But then you&#x27;re relying on more than file permissions - you&#x27;re going to need to extract the user credentials from the socket connection, use them to look up some other source of data to determine whether the user is on a physical console, and then make a policy decision based on that. Rather than reimplement that everywhere, you might choose to make it some sort of generalised service that applications could make use of, and then you&#x27;ve got polkit.<br> </div> Sun, 13 Feb 2022 16:45:06 +0000 Fedora and pkexec https://lwn.net/Articles/884654/ https://lwn.net/Articles/884654/ CodingVoid <div class="FormattedComment"> <font class="QuotedText">&gt; How do traditional Unix permissions encode things like &quot;Is this user currently logged in at a physical console&quot;?</font><br> <p> I thought that&#x27;s what the utmp file is for. The login program as well as ssh login write in these. In case of an remote login via SSH, there is an ip address in the utmp line.<br> </div> Sun, 13 Feb 2022 12:28:49 +0000 Fedora and pkexec https://lwn.net/Articles/884641/ https://lwn.net/Articles/884641/ mjg59 <div class="FormattedComment"> <font class="QuotedText">&gt; I just don&#x27;t see the advantages compared to traditional Unix Permissions.</font><br> <p> How do traditional Unix permissions encode things like &quot;Is this user currently logged in at a physical console&quot;? One approach would be to add them to a group when they log in - but then they can create a sgid binary that would allow them to retain access. You could have an acl on the socket and add them to that for the duration of their login period, but then we&#x27;re already outside traditional Unix permissions and also they could just open the socket with a process that survives them logging out, and given there&#x27;s no revoke() syscall in Linux you can&#x27;t take that away from them.<br> <p> There are policy decisions you want to make that rely on the current state of a user, and filesystem permissions (traditional or ACL-based) don&#x27;t give a mechanism to enforce that.<br> </div> Sun, 13 Feb 2022 00:34:12 +0000 Fedora and pkexec https://lwn.net/Articles/884632/ https://lwn.net/Articles/884632/ CodingVoid <div class="FormattedComment"> <font class="QuotedText">&gt; I love suid and sudo no more, no less, and exactly the same as I love my screwdriver. I&#x27;m married to neither. Both are just tools. Both can be used, by people, correctly. Both can be used also, by people, incorrectly. But it makes no sense to use that as a reason for replacing screwdrivers with wrenches. </font><br> <p> I couldn&#x27;t agree more. I personally don&#x27;t understand why one would even need polkit in the first place. I just don&#x27;t see the advantages compared to traditional Unix Permissions. Compared to polkit (which uses DBus, which in turn uses Unix Sockets), I think it is simpler and more secure to just write a program with standard unix permissions in mind. If I need to use privileged system calls I just use capabilities. If I need to access some files owned by root, I add my user and the file to a Unix Group (maybe even ACL). If I end up needing some kind of authentication, I would probably use a PAM module. Using polkit I feel like making my System unnecessarily more complex instead of making it more secure. Although I have to admit I don&#x27;t have much experience using polkit, so I can&#x27;t say which advantages it has over traditional Unix ways.<br> </div> Sat, 12 Feb 2022 21:47:21 +0000 Fedora and pkexec https://lwn.net/Articles/884064/ https://lwn.net/Articles/884064/ bartoc <div class="FormattedComment"> I think the solution is &quot;make it easier to write correct suid programs&quot;, provide tools to correctly clear the environment and so forth.<br> <p> For things that are less general than pkexec/sudo something like selinux can reduce them from &quot;full suid&quot; a little bit.<br> <p> And yeah, SELinux is absolutely (and always) a bandage rather than a cure. It&#x27;s a defense in depth measure. It can do a good job stopping the bleeding though.<br> </div> Tue, 08 Feb 2022 08:09:00 +0000 Fedora and pkexec https://lwn.net/Articles/883978/ https://lwn.net/Articles/883978/ joib <div class="FormattedComment"> There are projects to extend the SO_PEERCRED kind of model to distributed setups like munge (<a href="https://dun.github.io/munge/">https://dun.github.io/munge/</a> ), widely used in the HPC world. Yes, using crypto.<br> </div> Mon, 07 Feb 2022 07:41:44 +0000 Fedora and pkexec https://lwn.net/Articles/883973/ https://lwn.net/Articles/883973/ flussence <div class="FormattedComment"> SELinux is more of a bandage than a cure. The root problem here (excuse the pun) is full suid-bit privilege auth programs being necessary for going between any two lesser privilege levels, the general flow being [regular user -&gt; unrestricted setuid 0 binary handling auth -&gt; privileged filehandles/capabilities]. I&#x27;m not sure how to fix that, but it does seem like there&#x27;s something we could be doing fundamentally better and not just &quot;write C code more carefully&quot;.<br> </div> Mon, 07 Feb 2022 03:45:50 +0000 Fedora and pkexec https://lwn.net/Articles/883917/ https://lwn.net/Articles/883917/ mjg59 <div class="FormattedComment"> The reason being that they&#x27;re exposed to untrusted input in a way that polkit isn&#x27;t?<br> </div> Sun, 06 Feb 2022 04:42:30 +0000 Fedora and pkexec https://lwn.net/Articles/883902/ https://lwn.net/Articles/883902/ khim <p>Firefox, like Chrome, doesn't trust it's renderers and sandboxes mozjs for a reason.</p> <p>Polkit does the exact opposite.</p> Sat, 05 Feb 2022 22:00:40 +0000 Fedora and pkexec https://lwn.net/Articles/883864/ https://lwn.net/Articles/883864/ NYKevin <div class="FormattedComment"> Just as a style nit: You may want to use === instead of == when writing Javascript. === does what you (probably) want, == tries to do implicit type coercion (poorly).<br> <p> Reference: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness">https://developer.mozilla.org/en-US/docs/Web/JavaScript/E...</a><br> </div> Fri, 04 Feb 2022 22:09:02 +0000 Fedora and pkexec https://lwn.net/Articles/883844/ https://lwn.net/Articles/883844/ cortana <div class="FormattedComment"> That proposed reasoning seems odd to me, mozjs is already exposed, via its use in Firefox, to the most hostile of all possible environments: the internet!<br> <p> I wish the reason was documented in the package&#x27;s README.Debian file...<br> </div> Fri, 04 Feb 2022 17:59:51 +0000 Fedora and pkexec https://lwn.net/Articles/883751/ https://lwn.net/Articles/883751/ gioele <div class="FormattedComment"> Even though expressing this kind of complex constraints with a INI-style configuration file is not feasible, in such a security-relevant piece of software it would had been more sensible to adopt and embed a small non Turing-complete language (for example CEL, available for C++ and Rust) instead of Javascript.<br> </div> Fri, 04 Feb 2022 11:00:58 +0000 Fedora and pkexec https://lwn.net/Articles/883748/ https://lwn.net/Articles/883748/ smcv <div class="FormattedComment"> You are correct, it&#x27;s not possible. Putting domain-specific extra information on an authorization request, and then using it as input to the authorization rules, is one of the major things that the JavaScript implementation can do and the old &quot;local authority&quot; (.ini-style .pkla files) did not have a representation for.<br> <p> For example, when the privileged service asking for authorization is systemd, the domain-specific extra information can include a systemd unit name, as used in your example rules.<br> </div> Fri, 04 Feb 2022 10:19:40 +0000 Fedora and pkexec https://lwn.net/Articles/883739/ https://lwn.net/Articles/883739/ zdzichu Looking at my polkit rules, I have stuff like “allow smart home system (running as unprivileged user) to start specific services” which translates to something like: <pre> polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.systemd1.manage-units") { var unit = action.lookup("unit"); if (unit == "toggle-bcache@writethrough.service" || unit == "toggle-bcache@writearound.service" || unit == "toggle-bcache@writeback.service") { var verb = action.lookup("verb"); if (verb == "start" &amp;&amp; subject.user == "openhab" ) { return polkit.Result.YES; } } } });</pre> How to express that in previous INI-language? I doubt it's possible. Fri, 04 Feb 2022 07:01:53 +0000 Fedora and pkexec https://lwn.net/Articles/883724/ https://lwn.net/Articles/883724/ mchapman <div class="FormattedComment"> Newer polkit still supports &quot;polkit local authority&quot; INI files through pkla-admin-identities + pkla-check-authorization. These can be invoked from the newer JavaScript-based authority, and the default polkit configuration does just that.<br> <p> I&#x27;m wondering if Debian doesn&#x27;t use a newer polkit simply because they object to using JS (or perhaps the old mozjs library?) in a security-sensitive context.<br> </div> Thu, 03 Feb 2022 23:07:08 +0000 Fedora and pkexec https://lwn.net/Articles/883688/ https://lwn.net/Articles/883688/ gnu_lorien <div class="FormattedComment"> Aren&#x27;t there C libraries that get this right? I&#x27;m wondering if this is one of the places where two ideas come to a head:<br> - Small LOC with less external dependencies are more secure<br> - Libraries can be used to encapsulate and require security practices<br> <p> I know when I read that a program is 100% self-contained I wonder, &quot;what common thing did they mess up?&quot; I know that others see this as a bonus feature all unto itself.<br> </div> Thu, 03 Feb 2022 16:29:58 +0000 Fedora and pkexec https://lwn.net/Articles/883650/ https://lwn.net/Articles/883650/ eru <div class="FormattedComment"> Thanks. I have not programmed with these unix-domain sockets, so did not know they have this kind of feature.<br> <p> </div> Thu, 03 Feb 2022 14:30:09 +0000 Fedora and pkexec https://lwn.net/Articles/883640/ https://lwn.net/Articles/883640/ pothos <div class="FormattedComment"> The question is which programs actually need the exact behavior of pkexec to behave like sudo and run a child process in the same process group. If you don&#x27;t need this, systemd-run is the better option already because it doesn&#x27;t use setuid but rather let&#x27;s pid 1 start a privileged systemd unit. You can even have systemd-run be somewhat command line compatible to sudo/pkexec (<a href="https://gist.github.com/pothos/73dd4f7694acc3b6bbed614438f6e2b1">https://gist.github.com/pothos/73dd4f7694acc3b6bbed614438...</a>).<br> </div> Thu, 03 Feb 2022 11:37:38 +0000 Fedora and pkexec https://lwn.net/Articles/883637/ https://lwn.net/Articles/883637/ pabs <div class="FormattedComment"> (c) replace more pkexec usage with DBus interfaces to daemons running as root.<br> </div> Thu, 03 Feb 2022 10:52:43 +0000 Fedora and pkexec https://lwn.net/Articles/883634/ https://lwn.net/Articles/883634/ cortana <blockquote>because the policy is free-form javascript rather than assignments that can be checked by any configuration scanners</blockquote> <p>On Debian (and derived distributions I guess) an older version of Polkit is shipped, which still uses the old 'pklocalauthority' where policy is written in static INI-like format, but you're limited to matching on properties like "is the requester a given user", "is the requester in a group<sup>*</sup>", "is the requster on an active console session", etc. <p>I go back and forward on whether this is good or not. The fragmentation between the Red Hat and Debian worlds here is aggravating. But the static policy is easier to understand! <p>* <a href="https://lists.fedorahosted.org/archives/list/sssd-users@lists.fedorahosted.org/message/DC4PXLRTXWPKHHXL75GBBJA3BZBEXEXP/">which it does in a broken way</a> <a href="https://gitlab.freedesktop.org/polkit/polkit/-/issues/24">(upstream bug)</a> that doesn't work in large installations, precisely the sort of installations that would like to use Polkit to control policy, argh! Thu, 03 Feb 2022 10:20:37 +0000 Fedora and pkexec https://lwn.net/Articles/883631/ https://lwn.net/Articles/883631/ larkey <div class="FormattedComment"> To me the gist of this is:<br> <p> 1. Split polkit &amp; pkexec<br> 2. Have polkit rules be more sane<br> <p> Further, either<br> <p> a) move an increasing amount of stuff from sudo to pkexec (or even build a drop-in binary with a one-time translation of sudoers to policykit rules); or<br> b) make a suid replacement mechanism with opt-in state?<br> <p> (a) seems more likely to happen, I think.<br> </div> Thu, 03 Feb 2022 09:40:52 +0000 Fedora and pkexec https://lwn.net/Articles/883629/ https://lwn.net/Articles/883629/ taladar <div class="FormattedComment"> The real problem is that we are still writing software in languages where the maintainer of every single program has to get these sort of things right instead of having something a bit higher level than raw pointer manipulation for something simple like argument handling that a large number of programs need.<br> </div> Thu, 03 Feb 2022 09:08:33 +0000 Fedora and pkexec https://lwn.net/Articles/883626/ https://lwn.net/Articles/883626/ pbonzini <div class="FormattedComment"> IIRC the default policy doesn&#x27;t allow any execve. There are various knobs to enable additional permissions such as httpd_ssi_exec and httpd_enable_cgi.<br> </div> Thu, 03 Feb 2022 08:23:28 +0000 Fedora and pkexec https://lwn.net/Articles/883623/ https://lwn.net/Articles/883623/ NYKevin <div class="FormattedComment"> I haven&#x27;t checked, but I would be completely astonished if the answer did not somehow involve SCM_CREDENTIALS and/or SO_PEERCRED over unix(7). That is the normal way of accomplishing this sort of thing.<br> <p> (If you want something that works in a distributed/multi-node setup, then you have to use signatures and certificates. This requires solving a number of PKI-related problems, which are difficult but not insurmountable for an organization of reasonable means. Fortunately, polkit mostly doesn&#x27;t get deployed in that fashion, to the best of my understanding.)<br> </div> Thu, 03 Feb 2022 08:13:49 +0000 Fedora and pkexec https://lwn.net/Articles/883618/ https://lwn.net/Articles/883618/ eru <div class="FormattedComment"> I wonder about that IPC approach. How does the server end of the IPC know the client is authorised to ask what is asks?<br> <p> </div> Thu, 03 Feb 2022 07:22:35 +0000 Fedora and pkexec https://lwn.net/Articles/883604/ https://lwn.net/Articles/883604/ bartoc <div class="FormattedComment"> for a program like pkexec it&#x27;s not clear what kind of selinux policy could help, after all the whole point is to run literally anything as root. Restricting what can run pkexec itself would be possible, and could break many exploit chains that use this bug before they even got to an unprivileged shell. <br> <p> Does fedora&#x27;s current selinux policy allow (for example) httpd to execute pkexec (or sudo)?<br> </div> Thu, 03 Feb 2022 00:16:08 +0000 Fedora and pkexec https://lwn.net/Articles/883591/ https://lwn.net/Articles/883591/ smcv <div class="FormattedComment"> <font class="QuotedText">&gt; I wonder if a first step might be to split out pkexec into a subpackage, and then gradually remove requirements on it</font><br> <p> I think that makes sense, and I&#x27;m looking at doing exactly that in Debian. That way, only systems that actually need pkexec (either because the sysadmin wants to be able to run it, or because another installed package relies on it) have to pay the attack-surface cost of having one more setuid executable.<br> <p> Some of polkit&#x27;s past CVEs have been vulnerabilities in its core functionality (briefly: replying to IPC requests &quot;foo has asked me to do bar, is that OK?&quot; with a yes or no), and not installing pkexec would not do anything to solve those; but some of its past CVEs (notably CVE-2021-4034) have been pkexec being insufficiently paranoid in the face of a hostile execution environment, and those are easy to mitigate by not having pkexec on systems that don&#x27;t need it.<br> <p> <font class="QuotedText">&gt; The thing with setuid/setgid is that the invoked privileged process inherits a lot of implicit state and context that people aren&#x27;t really aware of or fully understand. i.e. it&#x27;s not just env vars and argv[], it&#x27;s cgroup memberships, audit fields, security contexts, open fds, child pids, parent pids, cpu masks, IO/CPU scheduling priorities, various prctl() settings, tty control, signal masks + handlers, … and so on. And it&#x27;s not even clear what gets inherited as many of these process properties are added all the time. </font><br> <p> 100% this. pkexec is a relatively small program, which has been presumably looked at by lots of security-conscious people; it makes sure to avoid the obvious, well-known setuid traps, like clearing its environment variables before calling into &quot;big&quot; libraries; and yet it had this recent vulnerability, presumably because it didn&#x27;t occur to any of its maintainers, packagers or auditors that lower-level components (kernel and ld.so) would allow a process - particularly an AT_SECURE process! - to enter main() with argc == 0.<br> </div> Wed, 02 Feb 2022 22:31:19 +0000