mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #5280] Allow U2F security keys by default #2941
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#2941
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 @hackerb9 on GitHub (Jul 31, 2022).
Original GitHub issue: https://github.com/netblue30/firejail/issues/5280
Is your feature request related to a problem? Please describe.
Yes, there is a problem. Firejail works so well that it is easy to forget that it is installed. Then, when someone (okay, it was me) buys a U2F security key (Yubico, Solokeys, etc) they will be frustrated that it does not work in their browser. It took me a while to figure it out, but luckily, I wasn't the only one who had installed Firejail a long time ago and forgot about it: a web search turned up Firejail among the possible reasons why U2F might not work in Firefox. The advice given (to whitelist everything) was incorrect, but it at least got me pointed in the right direction.
Describe the solution you'd like
Please set the default for
browse-disable-u2ftono.Describe alternatives you've considered
Not applicable.
Additional context
While it makes sense to block USB access by default, security keys are a special case. They increase security and complement the protections given by Firejail. While I haven't done a poll, I would guess that the great majority of individual Firejail users who have U2F keys would want to be able to use them in their web browser. (Firejail users who do not have U2F keys would not be affected by this change other than that if they ever get a U2F key, it will work.)
A default of 'no' still allows anyone who wants to disable U2F to simply change it to 'yes'. But, I am hard pressed to imagine a use case where anyone would find that beneficial. I had originally thought perhaps public kiosks or for large deployments at a corporation, but in both cases, you would either choose to have no USB ports (to prevent Windows driver exploits) or you'd want U2F to work so that people can authenticate securely.
@rusty-snake commented on GitHub (Jul 31, 2022):
Duplicate of #4295
@rusty-snake commented on GitHub (Jul 31, 2022):
They will be affected. I don't have any u2f hardware and
--nou2fchangesls -l /dev | wc -lfor me.The problem is that
nou2fis named a bit misleading, it should be better namednohidraw.And this change (enumerate bad devices instead of enumerate good devices) will not affect other users?
06d3fd0581/etc/profile-a-l/firefox-common.profile (L55)@rusty-snake commented on GitHub (Jul 31, 2022):
Well yes they increase security, but it's another kind of security than firejail provides.
@hackerb9 commented on GitHub (Aug 1, 2022):
I agree and add that it would be helpful if Firejail worked by default with U2F keys as they provide a form of security that Firejail does not.
Thank you for correcting me that this change would affect users who do not use U2F keys. How serious of a problem is it?
When you say it changes "hidraw", do you mean that setting
browse-disable-u2ftonoactually allows the browser to access any USB Human Interface Device in Firejail? While I expected there would be the usual security/convenience tradeoff, that sounds like a huge hole. And, of course, I would not want the default changed until Firejail has a way to limit access to only U2F keys.@rusty-snake commented on GitHub (Aug 1, 2022):
Yes, w/o
nou2fany HID device file in/devis bind-mounted into the sandbox (in my case my optical mouse). The only permission checks then are the default check of the kernel.In the past it was called
nousbIIRC.Fully agreed, the only reason why it is blocked by default are the costs.
There are two issues:
nou2fallows more than u2f keysprivate-devneeds to be dropped (or you have no real advantage for new users over settingbrowse-disable-u2fby hand)disable-sys.inc)tty*,nvme*,nvram,rtc?,tpm*,vhost-*,vcs*, ...). (Permission check of the kernel still apply)no*.@rusty-snake commented on GitHub (Aug 1, 2022):
So to allow U2F keys by default in browser we would need
private-dev.@hackerb9 commented on GitHub (Aug 1, 2022):
Now that I understand that Firejail would allow access to all USB devices, I completely agree with the decision to keep U2F keys off by default.
I hope that the name of the option can be changed to something like, browser-allow-all-usb-access. When I flipped the
browse-disable-u2ftoggle on my machine, I had mistakenly presumed it only affected U2F.@hackerb9 commented on GitHub (Aug 1, 2022):
You probably already know this, but Yubico used to have their own udev rules, 70-u2f.rules. I believe that now the list of vendors and their U2F keys is kept in (/lib/udev/hwdb.d/20-usb-vendor-model.hwdb), but I'm not exactly sure which rules and TAGS get applied to them. On my machine, my keys get tagged security-device and the property ID_FIDO_TOKEN gets set to 1.
Output from udevadm monitor -p -t security-device
@hackerb9 commented on GitHub (Aug 1, 2022):
A-ha! If you don't want to rely on udev existing, you can examine the HID report for the declared usage of a device to determine if it is a FIDO key. Here's how systemd does it in fido_id_desc.c:
Click to see fido_id_desc.c
@rusty-snake commented on GitHub (Aug 2, 2022):
Renaming has always the problem with backward compatibility and outdated tutorials, maybe a warning in the description would be better.
@hackerb9 commented on GitHub (Aug 2, 2022):
That works for me.
@kmk3 commented on GitHub (Aug 28, 2022):
@rusty-snake commented on Jul 31:
Well, you're in luck, as I decided to do so after seeing #5329 and thinking
that bluetooth headsets could maybe be blocked by
nou2f(which would berather confusing). As apparently HIDs are not limited to USB devices. From
Linux's Documentation/hid/hidraw.rst:
Most of the changes that would be needed are done, but I need to clarify some
things for the docs (I'll probably open a question for it).
I can see why
BROWSER_DISABLE_U2Fwould disablenou2f, but why disableprivate-dev? Are there U2F keys that show up in paths other than/dev/hidraw*?Nevermind, after some digging I get it now:
That was added on commit
32c366911("Browsers: private-dev conditional withBROWSER_DISABLE_U2F", 2020-01-21), which references #3170, which leads to #3513
and this comment:
@SkewedZeppelin commented on Jul 16, 2020:
@kmk3 commented on GitHub (Aug 28, 2022):
@rusty-snake commented on Aug 2:
We could add a new one and deprecate the current one. For example:
browser-disable-u2f->browser-disable-hidrawBROWSER_DISABLE_U2F->BROWSER_DISABLE_HIDRAWOr even:
browser-disable-u2f->browser-nohidrawBROWSER_DISABLE_U2F->BROWSER_NOHIDRAWTo make grepping for all occurrences of
nohidraweasier.Now considering the above comment about
private-dev, maybe there couldbe a separate toggle for
private-devin browsers? So that users can choosebetween security/usability. For example:
BROWSER_NOHIDRAWBROWSER_PRIVATE_DEVIf the reasoning for each is explained on firejail.config and if they're
referenced in the description of
--nohidraw, I think that it would be clearenough.
@rusty-snake commented on GitHub (Aug 28, 2022):
Sounds good. I was thinking about merging both conditions into one config option (i.e.
deny,allowandallow-restricted).What would be the behaviour if both are present? IMHO we should error out then and let the user fix the configuration.
@hackerb9 commented on GitHub (Aug 29, 2022):
I have wrangled together an example, based @amluto's u2f-hidraw-policy, showing how Firejail can solve number 1.
Please download
isu2f.cfrom here: https://gist.github.com/hackerb9/4abd1484c48c857b4c4b73f4fc9c8e7dIt is a simple command line program that checks for U2F keys using just the USB report descriptor. It does not require a database of USB IDs, nor does it depend on extra libraries, udev, or systemd. It works best if sysfs is mounted on /sys, but it can read the report descriptor from any file.
Here is an example run: