A local root vulnerability in glibc
We successfully exploited this vulnerability and obtained full root privileges on the default installations of Fedora 37 and 38, Ubuntu 22.04 and 23.04, Debian 12 and 13; other distributions are probably also vulnerable and exploitable (one notable exception is Alpine Linux, which uses musl libc, not the glibc).
Updates from distributors are beginning to appear and should be applied on
any systems with untrusted users.
The curious can see the fix applied to glibc in this
patch series.
Posted Oct 3, 2023 19:20 UTC (Tue)
by fraetor (subscriber, #161147)
[Link]
Posted Oct 3, 2023 20:44 UTC (Tue)
by iustin (subscriber, #102433)
[Link] (7 responses)
Posted Oct 3, 2023 21:21 UTC (Tue)
by siddhesh (subscriber, #64914)
[Link]
Posted Oct 4, 2023 12:49 UTC (Wed)
by smoogen (subscriber, #97)
[Link] (5 responses)
Posted Oct 4, 2023 19:47 UTC (Wed)
by iustin (subscriber, #102433)
[Link] (4 responses)
I meant, it is enough to update libc6 without rebooting/restarting daemons, or do you need a full reboot? Since the vulnerability appears at ld.so/dynamic loading time, it appears that simply updating libc6 is enough.
It is of course obvious that statically linked binaries are never fixed by updating a shared library.
Posted Oct 5, 2023 8:34 UTC (Thu)
by sdalley (subscriber, #18550)
[Link] (3 responses)
Posted Oct 5, 2023 8:38 UTC (Thu)
by geert (subscriber, #98403)
[Link] (2 responses)
Posted Oct 5, 2023 11:51 UTC (Thu)
by hmh (subscriber, #3838)
[Link] (1 responses)
And if your environment is currently safe, only applications that allow changing it and which do something weird in userspace with a cached copy of ld.so might need a restart. Maybe dlopen()?
Posted Oct 5, 2023 12:45 UTC (Thu)
by iustin (subscriber, #102433)
[Link]
Posted Oct 4, 2023 5:36 UTC (Wed)
by NYKevin (subscriber, #129325)
[Link] (10 responses)
Honestly, I'm starting to find it hard to get excited by these vulns. Ideally, setuid binaries would just stop existing altogether, but we can't have nice things. More realistically, untrusted users should be confined to a container and/or VM (preferably both), which is itself treated as untrusted. Containers definitely don't need to have setuid binaries, and with some effort you can probably get to that point with a VM as well.
(And yes, this is infeasible for a shared family computer. But that's going to get pwned no matter what operating system you install on it, so you may as well admit defeat and just give the five-year-old root anyway.)
Posted Oct 4, 2023 7:27 UTC (Wed)
by Sesse (subscriber, #53779)
[Link] (4 responses)
Posted Oct 4, 2023 18:31 UTC (Wed)
by NYKevin (subscriber, #129325)
[Link] (3 responses)
Posted Oct 5, 2023 12:36 UTC (Thu)
by hmh (subscriber, #3838)
[Link] (1 responses)
The correct answer here is more likely to be in he direction of: keep suid and sgid around and use it where possible while nothing better and safer like capabilities are available for what you need. But do that while actually hardening for real the dynamic linker without weakening security for any reason. No debugging, no behaviour modification based on the environment.
Then, one would need a separate, object-build-time thing for debugging suid/sgid binaries that cannot be in any way shoehorned into a production suid or sgid binary, instead. More annoying to developers, but that much safer for everyone.
Posted Oct 5, 2023 18:15 UTC (Thu)
by NYKevin (subscriber, #129325)
[Link]
But people don't like it when I tell them that (presumably because they don't like containers and/or VMs), so I have to provide some kind of alternative. You're right that polkit is not ideal, but it is the project that actually exists in this space. If you can point me to a better one, I'll gladly start recommending that instead.
> But do that while actually hardening for real the dynamic linker without weakening security for any reason. No debugging, no behaviour modification based on the environment.
I consider this less than ideal for one very simple reason: Traditionally, the rule has been that the child process inherits the uid of its parent, and so it was assumed that the parent could not attack the child (they're both the same user). Many process parameters are therefore inherited over a fork/exec, and this is widely used in practice for process configuration. Shells, for instance, are heavily dependent on being able to reconfigure a child process between fork and exec. Setuid breaks this assumption, and creates a security boundary in a very inconvenient location, so you end up having to go through the entire list of process configuration variables and manually deny all the ones that are likely to cause problems. Security should be based on allowlisting, not denylisting, and so I consider it a fundamentally flawed approach.
Posted Oct 5, 2023 13:24 UTC (Thu)
by job (guest, #670)
[Link]
Posted Oct 4, 2023 7:45 UTC (Wed)
by taladar (subscriber, #68407)
[Link] (4 responses)
Posted Oct 4, 2023 17:00 UTC (Wed)
by mokki (subscriber, #33200)
[Link] (1 responses)
Posted Oct 4, 2023 17:21 UTC (Wed)
by mb (subscriber, #50428)
[Link]
I don't care, if somebody takes my /usr/bin/bash and uploads it to somewhere. I don't even care that much, if some attacker deletes my /usr/bin/bash. And I don't care that much, if the attacker replaces /usr/bin/bash with malware. Everything is lost already anyway.
The problem is if somebody gains access to my /home/user. And that happens at the point where I download and execute malicious programs. Not where these programs exploit a setuid vulnerability.
Posted Oct 4, 2023 18:16 UTC (Wed)
by NYKevin (subscriber, #129325)
[Link]
Posted Oct 4, 2023 19:24 UTC (Wed)
by mat2 (guest, #100235)
[Link]
Posted Oct 4, 2023 6:03 UTC (Wed)
by Kamiccolo (subscriber, #95159)
[Link]
*sigh*
Posted Oct 4, 2023 10:40 UTC (Wed)
by bluca (subscriber, #118303)
[Link] (21 responses)
Posted Oct 4, 2023 16:39 UTC (Wed)
by eduperez (guest, #11232)
[Link] (20 responses)
Posted Oct 4, 2023 17:24 UTC (Wed)
by bluca (subscriber, #118303)
[Link] (19 responses)
Posted Oct 5, 2023 6:12 UTC (Thu)
by joib (subscriber, #8541)
[Link] (12 responses)
Of course, in reality zillions of $$$ are invested in current OS'es and applications that run on them, and a clean sheet design is but a dream. So the problem becomes how to somehow approximate that without massively breaking the existing system. And yes, "yeeting suid/fcaps into the sun" is probably a big part of it. As for how to temporarily get the higher capabilities, yes some form of IPC might be the practical solution. Or ssh to a local socket or such. And the NNP flag for tasks could probably help as well. Come to think of it, that would also allow jettisoning all this ruid/euid/suid stuff as superfluous.
Posted Oct 5, 2023 7:52 UTC (Thu)
by nim-nim (subscriber, #34454)
[Link] (1 responses)
So basically your billions of billions of software rewrite only move you from "you need to fool something able to elevate privileges to do evil" to "you need to fool something that runs permanently with elevated privileges to do evil". And you get a nice fat IPC channel that does not exist in the first scenario to accomplish this.
Of course in the first prototypes the IPC channel is small and easy to control, once you’ve shoved all the use cases that require privilege escalation today inside who actually thinks it will stay small and easy to control?
Posted Oct 5, 2023 7:56 UTC (Thu)
by nim-nim (subscriber, #34454)
[Link]
Posted Oct 5, 2023 22:46 UTC (Thu)
by shemminger (subscriber, #5739)
[Link] (8 responses)
Posted Oct 6, 2023 8:39 UTC (Fri)
by geert (subscriber, #98403)
[Link] (2 responses)
During development, Intel simulated the 80386 at the gate level on an IBM mainframe, which was rumoured to take one week to boot DOS. Nowadays we boot simulated Linux-on-LiteX-VexRiscv using Verilator on our desktops in minutes.
Posted Oct 6, 2023 14:46 UTC (Fri)
by Wol (subscriber, #4433)
[Link] (1 responses)
Bear in mind the architecture differences between a micro-processor and a mainframe. Mainframe CPUs were (maybe still are) slow even by their contemporary standards. The whole point of a mainframe is that the machine is mostly co-processors, which do most of the work.
I remember the days when they attempted to port Pr1mos to Intel - so the story goes it was a disaster. The 50-series CPU relied on the segmented virtual memory architecture, and the 80386 (I think that was the chip) was hopeless.
So no, I don't believe it wasn't feasible in the 90s. It was just that the x86 architecture was sweeping everything else away (thanks to the IBM PC), and all the awful design decisions that went into it effectively hindered and hamstrung a lot of far more superior work. As usual, "cheap but crap" won the battle, but cost us the dear.
Cheers,
Posted Oct 6, 2023 17:11 UTC (Fri)
by mpr22 (subscriber, #60784)
[Link]
Posted Oct 8, 2023 8:05 UTC (Sun)
by CChittleborough (subscriber, #60775)
[Link] (4 responses)
Wikipedia has a relatively decent article on this, though it leaves out the 50 calls/sec bit (which I heard in a talk by Prof Ed Gehringer).
Posted Oct 8, 2023 8:07 UTC (Sun)
by CChittleborough (subscriber, #60775)
[Link]
Posted Oct 8, 2023 14:03 UTC (Sun)
by jem (subscriber, #24231)
[Link] (1 responses)
From the Wikipedia article: "The iAPX 432 instructions have variable length, between 6 and 321 bits." Maybe partially as a reaction to this madness, something else was emerging from Berkeley: RISC. Roughly at the same time, in popular music, psychedelic progressive rock was replaced by punk rock.
Posted Oct 9, 2023 2:17 UTC (Mon)
by CChittleborough (subscriber, #60775)
[Link]
Posted Oct 9, 2023 9:02 UTC (Mon)
by james (subscriber, #1325)
[Link]
Eventually, I said "Okay, who are you? You know way too much about this technology." He
tells me "I'm the leader of the compiler team." And I said "In that case I probably just fatally
offended you." He said "No, not at all because I know we generate bad code and I don't
care." He said "We don't like the 432 hardware team." And I thought "Oh my God, there is
no hope that this project is going to work when you have the two main casts killing each
other." He said "That hardware team never listened to us compiler folks At some point we
decided that we'd live up to the letter of the contract but beyond that? No."
Posted Nov 18, 2023 1:48 UTC (Sat)
by Rudd-O (guest, #61155)
[Link]
Genode is truly cool. Give it a spin.
Posted Oct 5, 2023 18:42 UTC (Thu)
by kreijack (guest, #43513)
[Link] (5 responses)
I think that we have two different problems:
A sudo/doas/pkexec program does "execute $command as root in the $USER environment". And the problem is "in the $USER environment" (mostly $CWD, userid, group(s)id, env....) in which $command run.
Instead what is done today is to do only a bit of cleanup (like ignoring LD_PRELOAD); apart that the set-uid program is run in the $USER environment.
Even assuming a syscall like please_give_me_root_capabilities_using_an_ipc(2), you still have all sort of these problems:
The problem is that a SUID program relies to code (via the shared libraries or ld.so) on which it doesn't have any control. If a library change its behavior on the basis of a environment variable (but it could be a file in the current directory), it may be unknown by the program itself.
Last but not least, I did
$ find /usr/ -perm -u=s
The latest two scary me !
Posted Oct 5, 2023 19:05 UTC (Thu)
by adobriyan (subscriber, #30858)
[Link]
UFR II/UFRII LT Printer Driver for Linux V5.70.
What could _possibly_ go wrong?
Posted Oct 5, 2023 19:54 UTC (Thu)
by joib (subscriber, #8541)
[Link] (1 responses)
please_give_me_root_capabilities_using_an_ipc(2) doesn't sound useful; to me it sounds like it would inherit all the problems of suid. AFAICT the idea behind this ipc approach would be that the process running with elevated privileges would start from a clean slate in its own environment.
There's also file capabilities, which are a sort of limited suid:
$ getcap /usr/{bin,sbin}/*
But, it does sound a bit silly if you'd need to do some IPC in order to run something like ping in a different clean context.
Posted Oct 6, 2023 16:43 UTC (Fri)
by kreijack (guest, #43513)
[Link]
This could be accomplish doing:
$ mysudo() { ssh -l root 0 "cd $PWD; $*"; }
Posted Oct 6, 2023 16:19 UTC (Fri)
by wtarreau (subscriber, #51152)
[Link]
There are some distros where it's even scarier, there's a "/snap" directory with plenty of them in different versions (thus at different vulnerability levels). A perfect playground for whoever deposits a rootkit on your system!
Posted Oct 6, 2023 17:20 UTC (Fri)
by mathstuf (subscriber, #69389)
[Link]
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
Running programs are not affected by updating their files
Running programs are not affected by updating their files
For this particular case, where the vulnerability is in the loader evaluating the GLIBC_TUNABLES environment variable, I guess the program is no longer vulnerable after it has been started.
Running programs are not affected by updating their files
Running programs are not affected by updating their files
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
Previously the packages could "only" install upload users secrets. With this vulnerability they can take over the whole system.
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
> although we discovered this buffer overflow manually,
> we later tried to fuzz the vulnerable function, parse_tunables(); both
> AFL++ and libFuzzer re-discovered this overflow in less than a second,
> when provided with a dictionary of tunables (which can be compiled by
> running "ld.so --list-tunables").
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
A local root vulnerability in glibc
In addition to biting off to big a task, what did run was incredibly slow an never made it out to the public. They invested lots of money at the time.
A local root vulnerability in glibc
A local root vulnerability in glibc
Wol
A local root vulnerability in glibc
If you mean the Intel iAPX432, it was created in the 1980s. It was a fairly vertical microprogram with enormous amounts (for the day) of microcode on chip. That microcode provided an ISA which was a superset of what Ada needed: a multitasking operating system with capabilities and concurrent garbage collection in Silicon. One of the superset features was that a called procedure could survive returning to the caller, like Intel iAPX432
call/cc in Lisp. To do this, the microcode had to allocate the frame for each called procedure on the stack. When they got it running, they found that it could do 50 procedure calls per second: a bare procedure call took an average of 20 ms.
Err, the point I meant to make is that I do not think the capability addressing was the main problem with the 432.
Intel iAPX432
Intel iAPX432
Intel iAPX432
There is a fascinating oral history interview with Bob Colwell, senior architect on the Pentium Pro and the Pentium 4. He says (PDF, sorry) that in 1984:Intel iAPX432
...we went up to this bar where I struck up a conversation with some random
guy I didn't know sitting next to me. He asked me what I was doing at Intel for the summer. I
said "I'm a grad student doing some research on the 432." "Really? What kinds of things are
you finding?" I said "Well, I'm finding that there's a huge disconnect between the software
and the hardware. I mean the hardware should be capable of doing a procedure call much
quicker than it's actually doing, for instance, it's taking many hundreds of clock cycles. And
in other places, I'm seeing all kind of wastage from the compiler just setting variables that
never get used, classic stuff you just don't do." And the guy said "Really? I mean tell me more
about that part."
and
Well somewhere along the way, they threw away a little bit too much performance, and if
they had been paying attention to that aspect of it, I think that they could have fixed those
pieces, and if they made peace with the compiler guys they could have fixed that part of it
too. They could have actually got within shouting distance of a competitive part. But, as it
was, there were so many mistakes that there was no way to recover from them all.
It's a fascinating read.
A local root vulnerability in glibc
A local root vulnerability in glibc
- the suid program with specific scope (like mount, passwd..) and yes, we could rely to a client that connect a daemon using a socket; this would reduce the attack interface
- tools like sudo/doas/pkexec that are not easy to replace.
If it would be possible to clean the environment, you will not have all these sort of problem.
- the program has already used LD_PRELOAD
- anything in a (e.g.) library that uses an environment variable is still potentially exploitable...
/usr/bin/uml_net
/usr/bin/v4l-conf
/usr/bin/doas
/usr/bin/ntfs-3g
/usr/bin/fusermount3
/usr/bin/at
/usr/bin/sudo
/usr/bin/pkexec
/usr/bin/newgrp
/usr/bin/su
/usr/bin/mount
/usr/bin/umount
/usr/bin/chfn
/usr/bin/chsh
/usr/bin/gpasswd
/usr/bin/passwd
/usr/bin/pmount
/usr/bin/pumount
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/lib/openssh/ssh-keysign
/usr/lib/xorg/Xorg.wrap
/usr/lib/chromium/chrome-sandbox
/usr/lib/polkit-1/polkit-agent-helper-1
/usr/libexec/xscreensaver/xscreensaver-auth
/usr/sbin/mount.nfs
/usr/sbin/exim4
/usr/share/skypeforlinux/chrome-sandbox
/usr/share/teams/chrome-sandbox
A local root vulnerability in glibc
A local root vulnerability in glibc
/usr/bin/mtr-packet cap_net_raw=ep
/usr/bin/ping cap_net_raw=ep
A local root vulnerability in glibc
$ mysudo "echo --- ; whoami ; echo ---; set"
root@0.0.0.0's password:
---
root
---
BASH=/usr/bin/bash
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath
[...]
PWD=/home/ghigo
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=1
SSH_CLIENT='127.0.0.1 52998 22'
SSH_CONNECTION='127.0.0.1 52998 127.0.0.1 22'
TERM=dumb
UID=0
USER=root
A local root vulnerability in glibc
A local root vulnerability in glibc
