Is it actually dangerous to run Firefox as root?

I have a few Linux servers at home that I regularly remote into in order to manage, usually logged into KDE Plasma as root. Usually they just have several command line windows and a file manager open (I personally just find it more convenient to use the command line from a remote desktop instead of directly SSH-ing into the system), but if I have an issue, I’ve just been absentmindedly searching stuff up and trying to find solutions using the preinstalled Firefox instance from within the remote desktop itself, which would also be running as root.

I never even thought to install uBlock Origin on it or anything, but the servers are all configured to use a PiHole instance which blocks the vast majority of ads. However, I do also remember using the browser in my main server to figure out how to set up the PiHole instance in the first place, and that server also happens to be the most important one and is my main NAS.

I never went on any particularly shady websites, but I also don’t remember exactly which websites I’ve been on as root, though I do seem to remember seeing ads during the initial pihole setup, because it didn’t go very smoothly and I was searching up error messages trying to get it to work.

This is definitely on me, but it never crossed my mind until recently that it might be a bad idea to use a browser as root, and searching online everyone just states the general cybersecurity doctrine to never do it (which I’m now realizing I shouldn’t have) but no one seems to be discussing how risky it actually is. Shouldn’t Firefox be sandboxing every website and not allowing anything to access the base system? Between “just stop doing it” and “you have to reinstall the OS right now there’s probably already a virus on there,” how much danger do you suppose I’m in? I’m mainly worried about the security/privacy of my personal data I have stored on the servers. All my servers run Fedora KDE Spin and have Intel processors if that makes a difference?

rottingleaf,

Yes, it is. As a user you compromise only that user as a consequence of some sandbox escape. Then there may or may not be some successful privilege elevation.

BigTrout75,

This is like removing a safety feature in your car. Like removing seatbelts or maybe anti-lock brakes.

Falcon,

I have no clue how dangerous running Firefox as root is, but it begs the question…why would you do that?

Create a user account for managing things and create a separate user for each service and/or containers.

For managing things use tmux with ssh, if you want to manage files etc. just use ranger/lf/mc. One can also mount the file system with sshfs.

possiblylinux127,

I think there are many security issues with your setup. You really, really shouldn’t do everything as root. That is just a time bomb waiting to blow.

Anticorp,

It’s about as dangerous as using IE in the old days, or Edge in administrator mode.

danielfgom,
@danielfgom@lemmy.world avatar

It should be ok because nothing will run on your system without a permission prompt at least. So they that should ring some bells of system is asking for your password when you didn’t try to install anything.

But best practice would be log in as a regular user and use sudo to do any admin tasks.

DarthYoshiBoy,
DarthYoshiBoy avatar

