News for hackers. Stuff that matters.
Re:Desktop Linux Hardening by smoldesu on Monday June 12, 2023 @09:56AM (#36293484)
"read scripts before you run them" is a good bit of advice. Some little things can help you protect your GUI apps if you're extra paranoid (eg. Wayland is more secure, Flatpak offers additional sandboxing with bubblewrap) but not everything is necessary.

If you use a mainstream distro like Fedora or Ubuntu, its default configuration should be safe enough to use like Windows. Just remember that there isn't really any antivirus or Microsoft Defender to save you if you really mess up. I do offline backups of important work on all my devices, for this reason partially.

Re:Desktop Linux Hardening by TacticalCoder on Monday June 12, 2023 @10:19AM (#36293866)
> "read scripts before you run them" is a good bit of advice.

I always read the script and do also verify they're only using ASCII chars (and if they're not, I check which Unicode shenanigan is ongoing).

For example:

    ... $ file /usr/local/bin/somescript.sh 
    /usr/local/bin/somescript.sh: Bourne-Again shell script, ASCII text executable
FWIW most of the scripts out there are only ever using ASCII chars.
Re:Desktop Linux Hardening by chaxor on Monday June 12, 2023 @12:38PM (#36296338)
How do you check it without running something that may execute it? Many scripts will execute if opened with vi or even cat or printf from what I understand.
Re:Desktop Linux Hardening by JohnFen on Monday June 12, 2023 @01:43PM (#36297753)
> Many scripts will execute if opened with vi

I haven't encountered this. You can execute scripts intentionally in vi, and I assume you could configure it to happen automatically, but can this happen without you making some sort of effort to enable it?

What scripts present such a risk? What vi configuration is required to stop this?

Same question wrt cat.

Re:Desktop Linux Hardening by deadbunny on Monday June 12, 2023 @02:20PM (#36298415)
(n)vi(m), cat, less/more do not execute scripts on read. That would be utterly insane.
Re:Desktop Linux Hardening by cyberbanjo on Monday June 12, 2023 @12:46PM (#36296501)
Source for executing files with cat? That certainly defies my understand of how cat works.
Re:Desktop Linux Hardening by RadiozRadioz on Monday June 12, 2023 @02:34PM (#36298684)
Maybe they mean that it can include control characters that mess up your terminal and make it look like something malicious is happening, which of course is not the same as executing it (and has a warning anyway).
Re:Desktop Linux Hardening by hospitalJail on Monday June 12, 2023 @10:07AM (#36293646)
>Some little things can help you protect your GUI apps if you're extra paranoid

Can you explain this? What are the exploits?

Is it the equivalent of running a .exe or .jar on windows, but with an extra layer of protection? (Or am I trying to shove my windows ideas into linux?)

Re:Desktop Linux Hardening by smoldesu on Monday June 12, 2023 @10:12AM (#36293727)
> Can you explain this? What are the exploits?

Traditional desktop Linux allows different apps to more-or-less freely communicate with each other (called the x11 protocol). This works really well for old apps (and admittedly not too bad for new ones) but is very slow and exposes a lot of bugs. On top of this, you have potential exploits in your filesystem from loosely permissioning important settings and identity files. So, the attack surface for a traditional Linux distro is relatively large.

> Is it the equivalent of running a .exe or .jar on windows, but with an extra layer of protection?

Kinda! Linux software is distributed as packages, which contains a binary (the exe/jar portion), a dependency manifest and whatever static content it needs. A sandbox like Flatpak will take those packages and put it into a sandbox, to prevent hostile interprocess communication and filesystem exploits.

None of these mitigations are perfect per-se (nor are they on Mac/Windows), so use them wisely if you intend to use them at all. I have used a non-sandboxed system to run old 90s Windows games for years though, and haven't picked up any significant issues. YMMV, it is Linux after all :P

Re:Desktop Linux Hardening by hospitalJail on Monday June 12, 2023 @10:20AM (#36293879)
>Traditional desktop Linux allows different apps to more-or-less freely communicate with each other (called the x11 protocol).

Oh gosh. I'm getting heart palpitations :P

Is this a common attack vector then? Seems like an easy way to get an overflow error, or elevate privilege's.

Re:Desktop Linux Hardening by bombolo on Monday June 12, 2023 @10:42AM (#36294346)
Not common at all. Because most software comes from distributions, not from warez.exe.

Sandbox comes with a heavy usability price, so they are lax by default.

For example you protect your files, but then you can't load your photos to facebook because your browser doesn't have access.

Re:Desktop Linux Hardening by t0astbread on Monday June 12, 2023 @01:51PM (#36297890)
There's also a newer protocol called "Wayland" which aims to avoid some issues with X11 (and is also a general architecture overhaul). GNOME and KDE support it out of the box and iirc at least GNOME also enables it by default.

There are some tradeoffs though. Some things like screen sharing might be worse on Wayland (e.g. I can't share a single window, only whole screens) and some apps don't support Wayland at all (including for example all of the IntelliJ IDEs). The latter can be circumvented by enabling XWayland (basically an X server running side by side with the Wayland compositor to handle X11-only apps). In that case you're left with the X11 security model for apps not running natively on Wayland.

Re:Desktop Linux Hardening by JohnFen on Monday June 12, 2023 @03:47PM (#36299857)
And Wayland doesn't support being able to have multiple logons, each with their own independent desktop, simultaneously like X does.

I just like to bring that up even though it's not a common use case, because that's what keeps me from using Wayland.

Re:Desktop Linux Hardening by t0astbread on Monday June 12, 2023 @04:16PM (#36300346)
Interesting. Do you know why? I've only ever tried launching nested instances of Sway (the compositor I use) which each use their own sockets and render as a client to the parent compositor and that worked fine. Does it have something to do with rendering to a real display?
Re:Desktop Linux Hardening by JohnFen on Monday June 12, 2023 @04:54PM (#36300949)
I remember this being brought up early in Wayland development. The stance was taken that it wasn't a popular enough use case to be worth putting work into. I don't think there's any real technical reason why it couldn't be done, but I don't know. I'm not familiar with the architecture of Wayland.
Re:Desktop Linux Hardening by bandrami on Tuesday June 13, 2023 @12:55AM (#36305548)
I think seatd allows this now? So it works on the rather small sliver of distros that don't run systemd.
Re:Desktop Linux Hardening by glandium on Monday June 12, 2023 @10:14PM (#36304270)
> And Wayland doesn't support being able to have multiple logons, each with their own independent desktop, simultaneously like X does.

Not sure what you're referring to. I'm using wayland and I can open multiple desktops via gdm.

Re:Desktop Linux Hardening by bandrami on Tuesday June 13, 2023 @01:07AM (#36305671)
I think he means multiple simultaneous seats, and IIRC this is a limitation of systemd-logind, not wayland itself (it works on seatd, though that makes you manage your own XDG_RUNTIME_DIR, so I guess pick your poison).
Re:Desktop Linux Hardening by glandium on Tuesday June 13, 2023 @04:19AM (#36307201)
multiple seats of the same user?
Re:Desktop Linux Hardening by bandrami on Tuesday June 13, 2023 @05:12AM (#36307595)
Sure, if you're willing to multiplex your own XDG_RUNTIME_DIR. Hence "pick your poison".
Re:Desktop Linux Hardening by bandrami on Tuesday June 13, 2023 @01:06AM (#36305664)
There's whole classes of software that just don't make sense on Wayland. Most DAWs won't work because the whole point of a DAW is "be a big box that hosts docked windows of out-of-process audio plugins" which just isn't a concept Wayland has; the only way it would work would be to have Reaper or Ardour or whatever be its own compositor. Maybe somebody some day will write a "libsubcompositor" or something; IDK.
Re:Desktop Linux Hardening by bandrami on Tuesday June 13, 2023 @01:01AM (#36305605)
"more-or-less" is doing a lot of work there. It uses a cookie-based authentication system (in fact I think that's where web browsers got the word "cookie" from) but it was intended for trusted networks; when it's done in other situations it's via kerberos or over an SSH tunnel.

It's a pretty elegant setup, honestly, and one thing I miss when I'm on Wayland. The idea is you're at a small desktop on your University's network and you need to use some of the computing power of the big data servers they have. So you run e.g. a graphing program that does all of its computation on the big data machine but does its display on your little desktop (in this setup the big data machine is called the "client" and the tiny little desktop is called the "server" which confuses people a lot at first but makes sense when you get into the architecture).

X itself had been moving away from this for years by adding some extensions that don't work well (or at all) over the network, but there are absolutely still lab setups that use the old way because it's pretty much tailor-made for it.

The bigger security issue was that X programs could see and modify certain things about each other and about the system as a whole, so for example the program XEyes had a pair of eyes that pointed at the location of the cursor (it sounds silly but this was an accessibility thing). And a screenshot program could take a shot of the screen. And so on. Wayland got rid of all those capabilities, but there turned out to be a lot of baby in that bathwater so they're slowly adding back each of them, one at a time. In another decade a new crop of developers will no doubt say "What's all this needless cruft?! Let's start over!" and the cycle of life will continue.

Re:Desktop Linux Hardening by anthk on Monday June 12, 2023 @03:20PM (#36299488)
(U)XTerm can lock input to a terminal so snooping it it's impossible.
Re:Desktop Linux Hardening by ElectricalUnion on Monday June 12, 2023 @08:14PM (#36303297)
That doesn't help when a bunch of disparate credentials are entered and cached in a shared runtime environment inside the same bunch of processes (aka: your browser).

Obligatory XKCD: https://xkcd.com/1200/

Re:Desktop Linux Hardening by anthk on Tuesday June 13, 2023 @04:00AM (#36307049)
You have pledge and unveil under OpenBSD.

Or, if you are truly paranoid... just create another Unix user for sensible web browsing and log in with that account:

          useradd -m webcare
  
          passwd webcare
Done.