[GH-ISSUE #386] Whitelisting doesn't work if whitelisted path is a symlink #277

Closed
opened 2026-05-05 05:30:04 -06:00 by gitea-mirror · 21 comments
Owner

Originally created by @n1trux on GitHub (Mar 26, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/386

cp -a ~/Downloads /opt/
ln -s /opt/Downloads ~/Downloads
ln -s /usr/bin/firejail /usr/local/bin/firefox
firefox

error is:

Error: invalid whitelist path /home/n1trux/Downloads
Originally created by @n1trux on GitHub (Mar 26, 2016). Original GitHub issue: https://github.com/netblue30/firejail/issues/386 ``` cp -a ~/Downloads /opt/ ln -s /opt/Downloads ~/Downloads ln -s /usr/bin/firejail /usr/local/bin/firefox firefox ``` error is: ``` Error: invalid whitelist path /home/n1trux/Downloads ```
gitea-mirror 2026-05-05 05:30:05 -06:00
Author
Owner

@netblue30 commented on GitHub (Mar 26, 2016):

I guess I should allow this type of functionality. Let me think about it, thanks!

<!-- gh-comment-id:201824602 --> @netblue30 commented on GitHub (Mar 26, 2016): I guess I should allow this type of functionality. Let me think about it, thanks!
Author
Owner

@tobykurien commented on GitHub (Mar 31, 2016):

+1 - worked with older versions (in Ubuntu) but stopped working on current version

<!-- gh-comment-id:203877347 --> @tobykurien commented on GitHub (Mar 31, 2016): +1 - worked with older versions (in Ubuntu) but stopped working on current version
Author
Owner

@liloman commented on GitHub (Apr 23, 2016):

Same here.
I can't access .mplayer path from firefox cause It's a symlink to my dotfiles.

Even more I think I can't blacklist /bin -> /usr/bin from firefox for the very same reason and private-bin is not working either...

<!-- gh-comment-id:213712193 --> @liloman commented on GitHub (Apr 23, 2016): Same here. I can't access .mplayer path from firefox cause It's a symlink to my dotfiles. Even more I think I can't blacklist /bin -> /usr/bin from firefox for the very same reason and private-bin is not working either...
Author
Owner

@sciamano commented on GitHub (Jun 14, 2016):

I have the issue too: my .cache is symlinked to /dev/shm/unburden-username/cache using unburden-home-dir and the default FF profile from /etc/firejail/firefox.profile leads to
Error: invalid whitelist path /home/username/.cache/mozilla/firefox

PS: using version from debian testing

<!-- gh-comment-id:225962030 --> @sciamano commented on GitHub (Jun 14, 2016): I have the issue too: my `.cache` is symlinked to `/dev/shm/unburden-username/cache` using `unburden-home-dir` and the default FF profile from `/etc/firejail/firefox.profile` leads to `Error: invalid whitelist path /home/username/.cache/mozilla/firefox` PS: using version from debian testing
Author
Owner

@netblue30 commented on GitHub (Jun 14, 2016):

I think I will have to drop this enhancement. I cannot allow symlinks from /home/user and from /tmp directories. There will be tones of security problems related to SUID binary. The safe thing for now is to wait, maybe somebody comes up with an idea how this can be done safely.

<!-- gh-comment-id:225998269 --> @netblue30 commented on GitHub (Jun 14, 2016): I think I will have to drop this enhancement. I cannot allow symlinks from /home/user and from /tmp directories. There will be tones of security problems related to SUID binary. The safe thing for now is to wait, maybe somebody comes up with an idea how this can be done safely.
Author
Owner

@liloman commented on GitHub (Jun 19, 2016):

So which do you think will be the solution for those using symlinks?

Hardlinks? (if the same partition)

I have to do something with this issue for sure cause the .mplayer issue is rather cumbersome for me (but how there isn't audio yet it is really not important cause I stopped launching mplayer/youtube-dl from the brower, bothersome but "temporal" till fixed the sound issue). ;)

<!-- gh-comment-id:227023773 --> @liloman commented on GitHub (Jun 19, 2016): So which do you think will be the solution for those using symlinks? Hardlinks? (if the same partition) I have to do something with this issue for sure cause the .mplayer issue is rather cumbersome for me (but how there isn't audio yet it is really not important cause I stopped launching mplayer/youtube-dl from the brower, bothersome but "temporal" till fixed the sound issue). ;)
Author
Owner

@netblue30 commented on GitHub (Jun 20, 2016):

I don't know, maybe I can allow it on Grsecurity systems. It is really a kernel problem, never recognized as such by the kernel people.

<!-- gh-comment-id:227185425 --> @netblue30 commented on GitHub (Jun 20, 2016): I don't know, maybe I can allow it on Grsecurity systems. It is really a kernel problem, never recognized as such by the kernel people.
Author
Owner

@liloman commented on GitHub (Jun 22, 2016):

They are starting to implement grsecurity now... so who knows? 💃

What about checking for symlinks and using readlink to point to the target dir? It would be a userspace solution and Torvalds would be pretty happy about that. ;)

<!-- gh-comment-id:227680536 --> @liloman commented on GitHub (Jun 22, 2016): They are starting to implement grsecurity now... so who knows? :dancer: What about checking for symlinks and using readlink to point to the target dir? It would be a userspace solution and Torvalds would be pretty happy about that. ;)
Author
Owner

@netblue30 commented on GitHub (Jul 12, 2016):

Whitelisting symlinks outside user home directory is implemented.

<!-- gh-comment-id:232033886 --> @netblue30 commented on GitHub (Jul 12, 2016): Whitelisting symlinks outside user home directory is implemented.
Author
Owner

@liloman commented on GitHub (Jul 20, 2016):

Awesome man. :)

I just figured it out right now.

Nice!

<!-- gh-comment-id:234019482 --> @liloman commented on GitHub (Jul 20, 2016): Awesome man. :) I just figured it out right now. Nice!
Author
Owner

