[GH-ISSUE #4087] chromium: child processes escape the network namespace sandbox #2530

Closed
opened 2026-05-05 09:12:26 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @ghost on GitHub (Mar 12, 2021).
Original GitHub issue: https://github.com/netblue30/firejail/issues/4087

Write clear, concise and in textual form.

Bug and expected behavior

  • Describe the bug.

I am running Chromium in a custom netns:
firejail --netns=for_wg chromium --user-data-dir="/home/lockywolf/.config/chromium" --disable-async-dns
Then I am finding firejail's pid:
pgrep firejail => 31669 (I actually do this by looking at the process tree, as there are two firejails.)
Then I look at the process tree:

lockywolf@delllaptop:~/BACKUP$ pstree -pST 31669 
firejail(31669)───firejail(31670)───chromium(31695)─┬─chromium(428)
                                                    ├─chromium(31707)───chromium(31730)───chromium(31743)
                                                    ├─chromium(31708,net,pid,user)───chromium(31710)─┬─chromium(1092,pid)
                                                    │                                                ├─chromium(1190,pid)
                                                    │                                                ├─chromium(1478,pid)
                                                    │                                                ├─chromium(31754,pid)
                                                    │                                                ├─chromium(31770,pid)
                                                    │                                                ├─chromium(31780,pid)
                                                    │                                                ├─chromium(31792,pid)
                                                    │                                                ├─chromium(31799,pid)
                                                    │                                                ├─chromium(31808,pid)
                                                    │                                                ├─chromium(31818,pid)
                                                    │                                                ├─chromium(31824,pid)
                                                    │                                                ├─chromium(31841,pid)
                                                    │                                                ├─chromium(31859,pid)
                                                    │                                                ├─chromium(31909,pid)
                                                    │                                                ├─chromium(31924,pid)
                                                    │                                                ├─chromium(31935,pid)
                                                    │                                                ├─chromium(31936,pid)
                                                    │                                                ├─chromium(31976,pid)
                                                    │                                                └─chromium(32313,pid)
                                                    └─chromium(31735)

Huh? PID 31708 escaped the sandbox? Checking:

lockywolf@delllaptop:~/BACKUP$ sudo /sbin/ip netns identify 31708

lockywolf@delllaptop:~/BACKUP$

Nothing!

  • What did you expect to happen?

I expected all Chromium's children to be in the for_wg netns.

No profile and disabling firejail

  • What changed calling firejail --noprofile /path/to/program in a terminal?
    Nothing, same behaviour.
  • What changed calling the program by path (check which <program> or firejail --list while the sandbox is running)?
    I do not understand the question.

Reproduce

  • Steps to reproduce the behavior:
    See above.

Environment

  • Linux distribution and version (ie output of lsb_release -a, screenfetch or cat /etc/os-release)
    Slackware 15.0 alpha1, kernel 5.10.21, glibc 2.33, chromium 89.0.4389.72 (Developer Build) (64-bit)
  • Firejail version (output of firejail --version) exclusive or used git commit (git rev-parse HEAD)
    0.9.64.4

Additional context
Other context about the problem like related errors to understand the problem.
Exactly the same behaviour happens if I run chromium with ip netns exec chromium ...
Checklist

  • The profile (and redirect profile if exists) hasn't already been fixed upstream.: I see nothing related to netns there.
  • The program has a profile. (If not, request one in https://github.com/netblue30/firejail/issues/1139)
  • I have performed a short search for similar issues (to avoid opening a duplicate).: Yes
  • If it is a AppImage, --profile=PROFILENAME is used to set the right profile. : Not an appimage.
  • Used LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 PROGRAM to get english error-messages.
  • I'm aware of browser-allow-drm yes/browser-disable-u2f no in firejail.config to allow DRM/U2F in browsers.: yes, but I do not use U2F and do not keep chrome executables in ~/
debug output

attaching stdout and stderr

firejail.chrome.debug.stderr.txt
firejail.chrome.debug.stdout.txt

The result of children being in a different namespace results in that different tabs of the browser are getting different routes and dns servers.

Originally created by @ghost on GitHub (Mar 12, 2021). Original GitHub issue: https://github.com/netblue30/firejail/issues/4087 Write clear, concise and in textual form. **Bug and expected behavior** - Describe the bug. I am running Chromium in a custom netns: `firejail --netns=for_wg chromium --user-data-dir="/home/lockywolf/.config/chromium" --disable-async-dns` Then I am finding firejail's pid: `pgrep firejail => 31669` (I actually do this by looking at the process tree, as there are two firejails.) Then I look at the process tree: ``` lockywolf@delllaptop:~/BACKUP$ pstree -pST 31669 firejail(31669)───firejail(31670)───chromium(31695)─┬─chromium(428) ├─chromium(31707)───chromium(31730)───chromium(31743) ├─chromium(31708,net,pid,user)───chromium(31710)─┬─chromium(1092,pid) │ ├─chromium(1190,pid) │ ├─chromium(1478,pid) │ ├─chromium(31754,pid) │ ├─chromium(31770,pid) │ ├─chromium(31780,pid) │ ├─chromium(31792,pid) │ ├─chromium(31799,pid) │ ├─chromium(31808,pid) │ ├─chromium(31818,pid) │ ├─chromium(31824,pid) │ ├─chromium(31841,pid) │ ├─chromium(31859,pid) │ ├─chromium(31909,pid) │ ├─chromium(31924,pid) │ ├─chromium(31935,pid) │ ├─chromium(31936,pid) │ ├─chromium(31976,pid) │ └─chromium(32313,pid) └─chromium(31735) ``` Huh? PID 31708 escaped the sandbox? Checking: ``` lockywolf@delllaptop:~/BACKUP$ sudo /sbin/ip netns identify 31708 lockywolf@delllaptop:~/BACKUP$ ``` Nothing! - What did you expect to happen? I expected all Chromium's children to be in the for_wg netns. **No profile and disabling firejail** - What changed calling `firejail --noprofile /path/to/program` in a terminal? Nothing, same behaviour. - What changed calling the program by path (check `which <program>` or `firejail --list` while the sandbox is running)? I do not understand the question. **Reproduce** - Steps to reproduce the behavior: See above. **Environment** - Linux distribution and version (ie output of `lsb_release -a`, `screenfetch` or `cat /etc/os-release`) Slackware 15.0 alpha1, kernel 5.10.21, glibc 2.33, chromium 89.0.4389.72 (Developer Build) (64-bit) - Firejail version (output of `firejail --version`) exclusive or used git commit (`git rev-parse HEAD`) 0.9.64.4 **Additional context** Other context about the problem like related errors to understand the problem. Exactly the same behaviour happens if I run chromium with `ip netns exec chromium ...` **Checklist** - [x] The profile (and redirect profile if exists) hasn't already been fixed [upstream](https://github.com/netblue30/firejail/tree/master/etc).: I see nothing related to netns there. - [x] The program has a profile. (If not, request one in `https://github.com/netblue30/firejail/issues/1139`) - [x] I have performed a short search for similar issues (to avoid opening a duplicate).: Yes - [x] If it is a AppImage, `--profile=PROFILENAME` is used to set the right profile. : Not an appimage. - [x] Used `LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 PROGRAM` to get english error-messages. - [x] I'm aware of `browser-allow-drm yes`/`browser-disable-u2f no` in `firejail.config` to allow DRM/U2F in browsers.: yes, but I do not use U2F and do not keep chrome executables in ~/ <details><summary> debug output </summary> attaching stdout and stderr [firejail.chrome.debug.stderr.txt](https://github.com/netblue30/firejail/files/6129041/firejail.chrome.debug.stderr.txt) [firejail.chrome.debug.stdout.txt](https://github.com/netblue30/firejail/files/6129043/firejail.chrome.debug.stdout.txt) </details> The result of children being in a different namespace results in that different tabs of the browser are getting different routes and dns servers.
gitea-mirror 2026-05-05 09:12:26 -06:00
Author
Owner

@rusty-snake commented on GitHub (Mar 12, 2021):

I guess that's because of chromiums sandbox. What happens if you start chromium with --no-sandbox?

EDIT: Does slackwares kernel support unprivileged userns clone? (sysctl kernel.unprivileged_userns_clone)

<!-- gh-comment-id:797378233 --> @rusty-snake commented on GitHub (Mar 12, 2021): I guess that's because of chromiums sandbox. What happens if you start chromium with `--no-sandbox`? EDIT: Does slackwares kernel support unprivileged userns clone? (`sysctl kernel.unprivileged_userns_clone`)
Author
Owner

@ghost commented on GitHub (Mar 12, 2021):

What happens if you start chromium with --no-sandbox?

Does what I expect it to do. Every child is in for_wg. I would have closed this issue, but em... relying on chromium's good will doesn't infuse me with certainty.

Does slackwares kernel support unprivileged userns clone? (sysctl kernel.unprivileged_userns_clone)

root@delllaptop:/home/lockywolf# sysctl kernel.unprivileged_userns_clone
sysctl: cannot stat /proc/sys/kernel/unprivileged_userns_clone: No such file or directory
<!-- gh-comment-id:797429918 --> @ghost commented on GitHub (Mar 12, 2021): >What happens if you start chromium with --no-sandbox? Does what I expect it to do. Every child is in `for_wg`. I would have closed this issue, but em... relying on chromium's good will doesn't infuse me with certainty. >Does slackwares kernel support unprivileged userns clone? (sysctl kernel.unprivileged_userns_clone) ``` root@delllaptop:/home/lockywolf# sysctl kernel.unprivileged_userns_clone sysctl: cannot stat /proc/sys/kernel/unprivileged_userns_clone: No such file or directory ```
Author
Owner

@rusty-snake commented on GitHub (Mar 12, 2021):

Does slackwares kernel support unprivileged userns clone? (sysctl kernel.unprivileged_userns_clone)

root@delllaptop:/home/lockywolf# sysctl kernel.unprivileged_userns_clone
sysctl: cannot stat /proc/sys/kernel/unprivileged_userns_clone: No such file or directory

This sysctl is a debian patch (used by debian and arch). Mainline does not have it. So unprivileged_userns_clone is supported on your system if userns is supported at all (sysctl user/max_user_namespaces != 0). Then it should work for you the enable chromium-common-hardened.inc (firejail >= 0.9.65 chromium-common-hardened.profile):

mkdir -p ~/.config/firejail
echo "include chromium-common-hardened.inc" >> ~/.config/firejail/chromium-common.local

relying on chromium's good will doesn't infuse me with certainty.

Chromium has it's own sandbox (surprise 😎 ) with a suid-helper in /usr/lib64/chromium/chrome-sandbox (or somewhere else, depending on distro/packages/chromium,vivaldi,brave,..). Chromium fails to start on systems w/o unprivileged_userns_clone if it's started with NO_NEW_PRIVS=1, in a own userns, with seccomp filters or a capability bounding set w/o CAP_SYS_CHROOT and CAP_SYS_ADMIN. Therefore all these this are allowed/disable by default.

So it can run code as root in the default users with NO_NEW_PRIVS=0 and CAP_SYS_ADMIN. In general that's are good starting point to:

  • setup new namespaces with less restrictions
  • escape where ever it wants (if the suid binary on your systems allows it)
  • undo blacklist and whitelist AFAICTY

You can also sudo chmod -s /usr/lib64/chromium-browser-privacy/chrome-sandbox if unprivileged_userns_clone is enabled. I do this via package-manager hocks (needs to be done after every update).

<!-- gh-comment-id:797441442 --> @rusty-snake commented on GitHub (Mar 12, 2021): > > Does slackwares kernel support unprivileged userns clone? (sysctl kernel.unprivileged_userns_clone) > > ``` > root@delllaptop:/home/lockywolf# sysctl kernel.unprivileged_userns_clone > sysctl: cannot stat /proc/sys/kernel/unprivileged_userns_clone: No such file or directory > ``` This sysctl is a debian patch (used by debian and arch). Mainline does not have it. So unprivileged_userns_clone is supported on your system if userns is supported at all (`sysctl user/max_user_namespaces` != 0). Then it should work for you the enable `chromium-common-hardened.inc` (firejail >= 0.9.65 `chromium-common-hardened.profile`): ``` mkdir -p ~/.config/firejail echo "include chromium-common-hardened.inc" >> ~/.config/firejail/chromium-common.local ``` > relying on chromium's good will doesn't infuse me with certainty. Chromium has it's own sandbox (surprise :sunglasses: ) with a suid-helper in `/usr/lib64/chromium/chrome-sandbox` (or somewhere else, depending on distro/packages/chromium,vivaldi,brave,..). Chromium fails to start on systems w/o unprivileged_userns_clone if it's started with NO_NEW_PRIVS=1, in a own userns, with seccomp filters or a capability bounding set w/o CAP_SYS_CHROOT and CAP_SYS_ADMIN. Therefore all these this are allowed/disable by default. So it can run code as root in the default users with NO_NEW_PRIVS=0 and CAP_SYS_ADMIN. In general that's are good starting point to: - setup new namespaces with less restrictions - escape where ever it wants (if the suid binary on your systems allows it) - undo `blacklist` and `whitelist` AFAICTY You can also `sudo chmod -s /usr/lib64/chromium-browser-privacy/chrome-sandbox` if unprivileged_userns_clone is enabled. I do this via package-manager hocks (needs to be done after every update).
Author
Owner

@rusty-snake commented on GitHub (Jun 10, 2021):

Any progress here?

<!-- gh-comment-id:858440505 --> @rusty-snake commented on GitHub (Jun 10, 2021): Any progress here?
Author
Owner

@rusty-snake commented on GitHub (Aug 4, 2021):

I'm closing here due to inactivity, please fell free to request to reopen if you have more questions.

<!-- gh-comment-id:892665196 --> @rusty-snake commented on GitHub (Aug 4, 2021): I'm closing here due to inactivity, please fell free to request to reopen if you have more questions.
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#2530
No description provided.