Sudo and its alternatives
Sudo is a ubiquitous tool for running commands with the privileges of another user on Unix-like operating systems. Over the past decade or so, some alternatives have been developed; the base system of OpenBSD now comes with doas instead, sudo-rs is a subset of sudo reimplemented in Rust, and, somewhat surprisingly, Microsoft also recently announced its own Sudo for Windows. Each of these offers a different approach to the task of providing limited privileges to unprivileged users.
The origins of sudo go back to the beginning of the 1980s and 4.1BSD running at the State University of New York, Buffalo. The full history of the program will not be repeated here, but a nice overview of it is available on the sudo website. That history is sparse on details about the first release of "CU sudo", which is the currently prevailing sudo; it simply says that it was CU sudo version 1.3 that was released in 1994. The exact date appears to have been February 9, 1994 from a post to comp.unix.admin — just a bit over 30 years ago.
Sudo has been through multiple iterations and reimplementations over the years. CU sudo was named after the University of Colorado, where it was created by Todd C. Miller. He still maintains it, although naturally many people have contributed to it over the decades. The "CU" prefix was dropped from the name in 1999.
What does sudo do?
Sudo works by authenticating the user and then executing the program given as a command-line parameter, with the effective user ID of the user indicated in the -u parameter (root by default). Most commonly, a system administrator configures sudo by listing specific users or groups and their allowed capabilities in the /etc/sudoers configuration file. Sudo supports fine-grained control to, for example, allow a user to only run specific commands with the identity of a specific other user, rather than any command as any user. A user could run sudo cat foo to read the file foo that their regular account does not have permission to read, or sudo -i to get an interactive superuser shell.
As an important contrast to the related su utility, users do not have to know the superuser password of the system; instead they authenticate with their own password. Authentication without a password can also be set up. For convenience, sudo keeps "ticket files" for recently authenticated users, so that they do not have to re-input their password for a short time after their last sudo invocation.
OpenBSD and doas
To assume the identity of another user, sudo must invoke some privileged system calls, and therefore its file mode must be setuid root. Those types of programs have extraordinary security requirements and must do their job carefully in order to prevent unintended privilege escalation.
Having identified that sudo is such a program and a complicated one,
OpenBSD developers came to the conclusion that it was too risky. Starting
with OpenBSD 5.8, released in October 2015, the default user-identity
switcher tool has been "doas", or "Dedicated OpenBSD Application
Subexecutor". It was developed by Ted Unangst, who had "personal issues
"
with the configuration of sudo. He wrote a blog post in July 2015
explaining his reasons for the creation of doas. One of those was
that sudo was simply too complicated for most people's needs:
The core of the problem was really that some people like to use sudo to build elaborate sysadmin infrastructures with highly refined sets of permissions and checks and balances. Some people (me) like to use sudo to get a root shell without remembering two passwords. And so there was considerable tension trying to ship a default config that would mostly work with the second group, but not be too permissive for the first group.
Another was that it contained too much code for a privileged process:
There were some concerns that sudo was too big, running too much code in a privileged process. And there was also pressure to enable even more options, because the feature set shipped in base wasn’t big enough. (As shipped in OpenBSD, the compiled sudo was already five times larger than just about any other setuid program.)
Prior to the blog post, there was a thread on the openbsd-ports mailing list announcing a decision by Miller, who is also heavily involved with OpenBSD, and Theo de Raadt to move sudo from OpenBSD's base repository to the so-called ports tree. BSD operating systems generally come with the core operating system in a repository called "base", along with a "ports" tree offering third-party software in source-code format. Apart from a separate openbsd-tech thread, there isn't much overt discussion to be found about sudo's problems prior to the removal from base. It appears that one day Unangst just thought it best to make a slimmer replacement; De Raadt and Miller were seemingly on board from the start.
Doas is a bare-minimum sudo-like tool; it has a simplified configuration file syntax and does not have support for authentication schemes other than system-local BSD Authentication — see Wikipedia for an overview or the login.conf man page for details. Taking a look at the short man page for doas.conf gives a good idea of its scope.
A Linux port of doas also exists by the name OpenDoas and is available for many distributions.
Vulnerabilities and "rewrite it in Rust"
As with any software, sudo has had its share of security problems. It is not an egregious stream of vulnerabilities by any means, but something pops up every now and then. Since sudo is written in C, a portion of those bugs involve memory safety. Most recently, in CVE-2023-27320, a double-free bug was patched, albeit one that only affected rare configurations. Another, more severe, vulnerability from last year was CVE-2023-22809, though it is unrelated to memory safety. It concerned a mishandling of environment variables by the sudoedit command, which allowed a local attacker to append extra files to be edited with extra privileges.
Sudo-rs is an
effort to write a drop-in replacement for "all common use cases of
sudo
" in
Rust; its GitHub README calls it "a memory safe implementation of
sudo and su
".
The project only targets Linux-based systems with a 5.9 kernel or newer.
Development is sponsored by the Prossimo project, which is part of
the Internet
Security Research Group (ISRG); there is an announcement blog
post of the project from April 2023.
The project is also affiliated with Ferrous Systems, a company offering a safety-standards-qualified Rust compiler and consulting, which reported on a security audit of sudo-rs in November 2023. The audit discovered one moderate and two low-risk issues; the moderate one being a path traversal vulnerability that was found to affect Miller's sudo as well.
Similarly to doas, sudo-rs also only targets a subset of sudo's capabilities. From the README:
Some parts of the original sudo are explicitly not in scope. Sudo has a large and rich history and some of the features available in the original sudo implementation are largely unused or only available for legacy platforms. In order to determine which features make it we both consider whether the feature is relevant for modern systems, and whether it will receive at very least decent usage. Finally, of course, a feature should not compromise the safety of the whole program.
Sudo-rs does not seem to get much use currently. At the time of this writing, the Crates.io statistics show a figure of 663 all-time downloads. The most notable deployment of sudo-rs that was found is in Wolfi OS — a minimalist distribution (or "undistro" as the project calls itself) from Chainguard, Inc., focused on solving supply-chain issues in container images.
Cutting down on features
Both doas and sudo-rs achieve a portion of their goals by intentionally omitting features that sudo supports. This is a sensible angle to minimize attack surface and reminiscent of the OpenBSD-originated LibreSSL project. After the major OpenSSL vulnerability dubbed Heartbleed in 2014, OpenBSD forked OpenSSL into LibreSSL and removed substantial amounts of legacy and esoteric functionality in an effort to improve the security of the library.
While the vulnerabilities found in sudo have not been as severe as Heartbleed, it might be prudent to get ahead of such a hypothetical event by switching to a streamlined alternative, especially when some of the more advanced or more complicated features of sudo are not required. Though sudo is not exposed to the network like OpenSSL, many of the same concerns that led to LibreSSL were factors in the development of doas — and in the same time frame.
Doas supports only a core subset of sudo's feature set, so it cannot really be recommended for anyone who has even slightly more complicated authentication needs than local user accounts. There is no support for integration with LDAP or Kerberos, for instance. However, sudo-rs does call out to Pluggable Authentication Modules (PAM) to authenticate the user, so it can support non-local authentication schemes such as LDAP and Kerberos via the usual Linux mechanism for that.
Notably, sudo-rs maintains a list of past sudo CVEs with an estimation of their applicability to sudo-rs. Most of them are listed as not applicable because the affected functionality is not implemented in sudo-rs.
Others
Once an organization starts to get larger, it quickly becomes advisable to maintain privilege and identity information in a centralized system such as LDAP or Active Directory. Some su- or sudo-like tools exist precisely with these use cases in mind. Sudo itself, for instance, has support for LDAP integration.
For the Kerberos network-authentication protocol, there is ksu or "Kerberos su", provided by the MIT package. Sudo's website lists various other sudo alternatives as well. Most of these are outdated or otherwise not noteworthy, and some are system-specific tools for non-Linux systems or commercial products. Some on the list, such as priv, GNU userv and ssu, look like long-abandoned pet projects or academic research from roughly 25 years ago.
As a surprise to many, Microsoft
announced
"Sudo for Windows" on February 7 as part of a Windows 11
insider-preview build. The blog post claims that Microsoft is "open-sourcing
this
project
" on GitHub, but
the only code available on the repository at the time this article was
written is a PowerShell
wrapper that calls out to sudo.exe. It is unclear where the
source for that binary is hosted.
The announcement outlines a few different ways to configure the tool's behavior; it can either launch the privilege-elevated process in a new terminal window or in the existing window. The actual privilege elevation looks to be handled by the User Account Control (UAC) subsystem, complete with the graphical confirmation dialog. Sudo for Windows is not a port or fork of Miller's sudo, nor does it work the same way. The blog post also links to a separate sudo-like tool for Windows called gsudo, which it says has more features.
Identity and access management is certainly a rich and complicated topic, not to mention a delicate one. The tools and frameworks that we rely on daily for security in authentication and authorization are under constant scrutiny. The 30-year-old sudo has had a long run as the most popular tool for what it does, but perhaps the security diehards of OpenBSD, along with the memory-safety-focused Rust developers behind sudo-rs, are onto something. We shall have to wait and see what the future holds for sudo and its alternatives.
| Index entries for this article | |
|---|---|
| Security | Tools/Access control |
| GuestArticles | Koistinen, Ronja |
Posted Feb 21, 2024 19:39 UTC (Wed)
by bluca (subscriber, #118303)
[Link] (49 responses)
Posted Feb 21, 2024 19:43 UTC (Wed)
by DimeCadmium (subscriber, #157243)
[Link] (6 responses)
Posted Feb 21, 2024 19:48 UTC (Wed)
by corbet (editor, #1)
[Link] (2 responses)
Posted Feb 22, 2024 10:44 UTC (Thu)
by smitty_one_each (subscriber, #28989)
[Link] (1 responses)
No, scratch that: LWN is the great place it is because of the high signal-to-noise ratio, and the aforementioned joke article is best left as a hint to the reader's imagination if inclined.
Posted Feb 24, 2024 0:26 UTC (Sat)
by tedd (subscriber, #74183)
[Link]
Posted Feb 21, 2024 19:49 UTC (Wed)
by bluca (subscriber, #118303)
[Link]
Posted Feb 21, 2024 19:52 UTC (Wed)
by pizza (subscriber, #46)
[Link]
Yes, setuid is a problem for many environments, which disallow that as a manner of policy. So yes, thank you for providing a tool that many will find useful.
('uid0' also completely separates the runtime environment/session/context from that of the invocation user/session/shell. This eliminates a _lot_ of pain points and data leakage opportunities)
Posted Feb 22, 2024 16:33 UTC (Thu)
by MarcB (guest, #101804)
[Link]
With uid0, your are branching off of a pre-existing, clean, privileged environment. No privilege elevation is needed, making whole classes of bugs impossible.
btw, some here argue about the complexity of Polkit and Systemd, but completely ignore the complexity that exists to implement setuid/setgid in the kernel and all the hacks in ld.so, ptrace and other places to make it not obviously insecure. There also are some constraints that would not be necessary if those mechanisms would not exist in the first place. For example, unprivileged chroot would be possible (might still break some software, but the breakage would stay within the initial user account).
Posted Feb 21, 2024 19:54 UTC (Wed)
by oliwer (subscriber, #40989)
[Link] (36 responses)
Posted Feb 21, 2024 20:08 UTC (Wed)
by bluca (subscriber, #118303)
[Link] (12 responses)
Posted Feb 21, 2024 21:39 UTC (Wed)
by marcus0x62 (guest, #168201)
[Link] (11 responses)
Posted Feb 21, 2024 22:01 UTC (Wed)
by bluca (subscriber, #118303)
[Link] (10 responses)
Posted Feb 21, 2024 22:56 UTC (Wed)
by marcus0x62 (guest, #168201)
[Link] (9 responses)
See also: https://www.jwz.org/blog/2021/01/i-told-you-so-2021-edition/
Posted Feb 21, 2024 23:23 UTC (Wed)
by bluca (subscriber, #118303)
[Link] (8 responses)
Polkit has been providing the escalating privileges functionality on Linux for almost 20 years now. It's had its fair share of problems, like any other software, but it is in no way an "unauditable mess", in fact, having recently done some substantial work to improve its robustness and modernize it, its core is pretty well reviewable. It's not in any way worse than larger components such as the kernel, both from the point of view of the size and also for the number of issues that affect it. In fact, I haven't counted but I am willing to bet the Linux kernel gets more high severity CVEs in any given year than polkit did in its entire lifetime.
> See also: https://www.jwz.org/blog/2021/01/i-told-you-so-2021-edition/
I have no idea what some rant about screensavers has to do with sudo and its replacements, sorry but you lost me there.
Posted Feb 21, 2024 23:57 UTC (Wed)
by marcus0x62 (guest, #168201)
[Link] (7 responses)
Posted Feb 22, 2024 0:24 UTC (Thu)
by bluca (subscriber, #118303)
[Link] (6 responses)
"Overly complex design" is usually a code word for "some stuff I haven't really looked into but I know I don't like", usually because "back in my day we used to punch holes in cards with a toothpick" or something along those lines.
> Both the screen locker and sudo/doas/uid0 have the *potential* of failing open - that is to say, to grant more privilege than they should in a failure state.
Code for all three of those is available to be cloned, so if you want to provide some proof for that statement, now would be the ideal time to do so.
Posted Feb 23, 2024 0:06 UTC (Fri)
by marcus0x62 (guest, #168201)
[Link] (5 responses)
If you honestly believe that there is no potential for these programs to fail open - as sudo has in the past due to exploitable vulnerabilities - or if you simply do not understand what ‘potential’ means, I cannot help you.
Posted Feb 23, 2024 0:24 UTC (Fri)
by Cyberax (✭ supporter ✭, #52523)
[Link] (4 responses)
If you look at sudo vulnerabilities ( https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=sudo ), a significant share of them is caused by failing to properly sanitize the environment.
uid0 is much more resilient against these kinds of attacks, because it starts from a known-good state and then drops privileges as needed. Not vice versa.
Is it possible that uid0 missed something? Sure. But it's far less likely.
Posted Feb 23, 2024 0:31 UTC (Fri)
by bluca (subscriber, #118303)
[Link] (3 responses)
Posted Feb 23, 2024 6:35 UTC (Fri)
by mb (subscriber, #50428)
[Link] (2 responses)
Posted Feb 23, 2024 18:26 UTC (Fri)
by wtarreau (subscriber, #51152)
[Link] (1 responses)
No, that's the mistake that has been done for a long time and it has not helped, it transforms language bugs into logic bugs because doing the right stuff gets more difficult.
What is needed is to make it easier to do the right thing. Due to this, bugs will be harder.
I would love to see a C standard variant with all UBs clearly defined to safe and intuitive values (mostly what the kernel sets with all its options in fact). *That* would make bugs less likely to happen and more detectable. But others tried in the past and it always ends up in bikeshedding.
Posted Feb 25, 2024 21:18 UTC (Sun)
by matthias (subscriber, #94967)
[Link]
What are safe and intuitive values if you do out of bounds access, use after free, data races, etc.? Most of the UB is there because it is actually UB on the hardware level.
Of course there is some UB in C that can be reasonably defined (e.g., signed integer overflow). But most security critical bugs are memory safety errors. And these cannot be defined away. If you want to get rid of these you need ownership tracking (the rust way), garbage collection (the java way) or some other runtime tracking (e.g., only allow reference counted pointers).
Posted Feb 21, 2024 20:08 UTC (Wed)
by pizza (subscriber, #46)
[Link]
Psst, you left out Linux from your dependency list. Kinda hard to run systemd without Linux. Oh, and a C library. And (probably) a couple dozen other libraries and utilities for a minimally-useful system.
Posted Feb 22, 2024 8:33 UTC (Thu)
by chris_se (subscriber, #99706)
[Link] (20 responses)
While don't like that polkit switched to JavaScript either, I think the 'attack surface' claim in this context is dramatically overstated:
1. Nowadays https://duktape.org/ is used instead of a browser engine, so polkit itself doesn't actually have that big of a footprint anymore.
Would I have preferred if polkit didn't go and use JavaScript? Sure. But I have neither the time nor the energy to write something better that fulfills the same need. And I think polkit is a net positive when it comes to security, because it does allow for standardized fine-grained access control for IPC. (Want to give a service on an embedded appliance the ability to reboot the appliance without giving the service complete root privileges? Trivial with systemd + polkit. Very hard to get right with other means.)
Posted Feb 22, 2024 10:11 UTC (Thu)
by atnot (guest, #124910)
[Link] (17 responses)
Aside from having a bad reputation with a certain smug crowd, javascript is a pretty good choice if you're going to have a plugin system. It's widespread, well known, has a decent ecosystem (unlike e.g. lua), has many implementations and is easily sandboxed (unlike e.g. python). And using a sandboxed scripting language is just way more secure, auditable and sensible in a security critical tool than the dlopening random C DSOs or execveing bash scripts shenanigans. Or worse, that in combination with some poorly defined, ever growing, adhoc config language. Which is what we would be doing otherwise. But of course none of that matters, because JavaScript is not a cool language and it's not used by the kids at the cool table, and hence it must be expunged.
Posted Feb 22, 2024 12:45 UTC (Thu)
by sionescu (subscriber, #59410)
[Link] (16 responses)
Posted Feb 22, 2024 14:03 UTC (Thu)
by farnz (subscriber, #17727)
[Link] (15 responses)
Firstly, I disagree that no external libraries would be used; they'd be unusual, sure, but in every system I've worked with that allows configuration via code, eventually someone pulls in an external library that does something useful but that's not part of the base language. For example, you might pull in a library that can directly interpret a policy document output by another system, or that can detect out-of-policy decisions and prevent them.
Secondly, a language with a big ecosystem correlates well with a good supply of people who can do quick hacks in that language; at my current job over half the developers have written some JavaScript before, and could usefully write a PolKit configuration as a result, while there's only 2 of us around who have written anything in Lua before.
Posted Feb 22, 2024 14:40 UTC (Thu)
by sionescu (subscriber, #59410)
[Link] (7 responses)
I'd expect that such a critical component would disallow the loading of external libraries (even by the sysadmins), and only expose built-in functionality to a tightly controlled execution environment. As such, the richness of the ecosystem is entirely irrelevant.
> Secondly, a language with a big ecosystem correlates well with a good supply of people who can do quick hacks in that language; at my current job over half the developers have written some JavaScript before, and could usefully write a PolKit configuration as a result, while there's only 2 of us around who have written anything in Lua before.
Polkit policies would only concern a very small number of people working on system integration, and the popularity of the language wouldn't be a major requirement.
Posted Feb 22, 2024 14:44 UTC (Thu)
by farnz (subscriber, #17727)
[Link] (2 responses)
If it disallows the loading of external code, then you have a serious problem - how exactly am I supposed to configure a system that uses code to configure it, if the system won't load my code?
If it allows loading of external code, I can bundle the external library with my code, and the system can't tell that the external library was downloaded from the Internet rather than written by me.
And the whole reason you have a configuration language for Polkit is that there's lots of different configurations that might make sense; if I have to learn PolKitScript to configure it, then I'm stuck being "the Polkit person"; if it's JavaScript, I can tell someone outside my team to write me the JavaScript for the policy that we want to implement, and simply review it, rather than having to write it as well.
Posted Feb 22, 2024 15:00 UTC (Thu)
by sionescu (subscriber, #59410)
[Link] (1 responses)
I invite you to take a look at the docs: https://www.freedesktop.org/software/polkit/docs/latest/p...
The execution environment exposes a few objects which allow defining some very limited hooks. There doesn't seem to be any support for require(), nor I/O, perhaps not even named functions. That makes it practically impossible to use third party libraries except by doing copy-and-paste of non-I/O functionality (perhaps string manipulation, etc...).
Posted Feb 22, 2024 15:25 UTC (Thu)
by farnz (subscriber, #17727)
[Link]
The ability to copy-and-paste non-I/O functionality is, however, extremely useful; I can (to choose an example) include a "JSON database" in my rules, automatically generated from a source in an interesting fashion, and with fast programmatic queries relying on indexes that come as JavaScript code. Indeed, I may even have the code to generate this already for use in (e.g.) a web front end, and I just have to tell it that I want a bigger database than it normally sends.
On top of that, I have syntax highlighters, lint tools, transpilers targeting JS (e.g. I could write the rules in TypeScript and transpile) and much more available to me, none of which would exist if I used PolKitScript instead.
Posted Feb 22, 2024 14:47 UTC (Thu)
by pizza (subscriber, #46)
[Link] (3 responses)
Okay, instead of loading an external LDAP (or OATH2 or whatever) authentication library with custom hooks into your local deployment, it has to be "built in".
That arbitrary library still has to be written either way, and it's more likely to be written (ie by someone other than the original upstream) if the language chosen has a "richer ecosystem".
Posted Feb 22, 2024 15:03 UTC (Thu)
by sionescu (subscriber, #59410)
[Link] (2 responses)
> That arbitrary library still has to be written either way, and it's more likely to be written (ie by someone other than the original upstream) if the language chosen has a "richer ecosystem".
See my comment above: https://lwn.net/Articles/963210/
I'd expect the environment to expose some C library bindings, so again the language ecosystem is largely unimportant.
Posted Feb 22, 2024 15:11 UTC (Thu)
by pizza (subscriber, #46)
[Link] (1 responses)
If you're using C library bindings, then you're effectively making everything "built-in functionality" which limits you to the "language ecosystems" that can be linked into a single executable.
(And if you're going to alllow calling external binaries, then what exactly was your point about "disallowing the loading of external libraries"?)
Posted Feb 22, 2024 15:17 UTC (Thu)
by sionescu (subscriber, #59410)
[Link]
Yes, but in this case it's mostly the C/C++ ecosystem (or whatever can produce an ELF object).
> (And if you're going to alllow calling external binaries, then what exactly was your point about "disallowing the loading of external libraries"?)
Because the third-party libraries that would be linked into Polkit would be strictly controlled by the upstream authors of Polkit, not under the control of sysadmins, so it would be impossible to edit a Polkit rule and load arbitrary code. A very common pattern after all: define a set of core primitives that one exports into a very limited "scripting" environment, that gets interpreted and mostly allows defining some hooks.
Posted Feb 22, 2024 15:22 UTC (Thu)
by atnot (guest, #124910)
[Link] (4 responses)
As an aside, that's not just a question of userbase, but also being a language that's used to write and maintain substantial codebases. There is an absolute ton of Lua out there in the world, but most of it is written by people who wouldn't consider coding their main job, e.g. people writing narratives/quests or designing gameplay mechanics for video games. Most of that code is written in very bespoke programming environments that don't really flow back to the community and is never touched again once it works anyway. Ditto for stuff like Cloudflare's WAF rules. There's just nobody out there who cares that much about Lua code quality.
Posted Feb 22, 2024 15:24 UTC (Thu)
by sionescu (subscriber, #59410)
[Link] (3 responses)
Posted Feb 22, 2024 15:27 UTC (Thu)
by farnz (subscriber, #17727)
[Link] (2 responses)
I have looked at Polkit rules in the past - if you're genuinely saying that you can navigate a multi-megabyte codebase that uses a minifier to reduce it down to one file without any tooling, well then, hats off to you.
Maybe it was never meant to be this complex, but I've seen it done, and it would have been done in PolKitScript instead if Polkit didn't use JavaScript, just with custom tooling instead of the tools everyone uses.
Posted Feb 22, 2024 17:44 UTC (Thu)
by zdzichu (subscriber, #17118)
[Link] (1 responses)
Posted Feb 22, 2024 21:34 UTC (Thu)
by farnz (subscriber, #17727)
[Link]
A place that was mostly a Microsoft shop, where they'd found a way to dump out the full GPOs as JSON via some third party tool, scripted it, and written JavaScript that read in the GPOs and applied the appropriate subset as Polkit permissions.
Utterly insane, but possible because Polkit's config system was fairly flexible - and a lot better than the suggested alternative from their IT team of porting from Linux to Windows 2000 as the then-current Windows version.
Posted Feb 22, 2024 23:06 UTC (Thu)
by ceplm (subscriber, #41334)
[Link] (1 responses)
OK, that’s a good reason why NOT to use a language which allows it. Pulling external (unaudited) libraries to your authorization toolkit is just so bad idea …
Posted Feb 23, 2024 10:45 UTC (Fri)
by farnz (subscriber, #17727)
[Link]
I didn't say unaudited - you can audit your external libraries as you pull them into the system. Pulling in unaudited code to a security-relevant codebase is a fool's errand, but it's still a lot easier to audit an external library that does what you need than to write a secure version yourself taking into account all the edge cases.
Posted Feb 22, 2024 18:31 UTC (Thu)
by lkundrak (subscriber, #43452)
[Link] (1 responses)
Hello, a local sysadmin here. As someone who has once written "=" instead of "==" I can testify that JavaScript and security policies don't mix too well.
Posted Feb 22, 2024 22:21 UTC (Thu)
by bookworm (subscriber, #114190)
[Link]
https://developer.mozilla.org/en-US/docs/Web/JavaScript/E...
Posted Feb 22, 2024 20:33 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link]
And if you're going to use a Turing-complete language, then JavaScript is as good as any other choice. I personally would have chosen Lua, but whatever. JS is good enough.
Keep in mind, that it does not need to deal with untrusted source code, because policies are shipped as a part of the packages that use them. In that regard, they are similar to /etc/sudoers.
Posted Feb 21, 2024 20:02 UTC (Wed)
by sping (guest, #103256)
[Link] (4 responses)
Posted Feb 21, 2024 20:49 UTC (Wed)
by josh (subscriber, #17465)
[Link] (1 responses)
That does not invalidate your point: yes, any alternative to sudo should carefully address TIOCSTI and TIOCLINUX, which the original sudo and sudo-rs both do but many other things don't.
Posted Feb 21, 2024 22:08 UTC (Wed)
by sping (guest, #103256)
[Link]
Posted Feb 21, 2024 21:54 UTC (Wed)
by bluca (subscriber, #118303)
[Link] (1 responses)
> An independent pseudo-tty is allocated for the invoked command, detaching its lifecycle and isolating it for security.
Posted Feb 21, 2024 22:02 UTC (Wed)
by sping (guest, #103256)
[Link]
Posted Feb 21, 2024 19:40 UTC (Wed)
by DimeCadmium (subscriber, #157243)
[Link] (1 responses)
I mean... they actually didn't, they announced something they call sudo, but it is not in fact sudo. :/
Posted Feb 23, 2024 12:12 UTC (Fri)
by smcv (subscriber, #53363)
[Link]
Posted Feb 21, 2024 19:46 UTC (Wed)
by oliwer (subscriber, #40989)
[Link] (8 responses)
Posted Feb 21, 2024 19:52 UTC (Wed)
by bluca (subscriber, #118303)
[Link] (1 responses)
Set [Service] and NoNewPrivileges=yes in /etc/systemd/system/service.d/noprivs.conf and you have such a system
Posted Feb 21, 2024 20:28 UTC (Wed)
by oliwer (subscriber, #40989)
[Link]
Posted Feb 21, 2024 20:13 UTC (Wed)
by glb (subscriber, #151647)
[Link]
Posted Feb 21, 2024 22:43 UTC (Wed)
by ronja (subscriber, #164061)
[Link] (3 responses)
Posted Feb 21, 2024 22:54 UTC (Wed)
by bluca (subscriber, #118303)
[Link]
Posted Feb 21, 2024 22:54 UTC (Wed)
by smcv (subscriber, #53363)
[Link] (1 responses)
polkit does have its own sudo-like tool, pkexec, which I personally think is a more concerning attack surface than polkit itself (because it's setuid root and therefore needs to distrust its execution environment, just like sudo, doas and everything similar). In recent Debian/Ubuntu, pkexec is packaged separately, so that it doesn't need to be installed on every system that has polkitd.
Posted Feb 22, 2024 10:52 UTC (Thu)
by lobachevsky (subscriber, #121871)
[Link]
Posted Feb 21, 2024 23:25 UTC (Wed)
by MarcB (guest, #101804)
[Link]
If you use SSH with certificates instead of plain keys, you can use something like "AuthorizedPrincipalsFile /etc/ssh/principals/%u" and then list all the users (technically principals, now) that can log in as root in /etc/ssh/principals/root. The list doesn't even have to include root itself.
This is very valuable on systems where every login is for administrative purposes anyway.
Posted Feb 21, 2024 20:23 UTC (Wed)
by timon (subscriber, #152974)
[Link]
OpenDoas as available from the Debian archive does integrate with PAM.
Posted Feb 21, 2024 21:13 UTC (Wed)
by flussence (guest, #85566)
[Link] (2 responses)
Posted Feb 22, 2024 16:17 UTC (Thu)
by spacefrogg (subscriber, #119608)
[Link] (1 responses)
Posted Feb 22, 2024 19:18 UTC (Thu)
by flussence (guest, #85566)
[Link]
Posted Feb 22, 2024 16:59 UTC (Thu)
by mchouque (subscriber, #62087)
[Link]
I have seen so many issues with wildcards: people thinking they're writing some kind of regexes while they're really configuring globbing. Yes, it's documented as such in man 5 sudoers but I've been able to become root so many times because of that it's not even funny.
And if you need to use wildcards and to exclude some uses/arguments, it's often a nightmare to write exclusion rules with '!'.
Posted Feb 23, 2024 18:36 UTC (Fri)
by wtarreau (subscriber, #51152)
[Link]
For example many of CVEs listed indicate "env_reset is always enabled". There are plenty of cases where you precisely need to keep your environment and disable env_reset. It just depends on the use case. Denying users' needs is probably one of the first cause of them trying to work around the limitation with less safe tools and setups. Other funny ones are "noexec bypass" which does not affect it since it does not have noexec functionality. Strictly speaking then it should be considered permanently vulnerable, or the original CVE should not be listed as a comparison. That CVE list comparison looks like a lot of marketing, "my dishwashing liquid washes better".
So sudo-rs may be safe and useful, it just is not a safer sudo, it's just another setuid executable that allows one to do stuff. Maybe it's an extension over "doas" in fact.
Posted Feb 26, 2024 22:28 UTC (Mon)
by q_q_p_p (guest, #131113)
[Link]
Posted Apr 2, 2024 19:04 UTC (Tue)
by ssokolow (guest, #94568)
[Link]
Sudo and its alternatives
Sudo and its alternatives
Look, you can disagree with the approach being taken to this new tool, but please keep your disagreement technical and useful. This kind of comment helps nobody.
Please
Please
Please
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Even if that is handled correctly, this still requires the kernel to implement the privilege elevation functionality in the first place - something it arguably should stop doing.
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
E.g. because they are written in unsafe languages or they don't use frameworks like systemd that bring applications into a known consistent startup state.
Just looking at actual bugs is not enough. We have done that for decades and failed miserably.
We have to make bugs harder to happen by design.
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
2. It's not like polkit is executing JavaScript code written by a potential attacker - it's executing JavaScript code that was written by the maintainers of the distribution of by the local sysadmin.
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
> If it allows loading of external code, I can bundle the external library with my code, and the system can't tell that the external library was downloaded from the Internet rather than written by me.
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Where did you saw multi-megabyte minified polkit rules?
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
What about SSH?
What about SSH?
What about SSH?
What about SSH?
What about SSH?
What about SSH?
What about SSH?
What about SSH?
What about SSH?
OpenDoas and PAM
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
Sudo and its alternatives
However, sudo-rs does call out to Pluggable Authentication Modules (PAM) to authenticate the user, so it can support non-local authentication schemes such as LDAP and Kerberos via the usual Linux mechanism for that.
Also useful for libpam-u2f as a way to add an unblockable blinking indicator (your U2F token's hardware 'touch me' prompt) and physical access requirement for some or all attempts to sneakily use credentials gained from wetware exploits.
