mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[PR #3239] [MERGED] Harden dhcp by checking for /sbin/dhclient #4691
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#4691
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?
📋 Pull Request Information
Original PR: https://github.com/netblue30/firejail/pull/3239
Author: @kris7t
Created: 2/23/2020
Status: ✅ Merged
Merged: 2/23/2020
Merged by: @smitsohu
Base:
master← Head:dhcp-client📝 Commits (1)
9860590Harden dhcp by checking for /sbin/dhclient📊 Changes
1 file changed (+21 additions, -6 deletions)
View changed files
📝
src/firejail/dhcp.c(+21 -6)📄 Description
In order to avoid picking up some random executable from
$PATHand potentially running it root privileges,dhcp.cshould check for/sbin/dhclientor/usr/sbin/dhclientdirectly. This might cause problems on distributions wheredhclientis located elsewhere, but as far as I know,/sbinis the default location (and even Arch, which uses only/usr/bin, symlinks/sbinto/usr/bin). This is the same approach thatnetfilter.ctakes when runningiptables-restore.I formulated the check for root privileges according to https://github.com/netblue30/firejail/blob/master/src/firejail/x11.c#L1103, which allows the binary to either be owned by root, or the root group. A more paranoid version would use
open,fstatandfexecveto make sure ownership of the binary does not change between thestatandexeccalls. On the other hand, manipulation of a binary already owned by root means the system is already compromised, so there's probably not much point to be careful about TOCTOU here.netfiler.ceven skips the check altogether, and relies on/sbinbeing only writable by root.Hopefully, we don't blindly execute a binary with root privileges anywhere else in the codebase.
A more meta question: what is the policy with running external executable from firejail with root privilages (even if capability and seccomp sandboxed)? The potential for introducing setuid-related vulnerabilities is high. If we want to integrate additional external tools (like
xdg-dbus-proxy), we should try to keep it reasonably safe.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.