@bitnom commented on GitHub (Jul 22, 2018):

Not working for me. Using 0.9.54

<!-- gh-comment-id:406886787 --> @bitnom commented on GitHub (Jul 22, 2018): Not working for me. Using 0.9.54
Author
Owner

@Linux-Fan commented on GitHub (Feb 22, 2020):

firejail --apparmor opera --disable-seccomp-filter-sandbox
Reading profile /home/zbyszek/.config/firejail/opera.profile
Reading profile /etc/firejail/chromium-common.profile
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-devel.inc
Reading profile /etc/firejail/disable-exec.inc
Reading profile /etc/firejail/disable-interpreters.inc
Reading profile /etc/firejail/disable-programs.inc
Reading profile /etc/firejail/whitelist-common.inc
Reading profile /etc/firejail/whitelist-var-common.inc
Parent pid 3692, child pid 3693
Error: invalid whitelist path /home/zbyszek/.config/opera
Error: proc 3692 cannot sync with peer: unexpected EOF
Peer 3693 unexpectedly exited with status 1
<!-- gh-comment-id:589976365 --> @Linux-Fan commented on GitHub (Feb 22, 2020): ``` firejail --apparmor opera --disable-seccomp-filter-sandbox Reading profile /home/zbyszek/.config/firejail/opera.profile Reading profile /etc/firejail/chromium-common.profile Reading profile /etc/firejail/disable-common.inc Reading profile /etc/firejail/disable-devel.inc Reading profile /etc/firejail/disable-exec.inc Reading profile /etc/firejail/disable-interpreters.inc Reading profile /etc/firejail/disable-programs.inc Reading profile /etc/firejail/whitelist-common.inc Reading profile /etc/firejail/whitelist-var-common.inc Parent pid 3692, child pid 3693 Error: invalid whitelist path /home/zbyszek/.config/opera Error: proc 3692 cannot sync with peer: unexpected EOF Peer 3693 unexpectedly exited with status 1 ```
Author
Owner

@cjsthompson commented on GitHub (Feb 27, 2020):

Same problem here (Arch Linux x86-64, apparmor enabled). Firefox will start but I'll get an error message that I can't save my downloads to ~/Downloads which is a symlink to a downloads folder on another btrfs subvolume.

<!-- gh-comment-id:592200159 --> @cjsthompson commented on GitHub (Feb 27, 2020): Same problem here (Arch Linux x86-64, apparmor enabled). Firefox will start but I'll get an error message that I can't save my downloads to ~/Downloads which is a symlink to a downloads folder on another btrfs subvolume.
Author
Owner

