[GH-ISSUE #1926] prevent info leakage through /proc #1289

Open
opened 2026-05-05 07:48:07 -06:00 by gitea-mirror · 17 comments
Owner

Originally created by @brussell1 on GitHub (May 5, 2018).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1926

Blacklisting /proc works, though breaks some programs (firefox).
It's also possible to blacklist various information like "blacklist /proc/cpuinfo".
Unfortunately I'm not able to deny access to /proc/mounts or /proc/self/*.
E.g. right now all mountpoints of the host are visible, including all firejail related, which, imo, shouldn't be accessible in a sandbox.
Is there a solution to this problem?

Originally created by @brussell1 on GitHub (May 5, 2018). Original GitHub issue: https://github.com/netblue30/firejail/issues/1926 Blacklisting /proc works, though breaks some programs (firefox). It's also possible to blacklist various information like "blacklist /proc/cpuinfo". Unfortunately I'm not able to deny access to /proc/mounts or /proc/self/*. E.g. right now all mountpoints of the host are visible, including all firejail related, which, imo, shouldn't be accessible in a sandbox. Is there a solution to this problem?
gitea-mirror added the
question_old
label 2026-05-05 07:48:07 -06:00
Author
Owner

@SkewedZeppelin commented on GitHub (May 5, 2018):

There are already a few restrictions on /proc via Firejail itself. If you want system wide ones you can use hidepid, but that comes with some issues too.

Grsecurity has features to further restrict /proc via GRKERNSEC_PROC_ADD and even restrictions of /sysfs. As powerful as they are, they caused a ton of breakage on the desktop side and (I assume) were more intended for use on the single application server side.

I'm sure the situation can be improved, but there is a lot to it.

<!-- gh-comment-id:386813896 --> @SkewedZeppelin commented on GitHub (May 5, 2018): There are already a few restrictions on /proc via Firejail itself. If you want system wide ones you can use hidepid, but that comes with some issues too. Grsecurity has features to further restrict [/proc](https://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options#Proc_restrictions) via `GRKERNSEC_PROC_ADD` and even restrictions of [/sysfs](https://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options#Sysfs/debugfs_restriction). As powerful as they are, they caused a ton of breakage on the desktop side and (I assume) were more intended for use on the single application server side. I'm sure the situation can be improved, but there is a lot to it.
Author
Owner

@Vincent43 commented on GitHub (May 5, 2018):

Grsecurity public patches are no more anyway. hidepid is the way to go.

<!-- gh-comment-id:386827917 --> @Vincent43 commented on GitHub (May 5, 2018): Grsecurity public patches are no more anyway. `hidepid` is the way to go.
Author
Owner

@chiraag-nataraj commented on GitHub (May 5, 2018):

Just a side note, I've had issues with hidepid=2 and systemd/logind not cleaning up sessions. One way to fix this (if you care - I don't think it actually impacts anything besides having tons of zombie sessions in loginctl list-sessions) is creating a special group (I called it proc), mounting proc with hidepid=2,gid=<gid> with <gid> being the gid from the group created in the previous step, and adding your user and polkitd to that group. At least...I think it's solved that issue...I don't generally log out once I've logged in, so it's hard to know if that was the issue 😂
/endrant

<!-- gh-comment-id:386828872 --> @chiraag-nataraj commented on GitHub (May 5, 2018): Just a side note, I've had issues with `hidepid=2` and `systemd`/`logind` not cleaning up sessions. One way to fix this (if you care - I don't think it actually impacts anything besides having tons of zombie sessions in `loginctl list-sessions`) is creating a special group (I called it proc), mounting proc with `hidepid=2,gid=<gid>` with `<gid>` being the gid from the group created in the previous step, and adding your user and `polkitd` to that group. At least...I _think_ it's solved that issue...I don't generally log out once I've logged in, so it's hard to know if that was the issue :joy: /endrant
Author
Owner

@Vincent43 commented on GitHub (May 5, 2018):

Adding yourself to hidepid gid will defeat the purpose of using it with firejail (it still will affect system-wide daemons running as non-root but that is unrelated to this case). I think adding logind and polkit should be enough:

/etc/systemd/system/systemd-logind.service.d/hidepid.conf

[Service]
SupplementaryGroups=proc
<!-- gh-comment-id:386829067 --> @Vincent43 commented on GitHub (May 5, 2018): Adding yourself to hidepid gid will defeat the purpose of using it with firejail (it still will affect system-wide daemons running as non-root but that is unrelated to this case). I think adding logind and polkit should be enough: ``` /etc/systemd/system/systemd-logind.service.d/hidepid.conf [Service] SupplementaryGroups=proc ```
Author
Owner

@chiraag-nataraj commented on GitHub (May 5, 2018):