A process running as root does not need a prompt or any user interaction to do whatever the hell it wants on most (nearing ALL, but I'd be wary of absolutes with Linux) systems. I'm unaware of any means that a Desktop Environment could restrict a process running with root permissions by requiring an interactive prompt of some sort for anything. If your DE is running as root, all of its children are also running as root (unless you've rigged things up to run explicitly as other users) which means just about anything you are doing could be running rampant malicious actors on your system and nothing would seem amiss until it made itself evident.

Now, it does seem unlikely that anyone has written any malicious code that would run in a browser expecting to be root on a Linux system, so that's likely the saving grace here, but that's only security through obscurity and that's not much to hang your hopes on for any system you care about.

danielfgom,
@danielfgom@lemmy.world avatar

You mean if he has some malicious script that wants to install something or run something it’s not going to adjust ask him “do you want to install x?”

DarthYoshiBoy,
DarthYoshiBoy avatar

I genuinely hope that you're kidding. If you're not. No. Just no.

tslnox,

Damn, you are so lucky that the downvotes are disabled or you would be downvoted to Oblivion.

danielfgom,
@danielfgom@lemmy.world avatar

Honestly friend I don’t give a rats ass about up or down votes. I’m just here to read, learn and converse. Some things I’ll get right, some I’ll get wrong. That’s life.

I could stop using this tomorrow and it would make zero difference to my life, know what I mean? It’s just some site. My real life is something altogether different.

FishFace,

An overarching principle of security is that of minimum privilege: everything (every process, every person) should have the minimum privileges it needs to do what it does, and where possible, that privilege should be explicitly granted temporarily and then dropped.

This means that any issue: a security breach or a mistake can’t access or break anything except whatever the component or person who had the issue could access or break, and that that access is minimal.

Suppose that you hit a page which exploits the https://www.hkcert.org/security-bulletin/mozilla-firefox-remote-code-execution-vulnerability_20230913 vulnerability in Firefox, or one like it, allowing remote code execution. If Firefox is running as root, the remote attacker now completely controls that machine. If you have SSH keys to other servers on there, they are all compromised. Your personal data could be encrypted for ransom. Anything that server manages, such as a TV or smart home equipment, could be manipulated arbitrarily, and possibly destroyed.

The same is true for any piece of software you use, because this is a general principle. Most distributions I believe don’t let you ssh in as root for that reason.

In short: don’t log in to anything as root; log in as a regular user and use sudo to temporarily perform administrator actions.

P.S. your description of the situation shows you don’t know the nature of vulnerabilities and security - if you’re running servers then this is something you should learn more about in short order.

billwashere,

No if you leave it running and don’t use it.

guitarsarereal,

Do you also hand out copies of your car and house keys to strangers you meet in parking lots?

remotelove,

Your frame of mind is “dangerous”. If you are browsing on your servers as root, you need to not manage servers anymore. If that sounded harsh, learn about attack surface area first and then I might let you back in the server room.

You won’t find discussions about running browsers as root because it’s not something you should need to discuss. Also, you don’t need to be browsing “shady” websites to get compromised. Get that myth out of your head.

find it more convenient to use the command line from a remote desktop instead of directly SSH-ing into the system

How is extra steps and added latency more convenient? The latency of a console via remote desktop would drive me crazy. Hell, I haven’t installed any kind of desktop environment on Linux server for over 20 years. It’s not needed and a waste of resources. Who needs file managers anyway?

Potatos_are_not_friends, (edited )

Your frame of mind is “dangerous”. If you are browsing on your servers as root, you need to not manage servers anymore. If that sounded harsh, learn about attack surface area first and then I might let you back in the server room.

You sir/ma’am hit it right on the head.

The “run root on Firefox” isn’t the issue, it’s the red flag. Security is a mindset. Failure to understand the core philosophy of why we have roles and permissions means you’re untrusted. It really isn’t personal. It’s security.

hottari,

You should learn how to use ssh. Running Firefox on top of Xorg is a disaster waiting to happen.

henrikx,

My goodness

ThankYouVeryMuch,
ThankYouVeryMuch avatar

I just wanted to add that you can run gui applications through ssh with x11 forwarding, options -X or -Y (untrusted/trusted but at least in Debian back in the day they behaved the same). So if you wanted a gui file manager you run it in the ssh session on the remote server, sudo if you need but NEVER logged as root, and the window will pop on your local DE instead of having to run an entire desktop on each server

lemmyvore,

You seriously need to stop what you’re doing. Log in with ssh only. If you need multiple terminals use multiple ssh sessions, or screen/tmux. If you need to search something do it on your desktop system.

The server should not have Firefox installed, or KDE, or anything related to desktop apps. There’s no point and nothing good can come of it.

Dirk,
@Dirk@lemmy.ml avatar

This. Thread should have officially ended here.

Falcon,

Yeah there’s a bit of scope to review what op is doing here.

Why is there even a DE on a server if it’s headless. If it’s not headless why not write up some Dockerfiles and manage it from a non-root account?

Are the services running as root?

Also, is it being accessed via wireguard/ovpn? It would be unwise to run a server as root with an open port.

desmosthenes,
@desmosthenes@lemmy.world avatar

came to say this

SpaceCadet,
@SpaceCadet@feddit.nl avatar

Realistically it’s not super dangerous, and no you probably don’t have a virus just from browsing a few tech support sites, but you do eliminate your last line of defense when you run software as root. As you know, root can read/change/delete anything on your system whereas regular users are generally restricted to their own data. So if there is a security problem in the software, it’s made worse by the fact that you were running it as root.

You are right though that Firefox does still have its own protections - it’s probably one of the most hardened pieces of software on your computer exactly because it connects to the whole wide internet - and those protections are not negated by running as root. However if those protections fail, the attacker has the keys to the kingdom rather than just a sizable chunk of the kingdom.

To put that in perspective though, if there is a Firefox exploit and a hacker gets access to your regular user account, that’s already pretty bad in itself. Even if you run as a regular unprivileged user they would still have have access to things like: your personal documents, your ssh keys, your Firefox profile with your browsing history, your session cookies and your saved passwords, your e-mail, your paypal account, your banking information, …

As root, they could obviously do even more like damage like reading all users’ data, installing a keylogger or screengrabber, installing a rootkit to make themselves undetectable, but for most regular users most of the damage is already done when their own account is compromised.

So when these discussions come up, I always have to think about this XKCD comic:

https://imgs.xkcd.com/comics/authorization_2x.png

taladar,

They might have access to all that data once but a lot of the paths towards making that a persistent threat that doesn’t go away after the next reboot and most of the ones towards installing something even deeper in the system that might even survive a reinstall do require root.

SpaceCadet,
@SpaceCadet@feddit.nl avatar

That’s what I said yes.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • rosin
  • cisconetworking
  • thenastyranch
  • magazineikmin
  • hgfsjryuu7
  • DreamBathrooms
  • InstantRegret
  • Youngstown
  • slotface
  • PowerRangers
  • Durango
  • everett
  • kavyap
  • vwfavf
  • Leos
  • modclub
  • ethstaker
  • khanakhh
  • tacticalgear
  • ngwrru68w68
  • osvaldo12
  • mdbf
  • tester
  • cubers
  • normalnudes
  • GTA5RPClips
  • anitta
  • provamag3
  • All magazines