@ghost commented on GitHub (Feb 27, 2020):

@cjsthompson Where exactly is that other btrfs subvolume mounted? Keep in mind that /etc/firejail/firefox-common.profile uses disable-mnt, so that will block access to /mnt, /media, /run/mount and /run/media. You will have to explicitly grant access to the symlinked downloads folder.

<!-- gh-comment-id:592210841 --> @ghost commented on GitHub (Feb 27, 2020): @cjsthompson Where exactly is that other btrfs subvolume mounted? Keep in mind that /etc/firejail/firefox-common.profile uses `disable-mnt`, so that will block access to /mnt, /media, /run/mount and /run/media. You will have to explicitly grant access to the symlinked downloads folder.
Author
Owner

@cjsthompson commented on GitHub (Feb 27, 2020):

It's mounted on /data and chown -R ~user.~user and chmod -R 0750.

<!-- gh-comment-id:592212172 --> @cjsthompson commented on GitHub (Feb 27, 2020): It's mounted on /data and chown -R ~user.~user and chmod -R 0750.
Author
Owner

@ghost commented on GitHub (Feb 27, 2020):

@cjsthompson Have you tried adding whitelist /data to a firefox-common.local file yet?

<!-- gh-comment-id:592218995 --> @ghost commented on GitHub (Feb 27, 2020): @cjsthompson Have you tried adding `whitelist /data` to a firefox-common.local file yet?
Author
Owner

@cjsthompson commented on GitHub (Feb 27, 2020):

Not a firefox-common.local but the /etc/firejail/whitelist-common.local and when I do that, then firefox won't start at all with "invalid whitelist path".

<!-- gh-comment-id:592223917 --> @cjsthompson commented on GitHub (Feb 27, 2020): Not a firefox-common.local but the /etc/firejail/whitelist-common.local and when I do that, then firefox won't start at all with "invalid whitelist path".
Author
Owner

@Vincent43 commented on GitHub (Feb 28, 2020):

/data is unusual path. Maybe you could use /mnt or /media ?

<!-- gh-comment-id:592481010 --> @Vincent43 commented on GitHub (Feb 28, 2020): /data is unusual path. Maybe you could use /mnt or /media ?
Author
Owner

@cjsthompson commented on GitHub (Mar 6, 2020):

I found the problem. It's in /etc/apparmor.d/firejail-default :

##########
# Allow write access to paths writable in firejail which aren't used for
# executing programs. /run, /proc and /sys are handled separately.
# Line starting with /run/firejail/mnt/oroot deal with --overlay sandboxes.
##########
/{,run/firejail/mnt/oroot/}{dev,etc,home,media,mnt,root,srv,tmp,var}/** w,

Adding /data to this list fixes the problem. Perhaps it would be useful to mention this somewhere.

<!-- gh-comment-id:595786291 --> @cjsthompson commented on GitHub (Mar 6, 2020): I found the problem. It's in /etc/apparmor.d/firejail-default : ``` ########## # Allow write access to paths writable in firejail which aren't used for # executing programs. /run, /proc and /sys are handled separately. # Line starting with /run/firejail/mnt/oroot deal with --overlay sandboxes. ########## /{,run/firejail/mnt/oroot/}{dev,etc,home,media,mnt,root,srv,tmp,var}/** w, ``` Adding /data to this list fixes the problem. Perhaps it would be useful to mention this somewhere.
Author
Owner

@Vincent43 commented on GitHub (Mar 6, 2020):

You may add local apparmor modifications to /etc/apparmor.d/local/firejail-{default,local} like:
/data/** w,

<!-- gh-comment-id:595954800 --> @Vincent43 commented on GitHub (Mar 6, 2020): You may add local apparmor modifications to `/etc/apparmor.d/local/firejail-{default,local}` like: `/data/** w,`
Author
Owner

@cjsthompson commented on GitHub (Mar 6, 2020):

That's indeed even better. Thanks for the tip.

<!-- gh-comment-id:595960840 --> @cjsthompson commented on GitHub (Mar 6, 2020): That's indeed even better. Thanks for the tip.
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#277
No description provided.