Oh right, you have to add logind to the group as well. For some reason, I think I had issues until I added my user as well. I'm also thinking about removing my user from the group anyway since I don't log out often (so the zombie sessions don't really have an impact on me).

<!-- gh-comment-id:386829160 --> @chiraag-nataraj commented on GitHub (May 5, 2018): Oh right, you have to add `logind` to the group as well. For some reason, I think I had issues until I added my user as well. I'm also thinking about removing my user from the group anyway since I don't log out often (so the zombie sessions don't really have an impact on me).
Author
Owner

@Vincent43 commented on GitHub (May 5, 2018):

Keep in mind that by removing your user from hidepid whitelist you loose ability to monitor system-wide processes from user account.

<!-- gh-comment-id:386829271 --> @Vincent43 commented on GitHub (May 5, 2018): Keep in mind that by removing your user from hidepid whitelist you loose ability to monitor system-wide processes from user account.
Author
Owner

@chiraag-nataraj commented on GitHub (May 5, 2018):

Yeah, and sometimes that includes firejailed processes.

<!-- gh-comment-id:386829339 --> @chiraag-nataraj commented on GitHub (May 5, 2018): Yeah, and sometimes that includes firejailed processes.
Author
Owner

@chiraag-nataraj commented on GitHub (May 5, 2018):

By the way, hidepid=2 won't blacklist /proc/mounts or /proc/self, so while it's useful, it won't solve the OP.

<!-- gh-comment-id:386830443 --> @chiraag-nataraj commented on GitHub (May 5, 2018): By the way, `hidepid=2` won't blacklist `/proc/mounts` or `/proc/self`, so while it's useful, it won't solve the OP.
Author
Owner

@Vincent43 commented on GitHub (May 5, 2018):

I see below in logs:

$ firejail --debug --noprofile --blacklist=/proc/mounts bash
...
Disable /proc/1/mounts (requested /proc/mounts)
...

$ cat /proc/1/mounts
cat: /proc/1/mounts: Permission denied
<!-- gh-comment-id:386835387 --> @Vincent43 commented on GitHub (May 5, 2018): I see below in logs: ``` $ firejail --debug --noprofile --blacklist=/proc/mounts bash ... Disable /proc/1/mounts (requested /proc/mounts) ... $ cat /proc/1/mounts cat: /proc/1/mounts: Permission denied ```
Author
Owner

@brussell1 commented on GitHub (May 5, 2018):

@Vincent43
And whats with "cat /proc/mounts". Try it out...

<!-- gh-comment-id:386836234 --> @brussell1 commented on GitHub (May 5, 2018): @Vincent43 And whats with "cat /proc/mounts". Try it out...
Author
Owner

@Vincent43 commented on GitHub (May 5, 2018):

I know. I just demonstrated what is happening. I don't know if it's a bug or feature.

<!-- gh-comment-id:386841547 --> @Vincent43 commented on GitHub (May 5, 2018): I know. I just demonstrated what is happening. I don't know if it's a bug or feature.
Author
Owner

@Vincent43 commented on GitHub (May 6, 2018):

You can block various /proc and /sys entries through AppArmor integration, example:

# /etc/apparmor.d/local/firejail-local
deny /proc/mounts r,
deny /proc/mountinfo r,

deny /proc/@{PID}/mounts r,
deny /proc/@{PID}/mountinfo r,
$ firejail --apparmor --noprofile bash

$ findmnt
findmnt: can't read /proc/self/mountinfo: Permission denied

$ cat /proc/mounts
cat: /proc/mounts: Permission denied

<!-- gh-comment-id:386844541 --> @Vincent43 commented on GitHub (May 6, 2018): You can block various /proc and /sys entries through AppArmor integration, example: ``` # /etc/apparmor.d/local/firejail-local deny /proc/mounts r, deny /proc/mountinfo r, deny /proc/@{PID}/mounts r, deny /proc/@{PID}/mountinfo r, ``` ``` $ firejail --apparmor --noprofile bash $ findmnt findmnt: can't read /proc/self/mountinfo: Permission denied $ cat /proc/mounts cat: /proc/mounts: Permission denied ```
Author
Owner

@brussell1 commented on GitHub (May 7, 2018):

Thanks for the info Vincent43. Though I would like to hear the opinion of netblue30 regarding this matter.

<!-- gh-comment-id:387115191 --> @brussell1 commented on GitHub (May 7, 2018): Thanks for the info Vincent43. Though I would like to hear the opinion of netblue30 regarding this matter.
Author
Owner

@chiraag-nataraj commented on GitHub (Jul 30, 2018):

@netblue30 Any comments on this?

<!-- gh-comment-id:408968827 --> @chiraag-nataraj commented on GitHub (Jul 30, 2018): @netblue30 Any comments on this?
Author
Owner

@chiraag-nataraj commented on GitHub (May 21, 2019):

@netblue30, is this something we want to work on within firejail or is this outside the scope of the project?

<!-- gh-comment-id:494203982 --> @chiraag-nataraj commented on GitHub (May 21, 2019): @netblue30, is this something we want to work on within firejail or is this outside the scope of the project?
Author
Owner

@SkewedZeppelin commented on GitHub (Jul 21, 2022):

A comment I've read regarding Tor browser profiles:

yeah but people should block/deny access to /sys/net/class in firejail or apparmor as that is location of real MAC Address and has been used in past to deanonimize before

Files like /sys/class/net/wlp1s0/address do indeed contain the MAC address

<!-- gh-comment-id:1191782459 --> @SkewedZeppelin commented on GitHub (Jul 21, 2022): A comment I've read regarding Tor browser profiles: > yeah but people should block/deny access to `/sys/net/class` in firejail or apparmor as that is location of real MAC Address and has been used in past to deanonimize before Files like /sys/class/net/wlp1s0/address do indeed contain the MAC address
Author
Owner

@ghost commented on GitHub (Jul 23, 2022):

@SkewedZeppelin IMO we should add a blacklist /sys/class/net to the relevant Tor profiles to mitigate deanonimazation attempts. Great catch! Are you planning on opening a PR for this?

Off-topic: unfortunately the --mac=address option is not supported for wireless interfaces. But there are several other options available on most distro's for MAC address spoofing (fully or partially).

<!-- gh-comment-id:1193138722 --> @ghost commented on GitHub (Jul 23, 2022): @SkewedZeppelin IMO we should add a `blacklist /sys/class/net` to the relevant Tor profiles to mitigate deanonimazation attempts. Great catch! Are you planning on opening a PR for this? Off-topic: unfortunately the `--mac=address` option is not supported for wireless interfaces. But there are several other options available on most distro's for [MAC address spoofing](https://wiki.archlinux.org/title/MAC_address_spoofing) (fully or partially).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#1289
No description provided.