Pwnkit: Local Privilege Escalation in polkit's pkexec (CVE-2021-4034)
seclists.org
seclists.org
Beautiful indeed.
argv[0] always exists in normal means, it is either physical path of the executable or soft link position. Without accidents like run a program from code and forget about passing argv. That couldn't happen at all. And in fact, most cross platform program or shell even just assume argv[0] is the same as executable path (and don't give you a option to change it, because it is not possible on all platforms).
if (argc < 1) {
exit(126);
}
if (argv[n] == NULL) {
exit(128)
}
// But this could never ever happen?
if (argv == NULL)After a bit google I realize I need to repeat the file path by myself on *nix. In windows, the spawn equivalent take a long string, anything after file path is argument. So it can't be a bug since day 1.
The tradeoff being that even reliably getting a Windows program in C to receive a given value in argv[] is awful[1], and the full rules for what happens if you’re unfortunate enough to need to pass through the shell are truly horrendous[2] (as well as, of course, nearly undocumented). Oh, and there is literally no way to pass arguments through in a batch file[3] (i.e. no reliable equivalent to "$@").
The reason is that command lines being dumb strings (as they are in DOS and consequently Windows) means that there are at least two places where command-line parsing needs to happen: in the shell, to detect shell syntax, including simply knowing where the command ends; and in the program (C runtime library startup or equivalent), to separate, unquote, and unescape the string into an arguments array. Thus there are at least two sets of escaping rules in play at the same time, which will inevitably diverge. (In Windows there are something like three and a half, given that executing from a batch file adds an additional layer of textual preprocessing and delayed expansion uses slightly different rules, but that is not inherent in the design choice, it’s just braindamage.)
I actually find this an interesting design problem (and have commented on it before[4]), because while the depths of insanity in the Unix approach (the shell tokenizes and globs) aren’t quite as unfathomable, the touch ./-rf; rm * problem that it implies still feels like something that shouldn’t happen, and I just can’t see an interesting intermediate point between those that wouldn’t substantially complicate the shell-to-entry-point interface.
[1] https://daviddeley.com/autohotkey/parameters/parameters.htm#...
[2] https://stackoverflow.com/a/4095133
Seems like a good use case for Android style API levels, but only if used very sparingly and with old ones not removed.
> however, we note that OpenBSD is not exploitable, because its kernel refuses to execve() a program if argc is 0.
Some weeks ago I wanted to run a game; it showed an error when starting that it failed to set real-time priority for the audio thread, resulting in actual audio stuttering.
ALAudio asks rtkit, rtkit asks polkit, and that somehow fails. Why? Who knows. To even figure this out I had to recompile rtkit with some strategic printf() calls in there, because it just doesn't show at all why it failed. Same for polkit.
I never did find out what the problem was. I just gave up after a while.
It's stuff like this why I dislike all these tools: it all works when it works, but when it fails it really makes your life hard. Here, too, it just exits with 126, no message, and good luck to you as developer or user if something goes wrong.
Call me a radical traditionalist unix greybeard, but I really think tools should tell users what goes wrong, even (or perhaps especially) when they're "internal" tools like this, because this it's just really hard to figure out what the problem is. "fprintf(stderr, "too few arguments\n")" is not very hard, it seems to me shrug.
[1]: https://gitlab.freedesktop.org/polkit/polkit/-/commit/a2bf5c...
What is missing in all these complaint threads (and this isn't aimed at you specifically) is the complainers' proposed alternatives. It's very easy to write a glib comment about "sudo already does this" "groups already do this" which indicates only that the person writing the comment doesn't understand the problem that PolKit is trying to solve.
What I lament is not so much that things have changed, but that things have changed in ways I no longer understand or can debug. Back in the Old Days™ you could more or less understand your entire system from a few very basic principles. If something didn't work, you could go in there and usually figure it out on your own.
Not that I have rose-coloured glasses about the Old Days™. I remember having to run that horrible "xfree86 -configure" thing when I was starting out with this whole Linux thing. Clearly, things are better now because the last time I had to look at "configuring X" is so long ago I don't even remember how to do it (or even what that filename was; /etc/x.conf? Or /etc/x11.conf? Not sure).
I don't think it has to be like this. Just because "su" and "sudo" aren't sufficient and the concepts in e.g. Polkit are good doesn't mean the implementation of these concepts also is.
I won't say PolKit's implementation is the best ever. But it exists, and solves real problems, enough so that applications choose to use it and distros choose to ship it.
One thing I can say in PolKit's favour is that it's well documented--which is important for such a critical component.
Fault them for not changing the loop, which has clearly busted logic, and adding a guard clause instead. But you can't fault them for not providing a user friendly error to shellcoders. The condition here isn't simply "too few arguments".
Either way: when in doubt, best to print a message! You're right this specifically probably isn't the biggest issue, but in general it seems to be design with "this should never happen, just exit/deny" in mind, and turns out that in some odd cases those things do happen.
char* args[] = {NULL};
execv("./a.out", args);
If someone did this by accident (as it's a programming error) then they should be told, instead of the unhelpful exit. That's my point.I suspect that the person who kicked this subthread off didn't realize that the error can't be triggered from the shell (like, they thought it was "insufficient arguments" and not "malformed input to execve"), and now we're just bikeshedding a justification for being angry at Unix error codes. Seems like not a super valuable discussion to have.
One good reason not to have a user-friendly error message here is that literally no user will ever see it. In fact: it's likely that in the entire history of this program, it has never once been executed in the fashion that would generate this error, except to exploit it.
strace
Nowadays I just reach for it immediately. Powerful, total/complete (since syscalls are everything). The typical unix tools all depend on these hard to discover environment things. Other processes, env vars, files here or there, sockets, dbus, signals...
It's a way to let user processes communicate with privileged processes while potentially, action dependent also prompting the user for a password.
pkexec on the other hand is separate program bundled with polkit which is kinda which let's you combine polkit with running predefined commands, or easily accidentally any command and IMHO should not exist.
there are various programs which work with polkit (even if they don't necessary require it) including:
- systemd, logind, NetworkManager, udisks, flatpack, fwupd, timedate(setting), and others
It also allows rather flexible configurations about what users can do which actions under which conditions, which can be quite useful for a multi-user server (e.g. GPU server).
While I think a program like polkit is a must have for a modern Linux OS I'm not a fan of it's design.
- pkexec is a bad idea for many more reasons then this vulnerability
- the way it's configured and how it handles caching is prone to accidentally make mistakes with security consequences
- pkexec should not exist, even without the vulnerability it's really easy to mess up using it
- having a embedded language for handling permission scripting, and not inventing your own language or pseudo-language config format is a good. But js? I guess there are simple embedded js interpreters.(1)
(1): Note that it only runs small snippets, so no need to have a JS interpreter with modern features like classes, or an JIT ;=)
- systemd, logind, NetworkManager, udisks, flatpack, fwupd, timedate(setting)
you have a good start on the list of common programs that I distrust the most. Plus polkit itself, I guess.
In fact a duktape backend has just landed:
https://gitlab.freedesktop.org/polkit/polkit/-/merge_request...
Speaking of security though, I'd trust SpiderMonkey much more because it's battle-tested in the most hostile environment imaginable (millions of browser instances loading completely untrusted code 24/7). But in this context we don't execute untrusted code so whatever :)
> pkexec should not exist
Hmm. For things that do want "just a graphical sudo" for whatever reason, it is kinda the perfect answer. Reusing the per-desktop authorization UI that is used for more fine-grained actions for a sudo-like tool is the correct thing to do. No one wants to have more redundant authorization mechanisms and UIs…
Enough OSes are behind and everyone using spidermonkey is unable to keep up with the porting requirements in the short window of ESR overlap so you can read vulnerabilities for the latest ESR and apply them to everyone. It would be nice if duktape had complete sandboxing, etc, but it has the advantage that hackers have to do all their own research to mount an attack.
(I would have to read through the polkit doc again, but there was some massive trap around how polkit configs work and how pkexec _might_ be used, I think related to the "permission caching feature").
We already have sudo and su (and doas) for such things. But those programs need to reinvent the wheel.
For instance, GNOME Settings uses PolKit to ensure that remote control can only be turned on by an admin who makes the request from an active session on a local console.
Or here's a more interesting example. gvfs uses PolKit to allow processes that are part of an active session on a local console to be able to elevate permissions for editing files (e.g., 'gedit admin:///etc/motd').
Back then it would segfault randomly for no apparent reason, idle freshly installed fairly minimalist headless fileservers. We immediately blacklisted it from our systems, but were lucky to not actually need anything it brought to the table.
IIRC for quite some time there wasn't even a maintainer, but I think that was pre-polkit rename. Hopefully the situation has improved.
Sounds like they made the right choice. Why would other kernels allow this?
NB, this was partially fixed in gnulib in 2009:
http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=b06da86eb05ed57e2861061ae5cacf4c7a3686f1
But glib has its own copy of this code, which hasn't been updated since 2008.
Embedded code copies are terrible, people really need to start removing them, or at least learning how to update them.I don't find it on any of the servers I manage, it appears to be installed with graphical desktop only?
The C library is something that I actually need, unlike a GUI sudo prompt for.. audio? I don't even know what such a prompt looks like because I've never seen one.
> If these libraries shipped with your distro, you asked for them.
If a bomb ships with a package you ordered, you asked for it.
Or maybe not? Maybe I didn't ask for it but a bunch of devs decided that (quoting you) "the users all want" it and I wasn't there to keep tabs on them.
And now that I know better, yes, I am looking for alternative distros because the ones I've been using include too many things I didn't ask for.
Sure, security also was not great for decades. I know what you mean you don't have time to vet packages, very few people have time to do that, that's usually why you'd trust a vendor to do it for you and not keep second guessing their decisions because they published and fixed a CVE.
>I am looking for alternative distros because the ones I've been using include too many things I didn't ask for.
That's great, I wish you luck. Just keep in mind, eventually if you find you want to put a security prompt on something for whatever reason (maybe you find yourself shipping something to a less technically inclined user), I expect you will circle back around to the same solutions. They're there for you to use them. At that point it becomes whether the frustration with XML and Javascript is worth rewriting it with a different configuration format and scripting language. Maybe you also want to take these tools written in C and rewrite it in Go or Rust or something, I don't know. I would not say it's worth it unless you have some really extreme requirements. This doesn't to have the most expressive DSL you can think of it, it just needs to encode some simple logic in a well-understood way.
Yes, I'm inevitably putting some trust in vendors. Unfortunately I'm having a hard time finding vendors (especially Linux vendors) that I can trust to make decisions that I find sensible and more or less in line with my intended usage of the system.
I have some experience with OpenBSD (after using it for more than a decade on a server and a few years on a laptop), and I can say with reasonable confidence that they would have never allowed polkit to be a part of their system in the first place. Similar to how they eventually said no to kerberos and just purged it. Similar to how they've refused things like PAM. Similar to how audio kept working fine with sndio (a very simple library & daemon) while I constantly had to battle the overcomplicated audio subsystem and ever-churning daemons on Linux..
That's the kind of Linux vendor I would like: a vendor who's trying to build something simple, and not something that tries to be maximally flexible and "everything for everyone". A vendor who can make decisions and if needed, build their own thing that suits their goals instead of shipping the same things every other distro ships.
There certainly are hundreds of distros as you say, but most of them offer little more than a different coat of paint, and ship the same third-party packages with more or less the same dependencies as you would have on any other Linux distro. After you've installed the few things you need, it doesn't matter much whether the banner says Arch, Fedora, Ubuntu, or whatever (in fact I run all three right now).
> That's great, I wish you luck.
Thank you.
Or maybe you asked your computer to do something as basic as give a web page access to your webcam, microphone and a screen capture of your desktop.
A GUI sudo if you will, with XML and javascript code for its configuration files.
I'm not near my computer, but I would guess pipewire (as it usually runs within the users session) might rely on it to access the sound hardware without needing to run as root. But just guessing.
https://wiki.debian.org/PolicyKit
PolicyKit is an application-level toolkit for defining and handling the policy
that allows unprivileged processes to speak to privileged processes, in order to
grant some user the right to perform some tasks in some situations. It is
sometimes referred to as "the sudo of systemd".
Sample uses:
Let the user Hibernate and shutdown the computer.
Let the user manage (Wireless) connections.
Let the user mount/eject a removable media (CD/DVD, USB keys...)
Let the user access devices, like audio, scanner, etc.
We already had a solution for this before: you add the user to the 'audio' group. And SELinux could do this too. But apparently RedHat just wanted another layer (https://lwn.net/Articles/258592/)."This is better than groups and setgid processes, because it means someone can't log in over ssh and mess with another user at the console." - Because that's what desktop users are really concerned about. We need more complexity because somebody might hax0r my desktop over SSH.
And, wow, they really actually did use XML as their configuration:
<match action="org.freedesktop.hal.storage.mount-fixed">
<match user="davidz">
<return result="yes"/>
</match>
<match user="freddy">
<return result="no"/>
</match>
</match>
So, not only is it superfluous, it also doesn't make the user's life easier, it's super annoying to configure, everything depends on it, and now the thing intended to improve security has caused a security issue.How many groups do you think there are? There's only so many classes of hardware, so there's only so many groups. About 8 in total. You add the user to all of them at once. It worked just fine before polkit arrived.
Why would you want to temporarily grant privileges to hardware once? Who is trying to prevent the user from using their own hardware?
What's the very good reason all desktops use it?
>Who is trying to prevent the user from using their own hardware?
I don't understand this question. The functionality here is equivalent to sudo, you type your password to authenticate a certain action. As the sysadmin you can configure some actions to always accept or always deny, if you want.
You can do this with sudo too.
It'd be a problem if more than one user in logged in to the local console, in a multi head environment for example. But those are rare, and already have to solve the same problem for other console related devices such as mice and keyboard.
FSVO "all". Mine doesn't use it. If I have a task that needs elevated privileges, I run it from a terminal. Seems to work for me.
Just to follow this discussion a bit further: If you have a task that /really/ needs elevated privileges you could turn it into a kernel module. That's great for you if you want to do that, but will you tell everyone else to develop kernel modules for every little thing? I don't think I would. I'm happy to give the muggles a better interface.
There's a bunch of influential people that are bent on making "Linux desktop" be something that competes effectively with Windows and MacOS. Setting aside that I don't think those are particularly desirable objectives in the first place, I simply don't see it happening. Despite their deficiencies, Windows and MacOS work better than Linux desktops.
A lot of the Linux desktop effort seems to really be "Linux laptop" - Linux support for machines that are constantly moving from one hotspot to another, and constantly having storage and other devices plugged in and unplugged. That isn't my use-case. Most of my Linux machines are servers with no GUI. The one with a GUI doesn't travel, and gets something plugged into it maybe once a month.
I realise that my usage pattern isn't universal; I was just correcting the claim that "all desktops use it". You only need one counterexample to refute such a claim.
And not necessarily with the interests of Windows or MacOS end users, but more corporate interests.
I think a lot of Windows users for example were and would still be fine with a system that is effectively a single-user desktop. A permission prompt to prevent random apps from spying on you using your microphone and camera is probably a Good Idea for the average user but all this user policy business is just pointless; users themselves should always have access to their own devices anyway, just as they would on old Windows installs where the user was typically the only user and always administrator.
And yeah, I don't like that a few people get to define what exactly constitutes a desktop for everyone. Especially if under the guise of "this is what a modern desktop requires" they're free to turn the platform into a bloated, overcomplicated mess.. exactly the kind of thing I was happy to get away from when I left proprietary operating systems behind two decades ago.
From what I have seen, the amount of users that want to go back to the Windows 95 style of security are an even fewer people. You can find distros that still ship a desktop from that era but they don't seem to be for much beyond novelty.
Please don't speak for everyone. It's exactly this patronizing we-know-better-than-you attitude that makes users hate their corporate software vendors.
> From what I have seen, the amount of users that want to go back to the Windows 95 style of security are an even fewer people.
I knew someone would immediately reply with this straw man as soon as they saw mention of old Windows. I said user policies are pointless for a single-user desktop. It's irrelevant whether dave and samantha can access the audio device in john's session because dave and samantha don't exist on john's personal computer and he sure ain't running an ssh daemon for them.
I'm not speaking of corporations here, this is basically every current desktop environment that is shipping on Linux right now. They are all either using polkit or they use something very similar to it because the idea of it (user asks to perform an action, show a prompt) is very straightforward and pretty much universal for GUIs by now. Some of them may be business-oriented but some aren't. If this doesn't fit the definition of "everyone" using desktop Linux then who else are you considering? And just to clarify, I would say using sudo with a fine-grained config is roughly equivalent to polkit, although less convenient for GUI users because it doesn't have pluggable authentication agents.
>I knew someone would immediately reply with this straw man as soon as they saw mention of old Windows. I said user policies are pointless for a single-user desktop.
This itself is a strawman though. Polkit and sudo and such are not strictly about user policies although you can use them for that.
Why would I want permission prompts? Most systems are single-user systems; if you're logged in, you're the administrator, even if you haven't yet invoked your superpowers. Arguambly you should have to confirm if you want to do something dodgy; but if all you have to do is say "Yes, thanks for the warning", then you don't need any kits.
Really, I have difficulty imagining this group of Linux users who are constantly hot-laptoping, so that they need multi-user support sprinkled all over the OS. I can see that it's useful in a pair-programming environment, where you might have a lab or workstations with a standard config; but apart from that, how often does someone else log in to a desktop/laptop computer you normally use? Or one you own?
I don't think hotdesking and hotplugging are urgent consumer requirements. I don't think the people producing this stuff are aiming it at consumers.
> or write something very similar to it
Or use what was written before, if it matches your use-case. That worked, for many people. Still does for some.
This is why polkit actions are the way they are, so you actually have a chance of being able to encode those one-off tasks into permissions for a GUI. It's not implemented for everything that requires root, and it probably won't ever be implemented for all of it but it's a lot better than it used to be. Part of it is improving because desktops like KDE made it easier to plug in new panels to the system settings, another part is that applications started using the higher level D-Bus APIs (like udisks2, timedated, networkmanager, etc) instead of trying to access the raw devices themselves.
>There's a bunch of influential people that are bent on making "Linux desktop" be something that competes effectively with Windows and MacOS. Setting aside that I don't think those are particularly desirable objectives in the first place, I simply don't see it happening. Despite their deficiencies, Windows and MacOS work better than Linux desktops.
I don't disagree with the last part here but, companies like Canonical exist and they get paid to ship this stuff. There are customers out there who want this, and they may very well be the ones paying some money or contributing maintenance towards keeping your browser and media player working on Linux. I don't know any overarching reason why these customers would deploy Linux instead of Windows, you would have to ask them.
>I realise that my usage pattern isn't universal; I was just correcting the claim that "all desktops use it". You only need one counterexample to refute such a claim.
Sorry but I don't think any usage of the terminal is a counterexample. That's just sidestepping the desktop, you could also do that from a VT with no GUI present.
Not the applications that I use! The machine in question doesn't have dbus or systemd. It only has one user. That layer of complexity is of zero value to me, but it's the very devil to get rid of it all.
> Sorry but I don't think any usage of the terminal is a counterexample.
If, on Windows, you have to perform a task for which there is no pre-made GUI app you can install, then you have to run-up powershell or cmd. My case is identical. I specifically referred to one-off tasks.
It's not my use of terminals that is the counterexample; it's the fact that I run a desktop without polkit (or anything-kit).
Yes you can technically build a system without dbus or systemd or polkit or gettext or the C library or whatever it is you feel is superfluous. As you've found it is not actually difficult to do that, just tedious and impractical. You aren't gaining anything here by removing things. If you want equivalent functionality you're now tasked with building the equivalents, e.g. Android which is also a single user userspace for Linux without dbus or systemd, but has its own fairly complex set of high level services and IPC system.
That is the opposite of what I have found; I find that it's "the very devil" to remove these components. And my finding is that the presence of these components is tedious and impractical, and that their absence makes my life better.
> You aren't gaining anything here by removing things.
That is condescending.
I've used machines with these services and I've used machines without. I find it's a gain to not have them. Who are you to tell me whether I do or don't gain anything?
FTR I don't have to build anything; there are alternatives, which I use. Unfortunately these new components are more-or-less rivetted-in, which makes it hard to remove them and replace them. Screws are better than rivets.
I am sure that somewhere having an actual programming language available vs list of what can and can't be run with or without a password would enable some additional power in terms of control of the system but I cannot for the life of me imagine a situation where it would be all that useful.
$ getfacl -p /dev/snd/pcmC0D0c
# file: /dev/snd/pcmC0D0c
# owner: root
# group: audio
user::rw-
user:sam:rw-
group::rw-
mask::rw-
other::---
On my systems, the 'audio' group is empty. The ACL of the audio device (and other devices with the `uaccess` tag) is adjusted by udev when the owner of the active console session changes.(I don't know if the scheme is able to revoke access to a running process, but it's still a step up from a single, static 'audio' group).
It irritates me that the Linux environment is constantly growing more complex to account for scenarios that are not relevant for me, and it's hard to opt out. That complexity is not zero-cost; I've been hit by many a bug (and have wasted a lot of time working around..) related to things that exist on my system yet serve no real purpose for me.
I guess it's the year of the Linux desktop when it gets corporate enough, and those who want a comfortable free operating system will be looking for alternatives :)
And there's no SSH exploit necessary. I'm not talking about a hacker from the internet, I'm talking about a malicious co-worker.
The old permission model of "just add everyone to the audio group" is not sufficient.
Sounds great! What could possibly go wrong?
My custom distro beats the brakes off junkware like Ubuntu and (lol) Windows in startup time and responsiveness, and has all of the functionality I need, with half the code and as a result much fewer gaping security holes.
Computer security is an absolute nightmare these days. Intelligent people should be simplifying things and stripping everything down to the bare minimum, instead of stacking more crud on top of endless crud.
Those who fail to SECURE their systems and workflows will one day in the near future be surprised as shit to find that the entire "cloud" has been hacked and destroyed by worms and their system trashed right along with it. At that time, the world will be divided into two camps: computer owners (me and my kind) and non computer owners (everyone else.)
This is a rather nonsense statement. Polkit (or something like it) is needed if you want to have those macOS-style "program A wants to have permission to access privileged resource B" security prompts in the GUI. It's about as complicated as any similar solution needs to be for that use case. Perhaps you find these to be annoying and you disable them so they always succeed, but with that you've effectively given every program permanent suid root access. Definitely simpler, but can you say it's less of a security nightmare? I wouldn't. Yes there are risks of vulnerabilities in any security layer, but without them you've got no security layer at all.
And, honesty, I don’t see how those prompts (or functionality they gate) make the system more useful.
If you don't own cryptocurrency(That is more critical because it can't be reversed), you're probably way more at risk for physical theft than cyber crime.
In fact I think we are more secure than ever before because browser sandboxing actually works worth a crap, unlike 10 or so years ago.
The more you strip out of a system, the more manual work you need to do, and the closer you get to just a fancy version of a pencil. Technically, every line of code is a security risk.
But a lot of things just... are barely worth it when ultra simplified, and you start spending more time than you save at a certain point.
This bug is pretty bad, and I could see distros getting rid of it, but only with plenty of thought and analysis and maybe a replacement. They clearly put it there for a reason. Lots of stuff seems to need it. And unless you use sandboxing or multiple accounts for different things.... if you have attackers running as your user, you are already screwed.
I will be keeping polkit.
> Computer security really isn't THAT much of a nightmare for an average user.
"Average user" and "common idiot" are one and the same. Common idiots never see danger coming until it's too late.
> How many people do you know that got hacked lately, for any reason other than not using 2FA, or installing random garbage?
It's not about what has happened, it's about what easily CAN happen, and therefore WILL.
By the way, 2fa being forced down everyone's throat is not for your benefit. Notice how they never will allow you to use a voip number for 2fa? How could TPTB track your every move via GPS if you use voip?
> If you don't own cryptocurrency(That is more critical because it can't be reversed), you're probably way more at risk for physical theft than cyber crime.
LOL. Crypto is a scam. Bitcoin is going to crash to zero, and you're going to lose everything. Next TPTB will introduce their own Officially Approved digital currency, which is specially designed so that your account can be locked or restricted or emptied with the click of a mouse button, and so that you cannot possibly ever avoid any taxes.
You've got some tough lessons to learn about how the world works.
Meanwhile my use of physical, hard currency will keep me free and at liberty forever.
> In fact I think we are more secure than ever before because browser sandboxing actually works worth a crap, unlike 10 or so years ago.
If by "secure" you mean "in Google's firm grasp", you are correct. If you really meant "in control over your own computer", no, you are not.
Try patching Chromium to remove all the spyware and malware as I have done, and note how you and your browser are now treated as Enemies of the State by the Big Corp controlled internet.
> The more you strip out of a system, the more manual work you need to do
Freedom isn't free, nor is security.
> But a lot of things just... are barely worth it when ultra simplified, and you start spending more time than you save at a certain point
How would you know? You've never even tried to escape from the Goolag.
My system beats the brakes off yours in virtually every metric, especially speed and security, and has been worth every hour spent working on it.
> if you have attackers running as your user, you are already screwed.
You mean like the attackers you willingly give root access to your machine by allowing them to regularly stream arbitrary binary code to "your" (their) computer, and regular user access via metrics and update checks and every other sort of outgoing network connection on their schedule and not yours, any one of which could trigger a buffer overflow and code injection event? Yes, you are screwed six ways from Sunday.
Probably by machine learning looking for houses with an absence of pings to certain servers and using old fashioned police work from there.
Keeping that scenario from ever happening is a political issue. Perhaps it is in part technical too, but ultimately, people should not have to live like fugitives. For the same reason they shouldn't have to wear a guy fawkes mask in public.
And if someone does need to, they probably don't consider themselves to be free.
I may have never tried to get away from Google, but we did grow up poor enough to not have the latest tech for quite a long time.
It would be nice if it was possible and convenient, but a lot of things are still way behind.
When you add up all the details... it's probably more of a luxury than being rich in the gilded age, and it's accessible even to people like me who don't even make minimum wage when you take into account all the Ubers and Lyfts and crap.
With simple technology, one mistake and it's all gone. It doesn't help you out at all. Remember how this stuff was done 15 years ago? Nobody ever would trust computers for anything important. We all used pens and paper every day.
Every person I know who cares about privacy seems to need tons more analog tech than I do.
Lose your phone? Too bad, there was no Google page with which to track it and remote control it. Lose your wallet? Hope someone turns it in. There was no Tile.
Cooking and need to set a timer? Better wash your hands first and be careful not to forget in the time it takes to do so, or you'll make a mess and transfer germs when you touch the timer.
It would be a LOT of work to set up replacements for all of this while preserving privacy.
These things are only a few minutes per day, but collectively they are a big lifestyle change.
Eventually, open source will catch up. But it is slowed down by the fact that the FOSS community.... likes to shit on such things and doesn't want them to exist at all, and prefers ongoing manual involvement, and shits on most zero conf stuff, because they're so absolutist about security and minimalism.
I think I've evaded many bullets exactly the same way.
More code and more complexity -> more bugs, more holes. It's pretty simple.
/s
* rtkit - optional dependency of PulseAudio to grant its processes realtime priority.
* colord - optional color profile dbus service.
* gparted - hard dependency to give it permission to reformat disks.
I like to keep a minimal system, so I went ahead and removed them all. Will see if audio performance suffers.
I wouldn't suggest giving those permissions to your user because it opens up the possibility of a denial of service. With those permissions, any program running as your user can spawn lots of realtime threads that can take over the scheduler and lock the system up. This was detailed in the rtkit announcement, and preventing it is the reason rtkit exists: http://lalists.stanford.edu/lad/2009/06/0191.html
Maybe realtime audio is not important to you, and that's fine. But it's never as simple as "delete these things and now I have a secure system", you may be trading off security elsewhere to get that. Please also note that pkexec is not required to use polkit. You can remove pkexec and still have a functioning polkit installation and still use all those other daemons too. For a really secure system you may want to remove all suid binaries anyway and only use polkit or SELinux or something.
$ pkaction --action-id org.freedesktop.RealtimeKit1.acquire-high-priority --verbose org.freedesktop.RealtimeKit1.acquire-high-priority:
description: Grant high priority scheduling to a user process
message: Authentication is required to grant an application high priority scheduling
vendor: Lennart Poettering
vendor_url:
icon:
implicit any: no
implicit inactive: yes
implicit active: yes
In the default configuration that will be granted to clients that are part of a local console session, but denied to clients that are not (e.g., batch jobs, SSH). That policy can be further customized by the OS vendor, organization, site, or local admin in quite a flexible way.In these desktop environments. Polkit is used to gating any remote process from accessing network state related functions (or anything that are not supposed to do remotely).
For example, you can use `nmcli` on the desktop or system termional(Alt+f1~f7) to disconnect the network or change to use other pppoe even you are not currently root(not using sudo to elevate the permission).
But if you try to call `nmcli` through ssh? No, No , No, Polkit will gate you from doing so.
Groups are also not dynamic enough. When evaluating these rules, one of the inputs is whether the client requesting the action is a member of no session at all, or an inactive console session, or an active console session. You can't represent these with groups because you can't grant/revoke group membership to a process while it's running. (A process with a group membership can also stash away a setgid executable that can be used by the user to regain access to a group that they've been removed from later on, so it's not even possible to cast-iron-guarantee that access to a group has been revoked without inspecting the filesystem...)
[~] compile helper..
[~] maybe get shell now?
The value for environment variable XAUTHORITY contains suscipious content
This incident has been reported.
And no root shellOn Arch Linux.
Also by Henry Spencer, from How to Steal Code³:
“Even widely-available library functions often are not used nearly as much as they should be. A conspicuous example is getopt, for command-line argument parsing. Getopt supplies only quite modest help in parsing the command line, but the standardization and consistency that its use produces is still quite valuable; there are far too many pointless variations in command syntax in the hand-cooked argument parsers in most UNIX programs. Public-domain implementations of getopt have been available for years, and AT&T has published (!) the source for the System V implementation. Yet people continue to write their own argument parsers.”
Now, of course, we have argp_parse(), which also comes included in glibc, and is much better than getopt().
1. https://www.gnu.org/software/libc/manual/html_mono/libc.html...
I would also note that even POSIX isn't portable in some contexts (such as trying to write code which can run on windows too).
> a scheme of having a privileged service that acts on the requests of unprivileged processes
That is precisely what polkit is!
Edit: Maybe to make it clear, yes, in theory the polkit project does follow the scheme of a privileged daemon process and unprivileged clients but in practice it doesn't because of the setuid polkit-agent-helper-1 and setuid pkexec programs.
You cannot accomplish sudo without setuid. Note that sudo means gaining privilege in the current context, with all its environment (including inherited file descriptors, the process group, etc.), not doing a privileged action at a distance.
> also true for the /usr/libexec/polkit-agent-helper-1 helper it uses which is a setuid binary but doesn't really have to be
Try making it non-setuid and see what happens.
(It will fail to check your password because most mechanisms for doing so, like the usual pam_unix, are only accessible to root.)
Right, process group and being child process gets lost when following this route. I think it's a compromise that is acceptable in many cases.
> [polkit-agent-helper-1] will fail to check your password because most mechanisms for doing so, like the usual pam_unix, are only accessible to root.)
That's what I mean, the helper itself could be unprivileged and hand the password over to a privileged daemon that does the check.
https://gist.github.com/pothos/73dd4f7694acc3b6bbed614438f6e...
I think it’s akin to real-life locks. Keeps good guys out, but not a determined attacker.
$ sudo chmod 0755 /usr/bin/pkexec
chmod: changing permissions of '/usr/bin/pkexec': Read-only file system
Security preventing security I guess... sudo mount --bind /bin/false /usr/bin/pkexec
This will be gone over reboot, however.If argc is 0, don't look at argv.
Sanity check argv != NULL before looking at it.
Or, maybe write security-critical programs in safer languages like Rust.
People out there write some pretty funky C.
If you're writing a serious kernel in C, you ought to have programmatic debugging assertion constraints for every parameter.
I don't know if this was flagged or not.
I use Linux but do not use a graphics system (X11, Wayland, etc.). When I install, I always start by downloading a rootfs or a bootable image containing a rootfs.
For example, if installing Debian, I might start by downloading boot.img.gz
https://deb.debian.org/debian/dists/bullseye/main/installer-...
However I do not see pkexec "installed by default" in initrd or initrdg.
gzip -d boot.img.gz
mount -o loop boot.img /mnt/img
gzip -d /mnt/img/initrd.gz
cpio -t < /mnt/img/initrd|grep pkexec
gzip -dc /mnt/img/initrdg.gz|cpio -t|grep pkexec
It appears that to install pkexec I would have to choose it at a later stage.I guess the authors are referring to some other installation method. Perhaps one that denies the user the chance to skip installing a graphics system.
You are describing the thing that is loaded and run to load the Debian installation data and install Debian.
One could argue the thing you are running is not "Debian", but Debian's installer tool.
Perhaps it would come down to what exactly in the userland defines Debian as Debian. There are certainly differences in the rootfs as I go from one distribution to another.
It would be like arguing that NetBSD install media is not NetBSD. For me, it is absolutely NetBSD, just a smaller version.
dpkg-statoverride --update --add root root 0755 /usr/bin/pkexecThis architecture was a bad idea when Windows adopted it. Then it got transplanted to Linux and got even worse.
Looked at nosh?