mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #258] (as superuser) in title bar #183
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#183
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SYN-cook on GitHub (Jan 23, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/258
Question asked by sullybear on Wordpress: I notice that the title bar in firefox shows “(as superuser)” is that normal? Or did I goof a setting?
Reply from netblue30: The sandbox process itself runs as root. The application inside the sandbox runs as a regular user. I don’t know why firefox shows as superuser, “ps aux | grep firefox” reports it as a regular user. I would say is a bug in firefox.
I want to add that I observe the same behavior for other applications as well, i.e. VLC, Audacious, Transmission. In all these cases, the title bar claims that the application is running as root. At the same time, the sandbox appears to work perfectly.
Firejail version 0.9.36
@ssokolow commented on GitHub (Jan 26, 2016):
I don't have time to test it myself right now, but have you tried running
python -c 'import os; print(os.getresuid())'under firejail?That'll return the real, effective, and saved UIDs. All of the listed apps are GTK+ apps, so I suspect either GTK+ or maybe your window manager has some code which is reading one of those values and firejail forgot to reset it.
If you want to narrow down the culprit, I'd...
xprop | egrep '^_NET_WM_PID'to see if the presence or absence of "(as superuser)" has any correlation to the presence or absence of the_NET_WM_PIDwindow property that's used to look up processes from windows. (Because X began as a network-transparent system, the ability to look up a process ID from a window ID was bolted on afterward and is optional. If only things with_NET_WM_PIDdisplay "(as superuser)", then it may be a sign that the WM is adding it.)@SYN-cook commented on GitHub (Jan 27, 2016):
Thanks for your suggestions, I played around a little yesterday and here is what I found:
python -c 'import os; print(os.getresuid())': It always returns the current user, also from within firejail. Let me demonstrate:python -c 'import os; print(os.getresuid())'returns(0, 0, 0)python -c 'import os; print(os.getresuid())'returns(1000, 1000, 1000)python -c 'import os; print(os.getresuid())'returns(1000, 1000, 1000)_NET_WM_PIDwindow property.I run Debian Jessie Mate, thus my window manager is Metacity (Marco) 1.8.2.
@ssokolow commented on GitHub (Jan 27, 2016):
If there's a strict correlation between the presence of
_NET_WM_PIDand the presence of "(as superuser)", I'd say that makes it pretty likely that it's Metacity adding it.As for switching the user to root after opening the terminal, the terminal itself still wouldn't be running as root... it'd just be the process running within the terminal which got elevated. A more meaningful question would be whether it'd lose the "(as superuser)" if
setuid()and some other calls were used to drop privileges within the process referenced by_NET_WM_PID.The next thing I'd suggest is installing a window manager with minimal dependencies like Openbox and then temporarily swapping it in with
openbox --replace(and thenmetacity --replaceto return to normal) to confirm the hypothesis that it's Metacity doing it.If Metacity is responsible, the simplest way to identify the solution would be to grab a source tarball for it and grep for "as superuser" to figure out what it's conditional on.
Failing that, you could try narrowing down the cause with a few other experiments:
os.getlogin()call returns a different user thanos.getresuid()xterm -hold -e exportunder "(as superuser)" conditions to see if any environment variables might be responsible (The cause doesn't even have to be within the same process or a child. You can inspect the environment of any other process running at the same user via the/proc/<PID>/environvirtual file)setsidbetween thesuand terminal call to see if running the program in a new session helps.os.setpgrp()to ensure it's running in a fresh process group.bash --loginin between yoursucall and launching a new terminal. (Just a thought. It might be walking up the process ancestry hierarchy to find the root for the login session and firejail isn't doing something that a normal login does to reset things. If so,bash --loginmight cause different results.)@netblue30 commented on GitHub (Jan 27, 2016):
I've seen this problem at some point on Debian Wheezy, then something got updated and it totally disappeared. I think it has something to do with the window/desktop manager.
@SYN-cook commented on GitHub (Jan 27, 2016):
From Mate running, I executed
openbox --replaceand it resolved the issue completely! However, when I returned to Marco afterwards, the (as superuser) title bars didnotreappear.For them to reappear, I needed to logout and login again.Further, runningmarco --replacein the first place also resolves the issue.I searched the Metacity sources and found the (as superuser) string in core/window-props.c https://github.com/GNOME/metacity/blob/master/src/core/window-props.c
@ssokolow commented on GitHub (Jan 27, 2016):
OK, reading upward reveals that it's triggered by
window_ownerbeing equal to0and thatwindow_owneris set by a call toowner_of_processwhich, sure enough, takeswindow->net_wm_pidas input.Searching reveals
owner_of_processto be defined in the same file at line 492 and that, in the successful case, it delegates the task of actually finding the process's owner toglibtop_get_proc_uid.A quick Google search reveals that to be part of libgtop and a quick GitHub "This repository" search narrows it down to the file
libgtop/sysdeps/common/default.c, where it's a simpler-to-use wrapper for the functionglibtop_get_proc_uid_l.However, I'm having trouble finding the actual definition of that last function.
@SYN-cook commented on GitHub (Jan 27, 2016):
Sorry, I don't know if this helps: http://sourcecodebrowser.com/libgtop/2.22.0/procuid_8h.html#aff3a9a5a3afb876e35bad14e850a56e6
@ssokolow commented on GitHub (Jan 27, 2016):
That definitely helps. It looks like
glibtop_get_proc_uid_lhas two different behaviours depending on whether it's going to call a gtop server or perform the query within the same process. The server approach appears to just be sending a request over a socket and receiving a response, so I decided to see if the non-server path did anything relevant since that's easier to trace with that site...glibtop_get_proc_uid_sglibtop_get_proc_uid_scalls_glibtop_get_procinfoto retrieve the struct containing theuidmember we care about._glibtop_get_procinforepeatedly calls a function namedgetprocsto populateserverand then, upon finding a match, returns&server->machine.last_pinfo.Unfortunately,
getprocsdoesn't get auto-hyperlinked by that tool and I'm too sleepy to investigate further there or to start looking for the server code, so digging deeper will have to wait for another day.@ghost commented on GitHub (Feb 7, 2016):
For me, MATE shows as if programs are running as root. XFCE and KDE, however, don't.
@0xBRM commented on GitHub (Feb 7, 2016):
@amarildojr KDE 4.14 here and it shows firefox running (as superuser).
@ghost commented on GitHub (Feb 8, 2016):
@CrisBRM Yes. I remember running firejail in Debian Jessie and experiencing the same thing. However, I use Arch and thus KDE is on version 5.
@SYN-cook commented on GitHub (Sep 19, 2016):
OK, I don't see this any more in current Debian Testing Mate (with Mate 1.14), while the issue is still there in a freshly installed Debian Jessie Mate (with Mate 1.8).
Further, I don't see (and have never seen) the superuser titlebar in Debian Jessie KDE, Gnome or Cinnamon.
@netblue30 commented on GitHub (Sep 19, 2016):
I think it will stay in Jessie like that forever. I don't have it either in Mate in Debian testing.
@gripedthumbtacks commented on GitHub (Sep 28, 2017):
this issue seems to have reappeared in the latest mate releases
@pemartins1 commented on GitHub (Oct 1, 2017):
I can confirm the issue, using Linux Mint Mate 18.2. Just noticed that Firefox was supposedly being ran as superuser when Firejailed.
@smitsohu commented on GitHub (Nov 2, 2017):
A possible explanation for the effect is that programs run in PID namespaces and both the programs and Mate's window manager don't know about it.
The PID from inside the sandbox, typically a small number, is used to set _NET_WM_PID, and then probably the window manager checks outside the sandbox if this _NET_WM_PID belongs to the superuser (which it usually does).
@hamishmb commented on GitHub (Jun 12, 2020):
Can confirm it happens in Mint 19.3 MATE as well (MATE 1.22.2)
@smitsohu commented on GitHub (Jun 26, 2020):
@hamishmb It's an issue with Marco, MATE's window manager.
See mate-desktop/marco#301